File size: 20,028 Bytes
55a3af4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
import Thurston.Core.RiemannHurwitzPoles
import Thurston.Core.LevyCycleChains

/-!
# Theorem 7.9 (`thm:rat-components`): Component lemma for branched coverings (combinatorial core)

Formalization of the combinatorial core (Steps 0, 2, 3, 4, 5) of Theorem 7.9 (`thm:rat-components`)
from S. van Strien, *The Thurston algorithm for meromorphic and rational maps*
(version 22, 3 December 2026), directly reusing `Thurston.Core.RiemannHurwitzPoles`
(`cor_poles_lower_bound`, `cor_poles_equality_rigidity`) and `Thurston.Core.LevyCycleChains`
(`chain_has_levy_cycle_of_deg_one_block`):

- **Step 0 (`card_nonflat_le`)**: A monotone sequence `4 ≤ p 0 ≤ … ≤ p k ≤ N` has at most
  `N - 4` non-flat steps (`p j ≠ p (j + 1)`).
- **Step 2 (`no_node_pole_at_depth_ge_r`)**: A degree-1 node-pole pullback chain into a multicurve
  of size `≤ r` with no Levy cycle must have depth `J < r`.
- **Step 3 (`flat_step_unramified_at_node`, `no_flat_run_with_node`)**: At a flat step `j ≥ r`,
  `cor_poles_equality_rigidity` forces every critical point to lie over `P_j`, which contains no
  node point by Step 2; hence `R_j` is unramified at every node point, ruling out `r` consecutive
  flat steps ending at a node-bearing depth `a + r` (via `chain_has_levy_cycle_of_deg_one_block`).
- **Step 5 (`interval_card_le_of_nonflat_and_flat_run`, `rat_components_j_star_bound`)**:
  At most `N - 4` non-flat steps cut the flat steps in `[r, j_* - 1)` into at most `N - 3` runs of
  length `≤ r - 1`, giving `j_* ≤ (N - 2) * (N - 3) < N ^ 2`.
- **Combined (`thm_rat_components_combinatorial`)**: With `r = N - 3`, `k ≥ N ^ 2 + N₀`, and
  Step 4 (`k - j < N₀` at any node-free depth `j ≤ k`), the descent sequence cannot exist.
-/

open Finset

namespace Thurston.Core

/-- A Levy cycle (minimal degree-1 repeat) in `[a, b]` for curve classes `α` and step degrees `d`.
Matches the conclusion of `chain_has_levy_cycle_of_deg_one_block`. -/
def HasLevyCycle {C : Type*} (α : ℕ → C) (d : ℕ → ℕ) (a b : ℕ) : Prop :=
  ∃ i i', a ≤ i ∧ i < i' ∧ i' ≤ b ∧ α i = α i' ∧
    (∀ u v, i ≤ u → u < v → v < i' → α u ≠ α v) ∧
    (∀ j, i < j → j ≤ i' → d j = 1)

/-- Image orbit of a point `z` at depth `b` pushed forward through `R_j : w_{j+1} → w_j` to
depths `i ≤ b`, satisfying `pullbackOrbit R b z b = z` and
`pullbackOrbit R b z i = R i (pullbackOrbit R b z (i + 1))` for `i < b`. -/
def pullbackOrbit {X : Type*} (R : ℕ → X → X) (b : ℕ) (z : X) (i : ℕ) : X :=
  Nat.rec (motive := fun _ => X) z (fun m prev => R (b - 1 - m) prev) (b - i)

private lemma pullbackOrbit_self {X : Type*} (R : ℕ → X → X) (b : ℕ) (z : X) :
    pullbackOrbit R b z b = z := by
  simp [pullbackOrbit]

private lemma pullbackOrbit_step {X : Type*} (R : ℕ → X → X) (b : ℕ) (z : X) {i : ℕ}
    (hi : i < b) :
    pullbackOrbit R b z i = R i (pullbackOrbit R b z (i + 1)) := by
  have hsub : b - i = (b - (i + 1)) + 1 := by omega
  have hidx : b - 1 - (b - (i + 1)) = i := by omega
  unfold pullbackOrbit
  rw [hsub]
  dsimp only
  rw [hidx]

private lemma pullbackOrbit_ind {X : Type*} (R : ℕ → X → X) (Q : ℕ → X → Prop)
    (a b : ℕ) (z : X) (hb : Q b z)
    (hstep : ∀ i x, a ≤ i → i < b → Q (i + 1) x → Q i (R i x)) :
    ∀ i ∈ Icc a b, Q i (pullbackOrbit R b z i) := by
  have haux : ∀ m, m ≤ b - a → Q (b - m) (pullbackOrbit R b z (b - m)) := by
    intro m
    induction m with
    | zero =>
      intro _
      simpa [pullbackOrbit_self] using hb
    | succ m ih =>
      intro hm
      have hlt : b - (m + 1) < b := by omega
      have hge : a ≤ b - (m + 1) := by omega
      have hsucc : b - (m + 1) + 1 = b - m := by omega
      rw [pullbackOrbit_step R b z hlt]
      refine hstep (b - (m + 1)) _ hge hlt ?_
      rw [hsucc]
      exact ih (by omega)
  intro i hi
  rw [mem_Icc] at hi
  have hbm : b - (b - i) = i := by omega
  simpa [hbm] using haux (b - i) (by omega)

section Step0AndCounting

/-- **Step 0 of Theorem 7.9 (`thm:rat-components`)**: A monotone pole-count sequence
`4 ≤ p 0 ≤ … ≤ p k ≤ N` has at most `N - 4` non-flat steps (`p j ≠ p (j + 1)`). -/
theorem card_nonflat_le (p : ℕ → ℕ) (k N : ℕ)
    (hp0 : 4 ≤ p 0)
    (hmono : ∀ j < k, p j ≤ p (j + 1))
    (hpk : p k ≤ N) :
    ((range k).filter fun j => p j ≠ p (j + 1)).card ≤ N - 4 := by
  have hbound : ∀ m ≤ k, ((range m).filter fun j => p j ≠ p (j + 1)).card + p 0 ≤ p m := by
    intro m
    induction m with
    | zero =>
      intro _
      simp
    | succ m ih =>
      intro hm
      have hstep : p m ≤ p (m + 1) := hmono m (by omega)
      have hih := ih (by omega)
      rw [range_add_one, filter_insert]
      split_ifs with hne
      · rw [card_insert_of_notMem (by simp)]
        omega
      · omega
  have hk := hbound k le_rfl
  omega

/-- **Step 5 (run-length counting)**: If `[a, b)` contains at most `M` non-flat indices and no
run of `r ≥ 1` consecutive flat indices, then `b - a ≤ M + (M + 1) * (r - 1)`. -/
theorem interval_card_le_of_nonflat_and_flat_run
    (isFlat : ℕ → Prop) [DecidablePred isFlat] (a b M r : ℕ)
    (hr : 1 ≤ r)
    (hnonflat : ((Ico a b).filter fun j => ¬ isFlat j).card ≤ M)
    (hnoRun : ∀ s, a ≤ s → s + r ≤ b → ∃ j ∈ Ico s (s + r), ¬ isFlat j) :
    b - a ≤ M + (M + 1) * (r - 1) := by
  induction M generalizing a with
  | zero =>
    by_contra h
    have har : a + r ≤ b := by omega
    obtain ⟨j, hj, hnf⟩ := hnoRun a le_rfl har
    rw [mem_Ico] at hj
    have hjmem : j ∈ (Ico a b).filter fun i => ¬ isFlat i :=
      mem_filter.mpr ⟨mem_Ico.mpr ⟨hj.1, by omega⟩, hnf⟩
    have hpos : 0 < ((Ico a b).filter fun i => ¬ isFlat i).card := card_pos.mpr ⟨j, hjmem⟩
    omega
  | succ M ih =>
    by_cases har : a + r ≤ b
    · obtain ⟨j, hj, hnf⟩ := hnoRun a le_rfl har
      rw [mem_Ico] at hj
      have hjmem : j ∈ (Ico a b).filter fun i => ¬ isFlat i :=
        mem_filter.mpr ⟨mem_Ico.mpr ⟨hj.1, by omega⟩, hnf⟩
      have hsub : ((Ico (j + 1) b).filter fun i => ¬ isFlat i) ⊆
          ((Ico a b).filter fun i => ¬ isFlat i).erase j := by
        intro i hi
        rw [mem_filter, mem_Ico] at hi
        exact mem_erase.mpr
          ⟨by omega, mem_filter.mpr ⟨mem_Ico.mpr ⟨by omega, hi.1.2⟩, hi.2⟩⟩
      have hcard_tail : ((Ico (j + 1) b).filter fun i => ¬ isFlat i).card ≤ M := by
        have hle := card_le_card hsub
        rw [card_erase_of_mem hjmem] at hle
        omega
      have htail := ih (j + 1) hcard_tail (fun s hs hsr => hnoRun s (by omega) hsr)
      have hmul : (M + 1 + 1) * (r - 1) = (M + 1) * (r - 1) + (r - 1) := by ring
      omega
    · have h1 : r - 1 ≤ (M + 1 + 1) * (r - 1) := Nat.le_mul_of_pos_left _ (by omega)
      omega

/-- **Step 5 (exact `j_*` bound)**: For `N ≥ 4` and `r = N - 3`, if `[r, j_* - 1)` has at most
`N - 4` non-flat steps and no `r` consecutive flat steps, then
`j_* ≤ (N - 2) * (N - 3)` and `(N - 2) * (N - 3) < N ^ 2`. -/
theorem rat_components_j_star_bound
    (isFlat : ℕ → Prop) [DecidablePred isFlat] (N r j_star : ℕ)
    (hN : 4 ≤ N) (hr : r = N - 3)
    (hnonflat : ((Ico r (j_star - 1)).filter fun j => ¬ isFlat j).card ≤ N - 4)
    (hnoRun : ∀ s, r ≤ s → s + r ≤ j_star - 1 → ∃ j ∈ Ico s (s + r), ¬ isFlat j) :
    j_star ≤ (N - 2) * (N - 3) ∧ (N - 2) * (N - 3) < N ^ 2 := by
  have hcount := interval_card_le_of_nonflat_and_flat_run isFlat r (j_star - 1) (N - 4) r
    (by omega) hnonflat hnoRun
  set m := N - 4
  have hN_eq : N = m + 4 := by omega
  have hr_eq : r = m + 1 := by omega
  have h1 : j_star ≤ (N - 2) * (N - 3) := by
    have hid : m + (m + 1) * m + (m + 2) = (m + 2) * (m + 1) := by ring
    have hsub : N - 2 = m + 2 := by omega
    have hsub3 : N - 3 = m + 1 := by omega
    rw [hsub, hsub3, ← hid]
    rw [hr_eq] at hcount
    have hrm : m + 1 - 1 = m := by omega
    rw [hrm] at hcount
    omega
  have h2 : (N - 2) * (N - 3) < N ^ 2 := by
    have hsub2 : N - 2 = m + 2 := by omega
    have hsub3 : N - 3 = m + 1 := by omega
    rw [hsub2, hsub3, hN_eq]
    nlinarith
  exact ⟨h1, h2⟩

end Step0AndCounting

section Steps2And3

/-- **Step 2 of Theorem 7.9 (`thm:rat-components`)**: From a degree-1 node-pole pullback chain
`α 0, …, α J` into a multicurve `S` of size `≤ r` with no Levy cycle on `[0, J]`, deduce
`J < r`. -/
theorem no_node_pole_at_depth_ge_r {C : Type*}
    (α : ℕ → C) (d : ℕ → ℕ) (S : Finset C) (J r : ℕ)
    (hcard : S.card ≤ r)
    (hmem : ∀ i ≤ J, α i ∈ S)
    (hdeg1 : ∀ i ∈ Icc 1 J, d i = 1)
    (hnoLevy : ¬ HasLevyCycle α d 0 J) :
    J < r := by
  by_contra h
  have hrJ : r ≤ J := Nat.le_of_not_lt h
  have hcycle : HasLevyCycle α d 0 (0 + r) :=
    chain_has_levy_cycle_of_deg_one_block α d S 0 r hcard
      (fun i hi => hmem i (by rw [mem_Icc] at hi; omega))
      (fun i hi => hdeg1 i (by rw [mem_Icc] at hi; exact mem_Icc.mpr ⟨by omega, by omega⟩))
  obtain ⟨i, i', hi, hii', hi'le, heq, hdist, hdeg⟩ := hcycle
  exact hnoLevy ⟨i, i', hi, hii', by omega, heq, hdist, hdeg⟩

/-- **Step 3 (part 1) of Theorem 7.9 (`thm:rat-components`)**: At a flat step
(`|P_{j+1}| = |P_j|`), if `P_j` contains no node point and `R_j(z)` is a node point, then `R_j`
is unramified at `z` (`deg z = 1`). When `deg R_j ≥ 2`, `cor_poles_equality_rigidity` forces all
`2 * d - 2` ramification to lie in `E = R_j⁻¹(P_j)`, leaving zero ramification at `z ∉ E`. -/
theorem flat_step_unramified_at_node {X : Type*} [DecidableEq X]
    (E P : Finset X) (R : X → X) (deg : X → ℕ) (isNode : X → Prop) (d : ℕ) (z : X)
    (hE_maps : ∀ w ∈ E, R w ∈ P)
    (hP_no_node : ∀ y ∈ P, ¬ isNode y)
    (hz_node : isNode (R z))
    (hpos_E : ∀ w ∈ E, 1 ≤ deg w)
    (hpos_z : 1 ≤ deg z)
    (hsum : ∑ w ∈ E, deg w = d * P.card)
    (hrh : ∑ w ∈ insert z E, (deg w - 1) ≤ 2 * d - 2)
    (hd : 1 ≤ d)
    (hP4 : 4 ≤ P.card)
    (hflat : (E.filter fun w => deg w = 1).card = P.card) :
    deg z = 1 := by
  have hz_not_mem : z ∉ E := fun hzE => hP_no_node (R z) (hE_maps z hzE) hz_node
  rw [sum_insert hz_not_mem] at hrh
  rcases eq_or_lt_of_le hd with rfl | hd2
  · omega
  · have hrh_E : ∑ w ∈ E, (deg w - 1) ≤ 2 * d - 2 := by omega
    have ⟨_, hϱ_eq, _⟩ :=
      cor_poles_equality_rigidity E deg d P.card hpos_E hsum hrh_E hd2 hP4 hflat
    omega

/-- **Step 3 (part 2) of Theorem 7.9 (`thm:rat-components`)**: There is no `a ≥ r` such that
`a, …, a + r - 1` are all flat and depth `a + r` has a node point: combining
`flat_step_unramified_at_node` with `chain_has_levy_cycle_of_deg_one_block` produces a Levy
cycle. -/
theorem no_flat_run_with_node {X C : Type*} [DecidableEq X]
    (P E : ℕ → Finset X) (R : ℕ → X → X) (dR : ℕ → ℕ) (locDeg : ℕ → X → ℕ)
    (isNode : ℕ → X → Prop) (curve : ℕ → X → C) (S : Finset C) (a r : ℕ)
    (ha : r ≤ a)
    (hS : S.card ≤ r)
    (hE_maps : ∀ j ∈ Ico a (a + r), ∀ w ∈ E j, R j w ∈ P j)
    (hP_no_node : ∀ j, r ≤ j → j < a + r → ∀ y ∈ P j, ¬ isNode j y)
    (hP4 : ∀ j ∈ Ico a (a + r), 4 ≤ (P j).card)
    (hdR : ∀ j ∈ Ico a (a + r), 1 ≤ dR j)
    (hpos : ∀ j ∈ Ico a (a + r), ∀ w, 1 ≤ locDeg j w)
    (hsum : ∀ j ∈ Ico a (a + r), ∑ w ∈ E j, locDeg j w = dR j * (P j).card)
    (hrh : ∀ j ∈ Ico a (a + r), ∀ z,
      ∑ w ∈ insert z (E j), (locDeg j w - 1) ≤ 2 * dR j - 2)
    (hnode : ∀ j ∈ Ico a (a + r), ∀ w, isNode (j + 1) w → isNode j (R j w))
    (hcurve : ∀ j ∈ Icc a (a + r), ∀ w, isNode j w → curve j w ∈ S)
    (hflat : ∀ j ∈ Ico a (a + r), ((E j).filter fun w => locDeg j w = 1).card = (P j).card)
    {z : X} (hz : isNode (a + r) z)
    (hnoLevy : ¬ HasLevyCycle
      (fun i => curve i (pullbackOrbit R (a + r) z i))
      (fun i => locDeg (i - 1) (pullbackOrbit R (a + r) z i)) a (a + r)) :
    False := by
  let orb := pullbackOrbit R (a + r) z
  have horb_node : ∀ i ∈ Icc a (a + r), isNode i (orb i) :=
    pullbackOrbit_ind R isNode a (a + r) z hz fun i x hai hib hx =>
      hnode i (mem_Ico.mpr ⟨hai, hib⟩) x hx
  have hmem : ∀ i ∈ Icc a (a + r), curve i (orb i) ∈ S :=
    fun i hi => hcurve i hi (orb i) (horb_node i hi)
  have hdeg1 : ∀ i ∈ Icc (a + 1) (a + r), locDeg (i - 1) (orb i) = 1 := by
    intro i hi
    rw [mem_Icc] at hi
    have hj : i - 1 ∈ Ico a (a + r) := mem_Ico.mpr ⟨by omega, by omega⟩
    have hsucc : i - 1 + 1 = i := by omega
    have hnode_i : isNode (i - 1 + 1) (orb i) := by
      rw [hsucc]
      exact horb_node i (mem_Icc.mpr ⟨by omega, hi.2⟩)
    exact flat_step_unramified_at_node (E (i - 1)) (P (i - 1)) (R (i - 1)) (locDeg (i - 1))
      (isNode (i - 1)) (dR (i - 1)) (orb i)
      (hE_maps (i - 1) hj)
      (hP_no_node (i - 1) (by omega) (by omega))
      (hnode (i - 1) hj (orb i) hnode_i)
      (fun w _ => hpos (i - 1) hj w)
      (hpos (i - 1) hj (orb i))
      (hsum (i - 1) hj)
      (hrh (i - 1) hj (orb i))
      (hdR (i - 1) hj)
      (hP4 (i - 1) hj)
      (hflat (i - 1) hj)
  exact hnoLevy (chain_has_levy_cycle_of_deg_one_block
    (fun i => curve i (orb i)) (fun i => locDeg (i - 1) (orb i)) S a r hS hmem hdeg1)

end Steps2And3

/-- **Theorem 7.9 (`thm:rat-components`), combinatorial core**:
Putting Steps 0, 2, 3, 4, 5 together: for `N ≥ 4`, `r = N - 3`, `k ≥ N ^ 2 + N₀`, a descent
sequence `w_0, …, w_k` satisfying pole bookkeeping (`cor:poles`), node lifting (`lem:lift`(i)),
multicurve containment `|Γ_n| ≤ r`, no Levy cycles, and the Step-4 saturation bound
(`k - j < N₀` whenever depth `j ≤ k` has no node point) cannot exist. -/
theorem thm_rat_components_combinatorial {X C : Type*} [DecidableEq X]
    (N r N₀ k : ℕ)
    (hN : 4 ≤ N) (hr : r = N - 3) (hk : N ^ 2 + N₀ ≤ k)
    (P E : ℕ → Finset X) (R : ℕ → X → X) (dR : ℕ → ℕ) (locDeg : ℕ → X → ℕ)
    (isNode : ℕ → X → Prop) (curve : ℕ → X → C) (S : Finset C)
    (hS : S.card ≤ r)
    (hP0 : 4 ≤ (P 0).card)
    (hPk : (P k).card ≤ N)
    (hP_succ : ∀ j < k, P (j + 1) = (E j).filter fun w => locDeg j w = 1)
    (hE_maps : ∀ j < k, ∀ w ∈ E j, R j w ∈ P j)
    (hdR : ∀ j < k, 1 ≤ dR j)
    (hpos : ∀ j < k, ∀ w, 1 ≤ locDeg j w)
    (hsum : ∀ j < k, ∑ w ∈ E j, locDeg j w = dR j * (P j).card)
    (hrh : ∀ j < k, ∀ z, ∑ w ∈ insert z (E j), (locDeg j w - 1) ≤ 2 * dR j - 2)
    (hnode : ∀ j < k, ∀ w, isNode (j + 1) w → isNode j (R j w))
    (hcurve : ∀ j ≤ k, ∀ w, isNode j w → curve j w ∈ S)
    (hnoLevy : ∀ a b, a ≤ b → b ≤ k → ∀ z, isNode b z →
      ¬ HasLevyCycle (fun i => curve i (pullbackOrbit R b z i))
        (fun i => locDeg (i - 1) (pullbackOrbit R b z i)) a b)
    (hstep4 : ∀ j ≤ k, (∀ z, ¬ isNode j z) → k - j < N₀) :
    False := by
  classical
  -- Step 0: derive `4 ≤ |P_j|` and `|P_j| ≤ |P_{j+1}|` via `cor_poles_lower_bound`.
  obtain ⟨z0, _⟩ : (P 0).Nonempty := card_pos.mp (by omega)
  have hP_step : ∀ j < k, 4 ≤ (P j).card → (P j).card ≤ (P (j + 1)).card := by
    intro j hj h4
    have hrh_E : ∑ w ∈ E j, (locDeg j w - 1) ≤ 2 * dR j - 2 :=
      le_trans (sum_le_sum_of_subset (subset_insert z0 (E j))) (hrh j hj z0)
    have hlb := cor_poles_lower_bound (E j) (locDeg j) (dR j) (P j).card
      (fun w _ => hpos j hj w) (hsum j hj) hrh_E (hdR j hj) h4
    rw [← hP_succ j hj] at hlb
    exact le_trans hlb.1 hlb.2
  have hP_ge4 : ∀ j ≤ k, 4 ≤ (P j).card := by
    intro j
    induction j with
    | zero => intro _; exact hP0
    | succ j ih =>
      intro hjk
      have h4 := ih (by omega)
      exact le_trans h4 (hP_step j (by omega) h4)
  have hP_mono : ∀ j < k, (P j).card ≤ (P (j + 1)).card :=
    fun j hj => hP_step j hj (hP_ge4 j (by omega))
  -- Step 2: no pole at a node point at depth `J ≥ r`.
  have hP_no_node : ∀ J, r ≤ J → J ≤ k → ∀ y ∈ P J, ¬ isNode J y := by
    intro J hJr hJk y hyP hyNode
    let orb := pullbackOrbit R J y
    have horb : ∀ i ∈ Icc 0 J, orb i ∈ P i ∧ isNode i (orb i) :=
      pullbackOrbit_ind R (fun i x => x ∈ P i ∧ isNode i x) 0 J y ⟨hyP, hyNode⟩
        fun i x _ hi hx => by
          have hik : i < k := by omega
          have hx' := hx.1
          rw [hP_succ i hik, mem_filter] at hx'
          exact ⟨hE_maps i hik x hx'.1, hnode i hik x hx.2⟩
    have hmem : ∀ i ≤ J, curve i (orb i) ∈ S := fun i hi =>
      hcurve i (by omega) (orb i) (horb i (mem_Icc.mpr ⟨Nat.zero_le i, hi⟩)).2
    have hdeg1 : ∀ i ∈ Icc 1 J, locDeg (i - 1) (orb i) = 1 := by
      intro i hi
      rw [mem_Icc] at hi
      have hmemP : orb i ∈ P (i - 1 + 1) := by
        have hsub : i - 1 + 1 = i := by omega
        rw [hsub]
        exact (horb i (mem_Icc.mpr ⟨by omega, hi.2⟩)).1
      rw [hP_succ (i - 1) (by omega), mem_filter] at hmemP
      exact hmemP.2
    have hlt : J < r := no_node_pole_at_depth_ge_r
      (fun i => curve i (orb i)) (fun i => locDeg (i - 1) (orb i)) S J r hS hmem hdeg1
      (hnoLevy 0 J (Nat.zero_le J) hJk y hyNode)
    omega
  -- Step 4/5: define `j_star` as the first node-free depth (or `k + 1` if none).
  let isFlat : ℕ → Prop := fun j => (P j).card = (P (j + 1)).card
  let j_star : ℕ :=
    if h : ∃ j ≤ k, ∀ z, ¬ isNode j z then Nat.find h else k + 1
  have hj_le : j_star ≤ k + 1 := by
    dsimp only [j_star]
    split_ifs with h
    · exact le_trans (Nat.find_spec h).1 (Nat.le_succ k)
    · exact le_rfl
  have hnode_lt : ∀ j < j_star, ∃ z, isNode j z := by
    intro j hj
    dsimp only [j_star] at hj
    split_ifs at hj with h
    · by_contra hno
      push Not at hno
      have hj_le_k : j ≤ k := le_trans (le_of_lt hj) (Nat.find_spec h).1
      exact Nat.find_min h hj ⟨hj_le_k, hno⟩
    · by_contra hno
      push Not at hno
      exact h ⟨j, by omega, hno⟩
  -- Step 0 count restricted to `[r, j_star - 1) ⊆ range k`.
  have hnonflat_all := card_nonflat_le (fun j => (P j).card) k N hP0 hP_mono hPk
  have hnonflat_sub : ((Ico r (j_star - 1)).filter fun j => ¬ isFlat j).card ≤ N - 4 := by
    refine le_trans (card_le_card ?_) hnonflat_all
    intro j hj
    rw [mem_filter, mem_Ico] at hj
    exact mem_filter.mpr ⟨mem_range.mpr (by omega), hj.2⟩
  -- Step 3 rules out `r` consecutive flat steps in `[r, j_star - 1)`.
  have hnoRun :
      ∀ s, r ≤ s → s + r ≤ j_star - 1 → ∃ j ∈ Ico s (s + r), ¬ isFlat j := by
    intro s hs hsr
    by_contra hall
    push Not at hall
    have hsr_lt : s + r < j_star := by omega
    have hsr_le : s + r ≤ k := by omega
    obtain ⟨z, hz⟩ := hnode_lt (s + r) hsr_lt
    exact no_flat_run_with_node P E R dR locDeg isNode curve S s r hs hS
      (fun j hj => hE_maps j (by rw [mem_Ico] at hj; omega))
      (fun j hjr hjsr => hP_no_node j hjr (by omega))
      (fun j hj => hP_ge4 j (by rw [mem_Ico] at hj; omega))
      (fun j hj => hdR j (by rw [mem_Ico] at hj; omega))
      (fun j hj => hpos j (by rw [mem_Ico] at hj; omega))
      (fun j hj => hsum j (by rw [mem_Ico] at hj; omega))
      (fun j hj => hrh j (by rw [mem_Ico] at hj; omega))
      (fun j hj => hnode j (by rw [mem_Ico] at hj; omega))
      (fun j hj => hcurve j (by rw [mem_Icc] at hj; omega))
      (fun j hj => by
        have hjk : j < k := by rw [mem_Ico] at hj; omega
        have hf : (P j).card = (P (j + 1)).card := hall j hj
        rw [← hP_succ j hjk]
        exact hf.symm)
      hz
      (hnoLevy s (s + r) (by omega) hsr_le z hz)
  -- Step 5: deduce `j_star ≤ (N - 2) * (N - 3) < N ^ 2`, contradicting Step 4.
  have ⟨hj_bound, hsq⟩ :=
    rat_components_j_star_bound isFlat N r j_star hN hr hnonflat_sub hnoRun
  have hj_lt_k : j_star < k := by omega
  dsimp only [j_star] at hj_lt_k hj_bound
  split_ifs at hj_lt_k hj_bound with h
  · have hspec := Nat.find_spec h
    have h4 := hstep4 (Nat.find h) hspec.1 hspec.2
    omega
  · omega

end Thurston.Core