Lean sources / SurfaceBlowup / Recursion / OrderDefect.lean

Order defects and child data for the blowup recursion

1150 lines · 14 public declarations · raw file · declaration index

1/-2Copyright (c) 2026 Asvin G, Claude (Anthropic), GPT-6-Astra (OpenAI). All rights reserved.3Released under Apache 2.0 license as described in the file LICENSE.4Authors: Asvin G, Claude (Anthropic), GPT-6-Astra (OpenAI)5-/6import SurfaceBlowup.Formula.PatternCounts7import SurfaceBlowup.Recursion.Termination8 9/-!10# Order defects and child data for the blowup recursion11 12The order defect `orderDefect O A` (the `O`-length of the generic closure of `A` modulo the13image of `A`) controls termination of the blowup recursion. This file proves its additivity14along finite-cokernel injections into products and its monotonicity in the children; the15combinatorics matching children of a tangent pattern with points of an exceptional divisor;16and the explicit completed local rings (child data) at points of the exceptional line of the17`t`-chart, including the one-chart atlas for repeated-root states.18 19## Main results20 21* `order_defect_children_sum`, `order_defect_child_le`, `etale_invariant_children`:22  `δ(A) = Σⱼ δ(Bⱼ) + ℓ` and the resulting strict decrease of the order defect.23* `cell_assignment_exists`, `concrete_member_divisor_count`: children ↔ divisor points, and24  the count of divisors with a given tangent pattern.25* `series_quotient_equiv_adjoinRoot`, `repeated_root_chart_type`,26  `repeated_root_one_chart_atlas`: the repeated-root chart.27* `t_chart_rational_point_child_data`, `t_chart_nonrational_point_child_data`,28  `cell_child_Phi_eq_map`: child data at closed points of the exceptional line.29 30Provenance: `Thm_SurfaceBlowupV2_` nodes `order_defect_{transport,children_sum,child_le}`,31`order_image_free`, `order_defect_ne_top_of_type`, `etale_invariant_children`,32`otherChildren_count`, `cell_assignment_exists`, `pattern_divisors_finite`,33`concrete_member_divisor_count`, `pi_field_quotient_equiv`, `root_cell_clauses_reindex`,34`scaled_strict_map_measurable`, `series_quotient_equiv_adjoinRoot`,35`repeated_root_{chart_type,one_chart_atlas}`, `strict_transform_map_along_point_equiv`,36`divisor_strict_transform_map_along_equiv`, `cell_child_Phi_eq_map`,37`t_chart_{nonrational,rational}_point_child_data`.38-/39 40open scoped BigOperators ENNReal TensorProduct41 42namespace SurfaceBlowup43 44/-! ### Order defects -/45 46private theorem length_quotient_map_add (O : Type) [CommRing O] (N C : Type) [AddCommGroup N]47    [Module O N]48    [AddCommGroup C] [Module O C] (j : N →ₗ[O] C) (hj : Function.Injective j) (P : Submodule O N) :49    Module.length O (C ⧸ P.map j) = Module.length O (N ⧸ P) +50        Module.length O (C ⧸ LinearMap.range j) := by51  have hle : P.map j ≤ LinearMap.range j := by52    rintro _ ⟨x, _, rfl⟩; exact ⟨x, rfl⟩53  let f : (N ⧸ P) →ₗ[O] (C ⧸ P.map j) := P.mapQ (P.map j) j (fun x hx ↦ ⟨x, hx, rfl⟩)54  let g : (C ⧸ P.map j) →ₗ[O] (C ⧸ LinearMap.range j) := Submodule.factor hle55  refine Module.length_eq_add_of_exact f g ?_ ?_ ?_56  · rw [← LinearMap.ker_eq_bot, eq_bot_iff]57    intro x hx58    induction x using Submodule.Quotient.induction_on with59    | H y =>60    rw [LinearMap.mem_ker] at hx61    change Submodule.Quotient.mk (j y) = 0 at hx62    rw [Submodule.Quotient.mk_eq_zero] at hx63    obtain ⟨z, hz, hzy⟩ := hx64    rw [hj hzy] at hz65    simpa using hz66  · exact Submodule.factor_surjective hle67  · intro x68    induction x using Submodule.Quotient.induction_on with69    | H c =>70    change Submodule.Quotient.mk c = 0 ↔ _71    rw [Submodule.Quotient.mk_eq_zero]72    constructor73    · rintro ⟨y, rfl⟩74      exact ⟨Submodule.Quotient.mk y, rfl⟩75    · rintro ⟨y, hy⟩76      induction y using Submodule.Quotient.induction_on with77      | H y =>78      change Submodule.Quotient.mk (j y) = Submodule.Quotient.mk c at hy79      rw [Submodule.Quotient.eq] at hy80      obtain ⟨z, _, hz⟩ := hy81      refine ⟨y - z, ?_⟩82      rw [map_sub, hz]; abel83 84private noncomputable def genericInclusion (O : Type) [CommRing O] [IsDomain O] (B : Type)85    [CommRing B]86    [Algebra O B]87    [Module.Finite O B] : B →ₗ[O] GenericClosure O B where88  toFun b := (⟨(1 : BaseField O) ⊗ₜ[O] b,89    (Algebra.IsIntegral.isIntegral (R := O) b).map90      (Algebra.TensorProduct.includeRight : B →ₐ[O] BaseField O ⊗[O] B)⟩ :91      integralClosure O (BaseField O ⊗[O] B))92  map_add' _ _ := Subtype.ext (TensorProduct.tmul_add _ _ _)93  map_smul' _ _ := Subtype.ext (TensorProduct.tmul_smul _ _ _)94 95private theorem orderImage_eq_range (O : Type) [CommRing O] [IsDomain O] (B : Type) [CommRing B]96    [Algebra O B]97    [Module.Finite O B] : orderImage O B = LinearMap.range (genericInclusion O B) := by98  ext x99  exact ⟨fun ⟨b, hb⟩ ↦ ⟨b, Subtype.ext hb⟩, fun ⟨b, hb⟩ ↦ ⟨b, hb ▸ rfl⟩⟩100 101private theorem genericInclusion_injective (O : Type) [CommRing O] [IsDomain O] (B : Type)102    [CommRing B] [Algebra O B]103    [Module.Finite O B] [Module.Free O B] : Function.Injective (genericInclusion O B) := by104  intro x y h105  have h2 : (1 : BaseField O) ⊗ₜ[O] x = (1 : BaseField O) ⊗ₜ[O] y := congrArg Subtype.val h106  have hinj : Function.Injective (LinearMap.rTensor B (Algebra.linearMap O (BaseField O))) :=107    Module.Flat.rTensor_preserves_injective_linearMap _ (IsFractionRing.injective O (BaseField O))108  exact (TensorProduct.lid O B).symm.injective (hinj (by simpa using h2))109 110 111/-- If `ψ : A →ₐ[O] N` is injective with `N` finite free and `ψ` becomes bijective after base112change to the fraction field, then `orderDefect O A = orderDefect O N + ℓ`, where `ℓ` is the113`O`-length of the cokernel of `ψ`. -/114private theorem order_defect_transport (O : Type) [CommRing O] [IsDomain O] (A N : Type)115    [CommRing A]116    [CommRing N] [Algebra O A] [Algebra O N] [Module.Finite O A] [Module.Finite O N]117    [Module.Free O N] (ψ : A →ₐ[O] N)118    (hbij : Function.Bijective119        (Algebra.TensorProduct.map (AlgHom.id (BaseField O) (BaseField O)) ψ))120    (ℓ : ℕ) (hℓ : Module.length O (N ⧸ LinearMap.range ψ.toLinearMap) = ℓ) :121    orderDefect O A = orderDefect O N + ℓ := by122  let Ψ := AlgEquiv.ofBijective _ hbij123  let φ : GenericClosure O A ≃ₐ[O] GenericClosure O N := (Ψ.restrictScalars O).mapIntegralClosure124  have hφ : ∀ a, φ (genericInclusion O A a) = genericInclusion O N (ψ a) := by125    intro a126    apply Subtype.ext127    change Ψ ((1 : BaseField O) ⊗ₜ[O] a) = (1 : BaseField O) ⊗ₜ[O] ψ a128    simp [Ψ]129  have hS : (orderImage O A).map φ.toLinearEquiv.toLinearMap130      = (LinearMap.range ψ.toLinearMap).map (genericInclusion O N) := by131    rw [orderImage_eq_range, LinearMap.range_eq_map, LinearMap.range_eq_map, ← Submodule.map_comp,132      ← Submodule.map_comp]133    congr 1134  have h1 : orderDefect O A = Module.length O (GenericClosure O N ⧸135      (LinearMap.range ψ.toLinearMap).map (genericInclusion O N)) := by136    unfold orderDefect137    rw [← hS]138    exact (Submodule.Quotient.equiv _ _ φ.toLinearEquiv rfl).length_eq139  rw [h1, length_quotient_map_add O N _ (genericInclusion O N) (genericInclusion_injective O N), hℓ,140    orderDefect, orderImage_eq_range, add_comm]141 142/-- Additivity of the order defect over a DVR: for an injection `ψ : A → ∏ⱼ Bⱼ` with cokernel143of length `ℓ`, `orderDefect O A = Σⱼ orderDefect O (Bⱼ) + ℓ`. -/144theorem order_defect_children_sum (O : Type) [CommRing O] [IsDomain O] [IsDiscreteValuationRing O]145    (A : Type) [CommRing A] [Algebra O A] [Module.Finite O A] (n : ℕ) (B : Fin n → Type)146    [∀ j, CommRing (B j)] [∀ j, Algebra O (B j)] [∀ j, Module.Finite O (B j)]147    [∀ j, Module.Free O (B j)] (ψ : A →ₐ[O] ∀ j, B j) (hinj : Function.Injective ψ) (ℓ : ℕ)148    (hℓ : Module.length O ((∀ j, B j) ⧸ LinearMap.range ψ.toLinearMap) = ℓ) :149    orderDefect O A = ∑ j, orderDefect O (B j) + ℓ := by150  have h := baseChange_bijective_of_finite_cokernel O A (∀ j, B j) ψ.toLinearMap hinj ℓ hℓ151  have hbij : Function.Bijective152      (Algebra.TensorProduct.map (AlgHom.id (BaseField O) (BaseField O)) ψ) := by153    have : ⇑(Algebra.TensorProduct.map (AlgHom.id (BaseField O) (BaseField O)) ψ) =154      ⇑(LinearMap.baseChange (BaseField O) ψ.toLinearMap) := by155      funext x156      induction x using TensorProduct.inductionOn with157      | tmul a b => simp158      | add x y hx hy => simp only [map_add, hx, hy]159    exact this ▸ h160  rw [order_defect_transport O A (∀ j, B j) ψ hbij ℓ hℓ,161    order_defect_pi]162 163/-- If `A ↪ ∏ⱼ Bⱼ` has cokernel of length `ℓ` and `A` has finite order defect, then each `Bⱼ` has164finite order defect at most that of `A`, strictly smaller when `ℓ ≥ 1`. -/165theorem order_defect_child_le (O : Type) [CommRing O] [IsDomain O] [IsDiscreteValuationRing O]166    (A : Type) [CommRing A] [Algebra O A] [Module.Finite O A] (n : ℕ) (B : Fin n → Type)167    [∀ j, CommRing (B j)] [∀ j, Algebra O (B j)] [∀ j, Module.Finite O (B j)]168    [∀ j, Module.Free O (B j)] (ψ : A →ₐ[O] ∀ j, B j) (hinj : Function.Injective ψ) (ℓ : ℕ)169    (hℓ : Module.length O ((∀ j, B j) ⧸ LinearMap.range ψ.toLinearMap) = ℓ)170    (hA : orderDefect O A ≠ ⊤) :171    ∀ j, orderDefect O (B j) ≤ orderDefect O A ∧ orderDefect O (B j) ≠ ⊤ ∧172    (1 ≤ ℓ → orderDefect O (B j) < orderDefect O A) := by173  intro j174  have h := order_defect_children_sum O A n B ψ hinj ℓ hℓ175  have h1 : orderDefect O (B j) ≤ ∑ j', orderDefect O (B j') :=176    Finset.single_le_sum (f := fun j' ↦ orderDefect O (B j')) (fun _ _ ↦ zero_le)177      (Finset.mem_univ j)178  have h2 : orderDefect O (B j) ≤ orderDefect O A := h ▸ h1.trans le_self_add179  have hS : ∑ j', orderDefect O (B j') ≠ ⊤ := ne_top_of_le_ne_top hA (h ▸ le_self_add)180  refine ⟨h2, ne_top_of_le_ne_top hA h2, fun hl ↦ ?_⟩181  obtain ⟨m, hm⟩ := ENat.ne_top_iff_exists.mp hS182  refine lt_of_le_of_lt h1 ?_183  rw [h, ← hm]184  have : m < m + ℓ := by omega185  exact_mod_cast this186 187/-- For a finite free `O`-algebra `B`: `B → K ⊗[O] B` is injective, the order image of `B` is188finite free of rank `rank B`, and `K ⊗[O] B` has `K`-dimension `rank B` (`K = BaseField O`). -/189private theorem order_image_free (O : Type) [CommRing O] [IsDomain O] (B : Type) [CommRing B]190    [Algebra O B]191    [Module.Finite O B] [Module.Free O B] :192    Function.Injective193      (Algebra.TensorProduct.includeRight : B →ₐ[O] TensorProduct O (BaseField O) B) ∧194    Module.Finite O (orderImage O B) ∧ Module.Free O (orderImage O B) ∧195    Module.finrank O (orderImage O B) = Module.finrank O B ∧196    Module.finrank (BaseField O) (TensorProduct O (BaseField O) B) = Module.finrank O B := by197  have hinj : Function.Injective198      (Algebra.TensorProduct.includeRight : B →ₐ[O] TensorProduct O (BaseField O) B) :=199    Algebra.TensorProduct.includeRight_injective (IsFractionRing.injective O (FractionRing O))200  have hint : ∀ b : B,201      (Algebra.TensorProduct.includeRight : B →ₐ[O] TensorProduct O (BaseField O) B) b ∈202      integralClosure O (TensorProduct O (BaseField O) B) := fun b ↦203    (IsIntegral.of_finite O b).map _204  let ρ : B →ₗ[O] GenericClosure O B :=205    LinearMap.codRestrict (integralClosure O (TensorProduct O (BaseField O) B)).toSubmodule206      (Algebra.TensorProduct.includeRight :207        B →ₐ[O] TensorProduct O (BaseField O) B).toLinearMap hint208  have hρ : Function.Injective ρ := fun x y h ↦ hinj (congrArg Subtype.val h)209  have hrange : LinearMap.range ρ = orderImage O B := by210    ext z211    exact ⟨fun ⟨b, hb⟩ ↦ ⟨b, hb ▸ rfl⟩, fun ⟨b, hb⟩ ↦ ⟨b, Subtype.ext hb⟩⟩212  let e : B ≃ₗ[O] orderImage O B :=213    (LinearEquiv.ofInjective ρ hρ).trans (LinearEquiv.ofEq _ _ hrange)214  exact ⟨hinj, Module.Finite.equiv e, Module.Free.of_equiv e, (LinearEquiv.finrank_eq e).symm,215    Module.finrank_baseChange⟩216 217/-- A finite free algebra admitting a factorization type, over a DVR with finite residue field,218has finite order defect. -/219private theorem order_defect_ne_top_of_type (O : Type) [CommRing O] [IsDomain O]220    [IsDiscreteValuationRing O]221    [Finite (IsLocalRing.ResidueField O)] (B : Type) [CommRing B] [Algebra O B] [Module.Finite O B]222    [Module.Free O B] (σ : FactorType) (h : HasAlgebraType O B σ) :223    orderDefect O B ≠ ⊤ := by224  obtain ⟨_, _, hr⟩ := generic_closure_free_of_type O B σ h225  obtain ⟨_, _, _, hr2, hr3⟩ := order_image_free O B226  exact full_rank_free_submodule_finite_length O (GenericClosure O B) (orderImage O B)227    (by rw [hr2, hr, hr3])228 229/-- The order defects of the children `Bⱼ`, measured over their own DVRs `Oⱼ` (in which `π` stays230a uniformizer), are at most the order defect of `A`, and strictly smaller when `ℓ ≥ 1`. -/231theorem etale_invariant_children (O : Type) [CommRing O] [IsDomain O] [IsDiscreteValuationRing O]232    [Finite (IsLocalRing.ResidueField O)] (n : ℕ) (Oj : Fin n → Type) [∀ j, CommRing (Oj j)]233    [∀ j, IsDomain (Oj j)] [∀ j, IsDiscreteValuationRing (Oj j)] [∀ j, Algebra O (Oj j)]234    [∀ j, Module.Finite O (Oj j)] [∀ j, Module.Free O (Oj j)] (δ : Fin n → ℕ)235    (hrank : ∀ j, Module.finrank O (Oj j) = δ j) (pi : O) (hpi : Irreducible pi)236    (hpiδ : ∀ j, Irreducible (algebraMap O (Oj j) pi)) (A : Type) [CommRing A] [Algebra O A]237    [Module.Finite O A] [Module.Free O A] (B : Fin n → Type) [∀ j, CommRing (B j)]238    [∀ j, Algebra O (B j)] [∀ j, Module.Finite O (B j)] [∀ j, Module.Free O (B j)]239    [∀ j, Algebra (Oj j) (B j)] [∀ j, IsScalarTower O (Oj j) (B j)] (ψ : A →ₐ[O] ∀ j, B j)240    (hinj : Function.Injective ψ) (ℓ : ℕ)241    (hℓ : Module.length O ((∀ j, B j) ⧸ LinearMap.range ψ.toLinearMap) = ℓ) (σ : FactorType)242    (hσ : HasAlgebraType O A σ) :243    ∀ j, (orderDefect (Oj j) (B j)).toNat ≤ (orderDefect O A).toNat ∧244    (1 ≤ ℓ → (orderDefect (Oj j) (B j)).toNat < (orderDefect O A).toNat) := by245  have hA : orderDefect O A ≠ ⊤ := order_defect_ne_top_of_type O A σ hσ246  intro j247  have h₁ := order_defect_le_of_tower O (Oj j) (δ j) (hrank j) pi hpi (hpiδ j) (B j)248  obtain ⟨h₂, _, h₃⟩ := order_defect_child_le O A n B ψ hinj ℓ hℓ hA j249  refine ⟨ENat.toNat_le_toNat (h₁.trans h₂) hA, fun h ↦ ?_⟩250  have hlt := h₁.trans_lt (h₃ h)251  have hne := ne_top_of_lt hlt252  rw [← ENat.natCast_toNat_eq_self.2 hne, ← ENat.natCast_toNat_eq_self.2 hA] at hlt253  exact_mod_cast hlt254 255/-! ### Children of a tangent pattern and exceptional divisors -/256 257/-- Multiplicities in `otherChildren w mm`: the child `(δ, single w r)` occurs `mm (δ-1, r-1)`258times (zero outside the index range), and no other single or crossing state occurs. -/259private theorem otherChildren_count (n : ℕ) (w : ℕ) (mm : Pattern n) (δ r : ℕ) :260    (otherChildren w mm).count (δ, State.single w r) =261        (if h : 1 ≤ δ ∧ δ ≤ n ∧ 1 ≤ r ∧ r ≤ n then262          (mm (⟨δ - 1, by omega⟩, ⟨r - 1, by omega⟩)).val else 0) ∧263    (∀ w' r', w' ≠ w → (otherChildren w mm).count (δ, State.single w' r') = 0) ∧264    ∀ (a' b' c' h' : ℕ), (otherChildren w mm).count (δ, State.crossing a' b' c' h') = 0 := by265  have key : ∀ v : ℕ × State, (otherChildren w mm).count v =266      ∑ ij : Fin n × Fin n,267        if (ij.1.val+1, State.single w (ij.2.val+1)) = v then (mm ij).val else 0 := by268    intro v269    unfold otherChildren270    rw [List.count_flatMap]271    rw [← Finset.sum_map_toList Finset.univ272      (fun ij : Fin n × Fin n ↦273        if (ij.1.val+1, State.single w (ij.2.val+1)) = v then (mm ij).val else 0)]274    congr 1275    apply List.map_congr_left276    intro ij _277    simp only [Function.comp, List.count_replicate]278    by_cases h : (ij.1.val+1, State.single w (ij.2.val+1)) = v <;> simp [h]279  refine ⟨?_, ?_, ?_⟩280  · rw [key]281    split_ifs with h282    · rw [Finset.sum_eq_single (⟨δ - 1, by omega⟩, ⟨r - 1, by omega⟩)]283      · rw [ite_eq_left]284        simp [Prod.ext_iff]; omega285      · rintro ⟨i, j⟩ _ hne286        rw [ite_eq_right]287        intro he288        simp only [Prod.mk.injEq, State.single.injEq] at he289        apply hne290        ext <;> simp <;> omega291      · simp292    · apply Finset.sum_eq_zero293      rintro ⟨i, j⟩ _294      rw [ite_eq_right]295      intro he296      simp only [Prod.mk.injEq, State.single.injEq] at he297      have := i.2; have := j.2298      apply h; omega299  · intro w' r' hw300    rw [key]301    refine Finset.sum_eq_zero fun ij _ ↦ ite_eq_right fun he ↦ ?_302    simp only [Prod.mk.injEq, State.single.injEq] at he303    exact hw he.2.1.symm304  · intro a b c h305    rw [key]306    exact Finset.sum_eq_zero fun ij _ ↦ ite_eq_right (by simp)307 308open scoped Classical in309private lemma natCard_subtype_eq_filter_card {α : Type} (T : Finset α) (p : α → Prop)310    (h : ∀ x, p x → x ∈ T) :311    Nat.card {x // p x} = (T.filter p).card := by312  rw [← Nat.card_eq_finsetCard]313  exact Nat.card_congr (Equiv.subtypeEquivRight (fun x ↦ by314    simp only [Finset.mem_filter]; exact ⟨fun hp ↦ ⟨h x hp, hp⟩, fun hp ↦ hp.2⟩))315 316private lemma directionDegree_mul_le (k : Type) [Field k] (Dv : ExceptionalDivisor k)317    (Q : ClosedDirection k) : directionDegree k Q * Dv Q ≤ exceptionalDegree k Dv := by318  unfold exceptionalDegree Finsupp.sum319  by_cases hQ : Q ∈ Dv.support320  · exact Finset.single_le_sum (f := fun P ↦ directionDegree k P * Dv P)321      (fun _ _ ↦ Nat.zero_le _) hQ322  · simp [Finsupp.notMem_support_iff.mp hQ]323 324open scoped Classical in325private lemma otherChildren_count_eq_card (k : Type) [Field k] (s : State)326    (P : TangentPattern s.degree)327    (Dv : ExceptionalDivisor k)328    (hDv : HasPattern k s Dv P) (w : ℕ)329    (hw : ∀ Q, Q ∉ boundaryDirections k s → pointChildState k s P.d.val Dv Q =330        State.single w (Dv Q))331    (c : ℕ × State) :332    (otherChildren w P.other).count c =333      (Dv.support.filter (fun Q ↦ (directionDegree k Q, pointChildState k s P.d.val Dv Q) = c ∧334        Q ∉ boundaryDirections k s)).card := by335  have hfc : Dv.support.filter336      (fun Q ↦ (directionDegree k Q, pointChildState k s P.d.val Dv Q) = c ∧337        Q ∉ boundaryDirections k s) = Dv.support.filter (fun Q ↦ Q ∉ boundaryDirections k s ∧338        (directionDegree k Q, State.single w (Dv Q)) = c) :=339    Finset.filter_congr fun Q _ ↦ by340      by_cases h : Q ∈ boundaryDirections k s <;> simp [h, hw Q, and_comm]341  rw [hfc]342  have hOC := otherChildren_count s.degree w P.other343  obtain ⟨δ, st⟩ := c344  have hempty : ∀ (p : ClosedDirection k → Prop) [DecidablePred p],345      (∀ Q, Dv Q ≠ 0 → ¬ p Q) → (Dv.support.filter p).card = 0 := fun p _ hp ↦346    Finset.card_eq_zero.2 (Finset.filter_eq_empty_iff.2 fun Q hQ ↦347      hp Q (Finsupp.mem_support_iff.mp hQ))348  rcases st with ⟨w', r⟩ | ⟨a', b', c', h'⟩349  · by_cases hww : w' = w350    · subst hww351      rw [(hOC δ r).1]352      split_ifs with hc353      · have := hDv.2.2.2 (⟨δ - 1, by omega⟩, ⟨r - 1, by omega⟩)354        rw [natCard_subtype_eq_filter_card Dv.support _355          (fun Q hQ ↦ Finsupp.mem_support_iff.mpr (by simp at hQ; omega))] at this356        rw [← this]357        congr 1358        ext Q359        simp only [Finset.mem_filter, Prod.mk.injEq, State.single.injEq, true_and]360        exact ⟨fun ⟨h1, h2, _, _⟩ ↦ ⟨h1, h2, by omega⟩,361          fun ⟨h1, h2, _⟩ ↦ ⟨h1, h2, by omega, by omega⟩⟩362      · refine (hempty _ ?_).symm363        rintro Q hQ ⟨_, h2⟩364        simp only [Prod.mk.injEq, State.single.injEq, true_and] at h2365        have h5 := directionDegree_mul_le k Dv Q366        rw [hDv.1] at h5367        have := Nat.le_mul_of_pos_left (Dv Q) (directionDegree_pos k Q)368        have := Nat.le_mul_of_pos_right (directionDegree k Q) (Nat.pos_of_ne_zero hQ)369        have := P.d.isLt370        have := directionDegree_pos k Q371        exact hc (by omega)372    · rw [(hOC δ r).2.1 w' r hww]373      refine (hempty _ ?_).symm374      rintro Q _ ⟨_, h2⟩375      simp only [Prod.mk.injEq, State.single.injEq] at h2376      exact hww h2.2.1.symm377  · rw [(hOC δ 0).2.2 a' b' c' h']378    exact (hempty _ fun Q _ ⟨_, h2⟩ ↦ by simp at h2).symm379 380private lemma beq_inst_eq : (instBEqOfDecidableEq : BEq (ℕ × State)) = instBEqProd :=381  lawful_beq_subsingleton _ _382 383/-- For a divisor `Dv` with the allowed tangent pattern `P`, the children of `(s, P)` can be384matched bijectively with the support points of `Dv`, respecting degrees and child states. -/385theorem cell_assignment_exists (k : Type) [Field k] [Finite k] (s : State) (hs : s.Valid)386    (P : TangentPattern s.degree) (hP : Allowed s P) (Dv : ExceptionalDivisor k)387    (hDv : HasPattern k s Dv P) :388    Nonempty (CellAssignment k s P Dv) := by389  classical390  let g' : ClosedDirection k → ℕ × State :=391    fun Q ↦ (directionDegree k Q, pointChildState k s P.d.val Dv Q)392  let g : {Q // 0 < Dv Q} → ℕ × State := fun Q ↦ g' Q.1393  have : Finite {Q // 0 < Dv Q} :=394    (Dv.support.finite_toSet.subset fun Q hQ ↦395      Finsupp.mem_support_iff.2 (Nat.pos_iff_ne_zero.1 hQ)).to_subtype396  have hlist (b : Prop) [Decidable b] (x c : ℕ × State) :397      (if b then [] else [x]).count c = if (¬ b ∧ x = c) then 1 else 0 := by398    by_cases hb : b <;> by_cases hx : x = c <;> simp [hb, hx]399  have hnz : zeroDirection k ≠ infinityDirection k := by simp [zeroDirection, infinityDirection]400  have key : ∀ c, (children s P).count c = (Dv.support.filter (fun Q ↦ g' Q = c)).card := by401    intro c402    rw [← Finset.card_filter_add_card_filter_not (s := Dv.support.filter (fun Q ↦ g' Q = c))403      (fun Q ↦ Q ∈ boundaryDirections k s), Finset.filter_filter, Finset.filter_filter]404    have hB := otherChildren_count_eq_card k s P Dv hDv s.weight ?_ c405    rotate_left406    · intro Q hQ407      cases s <;> simp_all [pointChildState, boundaryDirections, State.weight]408    rw [← hB]409    have hA : ∀ (T : Finset (ClosedDirection k)), (∀ Q, Q ∈ boundaryDirections k s ↔ Q ∈ T) →410        (Dv.support.filter (fun Q ↦ g' Q = c ∧ Q ∈ boundaryDirections k s)).card =411          ∑ Q ∈ T, if (0 < Dv Q ∧ g' Q = c) then 1 else 0 := by412      intro T hT413      rw [← Finset.card_filter]414      congr 1415      ext Q416      simp only [Finset.mem_filter, Finsupp.mem_support_iff, hT, Nat.pos_iff_ne_zero]417      tauto418    obtain ⟨hdeg, hrt, hrx, -⟩ := hDv419    cases s with420    | single a c0 =>421      rw [hA {infinityDirection k} (by intro Q; simp [boundaryDirections])]422      simp only [children, List.count_append, hlist, Finset.sum_singleton]423      congr 1424      simp only [g', pointChildState, ite_true, hrt]425      simp only [infinityDirection, directionDegree] at hrt ⊢426      simp only [Nat.pos_iff_ne_zero]427    | crossing a b c0 h0 =>428      rw [hA {infinityDirection k, zeroDirection k} (by intro Q; simp [boundaryDirections]),429        Finset.sum_pair hnz.symm]430      simp only [children, List.count_append, hlist]431      simp only at hrx432      congr 1433      have hzi : zeroDirection k = infinityDirection k ↔ False := ⟨hnz, False.elim⟩434      simp only [g', pointChildState, ite_true, hzi, ite_false, hrt, hrx]435      simp only [infinityDirection, directionDegree, zeroDirection, Polynomial.natDegree_X,436        Nat.pos_iff_ne_zero]437  obtain ⟨e, he⟩ := equiv_of_fiber_card_eq (Fin (children s P).length) {Q // 0 < Dv Q} (ℕ × State)438    (children s P).get g (fun c ↦ by439      rw [list_get_fiber_card_count]440      refine Eq.trans (by rw [beq_inst_eq]) ((key c).trans ?_)441      rw [Nat.card_congr442          (Equiv.subtypeSubtypeEquivSubtypeInter (fun Q ↦ 0 < Dv Q) (fun Q ↦ g' Q = c)),443        natCard_subtype_eq_filter_card Dv.support _444          (fun Q hQ ↦ Finsupp.mem_support_iff.mpr (by omega))]445      congr 1446      ext Q447      simp only [Finset.mem_filter, Finsupp.mem_support_iff, Nat.pos_iff_ne_zero]448      tauto)449  exact ⟨{ pt := fun j ↦ (e j).1450           inj := fun i j hij ↦ e.injective (Subtype.ext hij)451           supp := fun Q ↦ ⟨fun hQ ↦ ⟨e.symm ⟨Q, hQ⟩, by simp⟩, by rintro ⟨j, rfl⟩; exact (e j).2⟩452           deg := fun j ↦ congrArg Prod.fst (he j)453           state := fun j ↦ (congrArg Prod.snd (he j)).symm }⟩454 455/-- Over a finite field there are only finitely many exceptional divisors with a given tangent456pattern. -/457private theorem pattern_divisors_finite (k : Type) [Field k] [Finite k] (s : State)458    (P : TangentPattern s.degree) :459    Finite (patternDivisors k s P) := by460  set n := P.d.val with hn461  have hpos := directionDegree_pos k462  have key : ∀ D : patternDivisors k s P, ∀ Q, directionDegree k Q * D.1 Q ≤ n :=463    fun D Q ↦ (directionDegree_mul_le k D.1 Q).trans_eq D.2.1464  have hTfin : Finite {Q : ClosedDirection k // directionDegree k Q ≤ n} := by465    let f : {Q : ClosedDirection k // directionDegree k Q ≤ n} → Option (Fin (n+1) → k) :=466      fun Q ↦ Option.map (fun φ : AffineDirection k ↦ fun i : Fin (n+1) ↦ φ.val.coeff i) Q.1467    refine Finite.of_injective f ?_468    rintro ⟨_ | φ, hQ⟩ ⟨_ | ψ, hQ'⟩ h469    · rfl470    all_goals simp only [f, Option.map_some, Option.map_none, reduceCtorEq,471      Option.some.injEq] at h472    refine Subtype.ext (congrArg some (Subtype.ext (Polynomial.ext fun i ↦ ?_)))473    by_cases hi : i < n + 1474    · exact congrFun h ⟨i, hi⟩475    · simp only [directionDegree] at hQ hQ'476      rw [Polynomial.coeff_eq_zero_of_natDegree_lt (by omega),477        Polynomial.coeff_eq_zero_of_natDegree_lt (by omega)]478  have := hTfin479  refine Finite.of_injective480    (fun (D : patternDivisors k s P) (Q : {Q : ClosedDirection k // directionDegree k Q ≤ n}) ↦481      (⟨min (D.1 Q.1) n, by omega⟩ : Fin (n+1))) ?_482  intro D D' h483  apply Subtype.ext484  apply Finsupp.ext485  intro Q486  have hb : ∀ E : patternDivisors k s P, E.1 Q ≤ n := by487    intro E488    have := key E Q489    have := hpos Q490    nlinarith491  by_cases hQ : directionDegree k Q ≤ n492  · have := congrFun h ⟨Q, hQ⟩493    simp only [Fin.mk.injEq] at this494    have := hb D; have := hb D'495    omega496  · have z : ∀ E : patternDivisors k s P, E.1 Q = 0 := by497      intro E498      by_contra hne499      have := key E Q500      have : 1 ≤ E.1 Q := Nat.pos_of_ne_zero hne501      nlinarith502    rw [z D, z D']503 504/-- For a concrete member the pattern-divisor sets are finite, and for nonterminal states the505number of divisors with an allowed pattern `P` is `tangentCount s P` evaluated at `q`. -/506theorem concrete_member_divisor_count (m : ConcreteMember) :507    (∀ P : TangentPattern m.s.degree,508        Finite (patternDivisors (IsLocalRing.ResidueField m.R) m.s P)) ∧509    (m.s.terminal = false → ∀ P : TangentPattern m.s.degree, Allowed m.s P →510        ((Nat.card (patternDivisors (IsLocalRing.ResidueField m.R) m.s P) : ℕ) : ℚ) =511        (tangentCount m.s P).eval (m.toMeasured.q : ℚ)) := by512  have hfin : Finite (IsLocalRing.ResidueField m.R) :=513    Finite.of_equiv _ m.S.residueEquiv.toEquiv514  refine ⟨fun P ↦ pattern_divisors_finite _ m.s P, fun _ P hP ↦ ?_⟩515  rw [(pattern_divisor_count _ m.s P hP).2]516  congr 2517  exact Nat.card_congr m.S.residueEquiv.toEquiv.symm518 519/-! ### Auxiliary algebra and measurability -/520 521/-- Every quotient of a finite product of fields `∏ᵢ Lᵢ` is the product of the factors over some522subset `S`, compatibly with the coordinate projections. -/523theorem pi_field_quotient_equiv (K : Type) [Field K] (ι : Type) [Finite ι] (L : ι → Type)524    [∀ i, Field (L i)] [∀ i, Algebra K (L i)] (I : Ideal (∀ i, L i)) :525    ∃ (S : Finset ι) (e : ((∀ i, L i) ⧸ I) ≃ₐ[K] (∀ i : S, L i.1)), ∀ (x : ∀ i, L i) (i : S),526    e (Ideal.Quotient.mk I x) i = x i.1 := by527  have := Fintype.ofFinite ι528  classical529  let S : Finset ι := Finset.univ.filter (fun i ↦ (Pi.single i (1 : L i) : ∀ j, L j) ∉ I)530  let π : (∀ i, L i) →ₐ[K] (∀ i : S, L i.1) :=531    AlgHom.pi (fun i : S ↦ Pi.evalAlgHom K L i.1)532  have hπ : ∀ x i, π x i = x i.1 := fun x i ↦ rfl533  have hsurj : Function.Surjective π := by534    intro y535    refine ⟨fun i ↦ if h : i ∈ S then y ⟨i, h⟩ else 0, ?_⟩536    funext i537    rw [hπ]538    simp [i.2]539  have hker : I = RingHom.ker π := by540    ext x541    rw [RingHom.mem_ker]542    constructor543    · intro hx544      funext i545      rw [hπ]546      by_contra hne547      have hi := i.2548      simp only [S, Finset.mem_filter, Finset.mem_univ, true_and] at hi549      apply hi550      have : (Pi.single i.1 (1 : L i.1) : ∀ j, L j) = Pi.single i.1 ((x i.1)⁻¹) * x := by551        funext j552        by_cases hj : j = i.1553        · subst hj; simp [inv_mul_cancel₀ hne]554        · simp [hj]555      rw [this]556      exact I.mul_mem_left _ hx557    · intro hx558      rw [← Finset.univ_sum_single x]559      refine I.sum_mem fun i _ ↦ ?_560      by_cases hi : i ∈ S561      · rw [show x i = 0 from congrFun hx ⟨i, hi⟩, Pi.single_zero]562        exact I.zero_mem563      simp only [S, Finset.mem_filter, Finset.mem_univ, true_and, not_not] at hi564      rw [← mul_one (x i), Pi.single_mul]565      exact I.mul_mem_left _ hi566  refine ⟨S, (Ideal.quotientEquivAlgOfEq K hker).trans567    (Ideal.quotientKerAlgEquivOfSurjective hsurj), fun x i ↦ ?_⟩568  simp [Ideal.quotientEquivAlgOfEq_mk, hπ]569 570/-- The measurability and mass clauses for the set of `z` with `HasPolynomialTypeF` of the monic571polynomial of `π • z` transport along an equality of dimensions `n = r`. -/572theorem root_cell_clauses_reindex (O : Type) [CommRing O] [IsDomain O] [TopologicalSpace O]573    [IsTopologicalRing O] [CompactSpace O] [T2Space O] [SecondCountableTopology O]574    [MeasurableSpace O] [BorelSpace O] (pi : O) (σ : FactorType) (v : ℝ≥0∞) (n r : ℕ) (h : n = r)575    (hn : MeasurableSet {z : Fin n → O | HasPolynomialTypeF O (monicPolynomial O (pi • z)) σ} ∧576        coefficientMeasure O n577          {z : Fin n → O | HasPolynomialTypeF O (monicPolynomial O (pi • z)) σ} = v) :578    MeasurableSet {z : Fin r → O | HasPolynomialTypeF O (monicPolynomial O (pi • z)) σ} ∧579    coefficientMeasure O r {z : Fin r → O | HasPolynomialTypeF O (monicPolynomial O (pi • z)) σ} =580        v := by581  subst h; exact hn582 583/-- The scaled strict normalizer map is measurable for the adic cylinder σ-algebra: it factors as584a continuous linear part after a measurable adic perturbation. -/585theorem scaled_strict_map_measurable (O R : Type) [CommRing O] [CommRing R] [Algebra O R] (n : ℕ)586    (pi : O) (a : ℕ) (b : Fin n → R) (E : R ≃ₗ[O] ((Fin n → O) × R))587    [IsAdicComplete (Ideal.span {pi}) ((Fin n → O) × R)] (H : (Fin n → O) →ₗ[O] R) (k : ℕ)588    (ha : k < a) (Q : (Fin n → O) →ₗ[O] (Fin n → O))589    (hQ : ∀ w, normalizationLinearPart E H (Q w) = (pi ^ k) • w)590    [IsAdicComplete (Ideal.span {pi}) (Fin n → O)] [TopologicalSpace (Fin n → O)]591    [MeasurableSpace (Fin n → O)] [BorelSpace (Fin n → O)]592    (hgen : ‹MeasurableSpace (Fin n → O)› = adicCylinderSpace (Ideal.span {pi}) (Fin n → O))593    (hcont : Continuous (fun z : Fin n → O ↦ (pi^a) • normalizationLinearPart E H z)) :594    Measurable (scaledStrictMap pi a b E H) := by595  have h1 : scaledStrictMap pi a b E H =596    (fun z : Fin n → O ↦ (pi^a) • normalizationLinearPart E H z) ∘597    adicPerturb (normalizationCorrection pi a k b E H Q) := by598    funext z599    exact strict_normalizer_factors_through_linear O R n pi a b E H k ha Q hQ z600  rw [h1]601  exact hcont.measurable.comp602    (adic_perturb_measurable O (Fin n → O) (Ideal.span {pi}) _603      (strict_correction_raises_order O R n pi a b E H k ha Q) hgen)604 605/-! ### The repeated-root chart -/606 607/-- The powers `1, x, …, x^(r-1)` form a residue basis of `R/(f)` as soon as some reduction608map `φ : R → k⟦X⟧` is surjective, sends `x` to `X`, `f` to `X^r`, scalars to their residues,609and has kernel `π R`. -/610private theorem residue_basis_of_reduction {O R : Type} [CommRing O] [IsDomain O]611    [IsDiscreteValuationRing O]612    [CommRing R] [Algebra O R] (pi : O) (hpi : Irreducible pi) (x f : R) (r : ℕ)613    (φ : R →+* PowerSeries (IsLocalRing.ResidueField O)) (hφs : Function.Surjective φ)614    (hφx : φ x = PowerSeries.X)615    (hφc : ∀ c : O, φ (algebraMap O R c) = PowerSeries.C (IsLocalRing.residue O c))616    (hφker : ∀ w : R, φ w = 0 → ∃ m' : R, w = pi • m') (hφf : φ f = PowerSeries.X ^ r) :617    ResidueBasisFamily pi (fun i : Fin r ↦ Ideal.Quotient.mk (Ideal.span {f}) (x ^ (i : ℕ))) := by618  have hφsmul (c : O) (y : R) : φ (c • y) = PowerSeries.C (IsLocalRing.residue O c) * φ y := by619    rw [show c • y = algebraMap O R c * y from Algebra.smul_def c y, map_mul, hφc]620  have hres0 (c : O) : IsLocalRing.residue O c = 0 ↔ pi ∣ c := by621    rw [IsLocalRing.residue_eq_zero_iff, hpi.maximalIdeal_eq, Ideal.mem_span_singleton]622  have hlin (c : O) (y : R) : c • Ideal.Quotient.mk (Ideal.span {f}) y =623      Ideal.Quotient.mk (Ideal.span {f}) (c • y) :=624    (map_smul (Ideal.Quotient.mkₐ O (Ideal.span {f})) c y).symm625  refine ⟨fun m ↦ ?_, fun z ⟨m', hm'⟩ i ↦ ?_⟩626  · obtain ⟨w, rfl⟩ := Ideal.Quotient.mk_surjective m627    set g := φ w with hgdef628    choose z' hz' using fun n ↦ IsLocalRing.residue_surjective (PowerSeries.coeff n g)629    obtain ⟨h', hh'⟩ : ∃ h', φ h' = PowerSeries.mk fun i ↦ PowerSeries.coeff (i + r) g :=630      hφs _631    have htr : ((PowerSeries.trunc r g : Polynomial _) : PowerSeries _) =632        ∑ i : Fin r, PowerSeries.C (PowerSeries.coeff (i : ℕ) g) * PowerSeries.X ^ (i : ℕ) := by633      rw [PowerSeries.trunc_apply, ← Finset.range_eq_Ico, Fin.sum_univ_eq_sum_range634        (fun n ↦ PowerSeries.C (PowerSeries.coeff n g) * PowerSeries.X ^ n),635        ← Polynomial.coeToPowerSeries.ringHom_apply, map_sum]636      refine Finset.sum_congr rfl fun n _ ↦ ?_637      rw [Polynomial.coeToPowerSeries.ringHom_apply, Polynomial.coe_monomial,638        PowerSeries.monomial_eq_C_mul_X_pow]639    have key : φ (w - ∑ i : Fin r, z' i • x ^ (i : ℕ) - f * h') = 0 := by640      rw [map_sub, map_sub, map_mul, hφf, hh', map_sum]641      simp_rw [hφsmul, hz', map_pow, hφx]642      rw [← hgdef]643      linear_combination PowerSeries.eq_X_pow_mul_shift_add_trunc r g + htr644    obtain ⟨m', hm'⟩ := hφker _ key645    refine ⟨fun i ↦ z' i, Ideal.Quotient.mk _ m', ?_⟩646    simp_rw [hlin, ← map_sum, ← map_add]647    rw [Ideal.Quotient.eq, Ideal.mem_span_singleton']648    exact ⟨h', by linear_combination -hm'⟩649  · obtain ⟨w', rfl⟩ := Ideal.Quotient.mk_surjective m'650    simp_rw [hlin, ← map_sum] at hm'651    obtain ⟨c, hc⟩ := Ideal.mem_span_singleton'.1 (Ideal.Quotient.eq.1 hm')652    have h2 := congrArg φ hc653    rw [map_mul, map_sub, hφsmul, map_sum, hφf, (hres0 pi).2 dvd_rfl, map_zero, zero_mul,654      sub_zero] at h2655    have h3 := congrArg (PowerSeries.coeff (i : ℕ)) h2656    rw [PowerSeries.coeff_mul_X_pow', ite_eq_right (by omega), map_sum] at h3657    simp_rw [hφsmul, map_pow, hφx, PowerSeries.coeff_C_mul_X_pow] at h3658    rw [Finset.sum_eq_single i (fun j _ hj ↦ ite_eq_right (fun h ↦ hj (Fin.ext h).symm))659      (by simp), ite_eq_left rfl] at h3660    exact (hres0 _).1 h3.symm661 662/-- For monic `F` of degree `r > 0` whose lower coefficients lie in the maximal ideal, the663quotient of the concrete surface `(1, 1, 0)` by `F(x)` is `O`-isomorphic to `AdjoinRoot F`,664compatibly with evaluation of polynomials at `x`. -/665theorem series_quotient_equiv_adjoinRoot (O : Type) [CommRing O] [IsDomain O](7.1)666    [IsDiscreteValuationRing O] [IsAdicComplete (IsLocalRing.maximalIdeal O) O] (pi : O)667    (hpi : Irreducible pi) (F : Polynomial O) (hF : F.Monic) (r : ℕ) (hr : 0 < r)668    (hdeg : F.natDegree = r) (hred : ∀ i : ℕ, i < r → F.coeff i ∈ IsLocalRing.maximalIdeal O) :669    ∃ e : (ConcreteSurface O pi 1 1 0 ⧸670        Ideal.span {Polynomial.aeval (surfaceX O pi 1 1 0) F}) ≃ₐ[O] AdjoinRoot F,671      ∀ P : Polynomial O, e (Ideal.Quotient.mk672        (Ideal.span {Polynomial.aeval (surfaceX O pi 1 1 0) F})673        (Polynomial.aeval (surfaceX O pi 1 1 0) P)) = AdjoinRoot.mk F P := by674  set R := ConcreteSurface O pi 1 1 0675  set x : R := surfaceX O pi 1 1 0676  set f : R := Polynomial.aeval x F with hfdef677  obtain ⟨hC, -, hX, -, -⟩ := residueKillT_apply_ker O pi hpi678  have hT : algebraMap O R pi = surfaceT O pi 1 1 0 := by679    rw [concrete_surface_vertical]; simp [surfaceUnit]680  -- `φ : R → k⟦X⟧` is reduction modulo `T = π`.681  obtain ⟨q, hq⟩ := concrete_surface_quotient_T_equiv O pi hpi 1 1 0 one_pos682  let φ : R →+* PowerSeries (IsLocalRing.ResidueField O) :=683    q.toRingHom.comp (Ideal.Quotient.mk (Ideal.span {surfaceT O pi 1 1 0}))684  have hφx : φ x = PowerSeries.X := (hq _).trans hX685  have hφc (c : O) : φ (algebraMap O R c) = PowerSeries.C (IsLocalRing.residue O c) :=686    (hq (MvPowerSeries.C c)).trans (hC c)687  have hφker (w : R) (hw : φ w = 0) : ∃ m' : R, w = pi • m' := by688    obtain ⟨m', hm'⟩ := Ideal.mem_span_singleton'.1689      (Ideal.Quotient.eq_zero_iff_mem.1 (q.injective (hw.trans (map_zero q).symm)))690    exact ⟨m', by rw [← hm', ← hT, mul_comm]; exact (Algebra.smul_def _ _).symm⟩691  have hφf : φ f = PowerSeries.X ^ r := by692    have hFbar : F.map (IsLocalRing.residue O) = Polynomial.X ^ r := by693      ext i694      rw [Polynomial.coeff_map, Polynomial.coeff_X_pow]695      rcases lt_trichotomy i r with h | rfl | h696      · rw [ite_eq_right h.ne, (IsLocalRing.residue_eq_zero_iff _).2 (hred i h)]697      · rw [ite_eq_left rfl, ← hdeg, hF.coeff_natDegree, map_one]698      · rw [ite_eq_right h.ne', Polynomial.coeff_eq_zero_of_natDegree_lt (hdeg ▸ h), map_zero]699    rw [hfdef, Polynomial.aeval_def, Polynomial.hom_eval₂, hφx,700      show φ.comp (algebraMap O R) = PowerSeries.C.comp (IsLocalRing.residue O) from701        RingHom.ext hφc, ← Polynomial.eval₂_map, hFbar]702    simp703  have hf : Function.Injective fun w : R ⧸ Ideal.span {algebraMap O R pi} ↦704      Ideal.Quotient.mk (Ideal.span {algebraMap O R pi}) f * w := by705    rw [hT]706    refine fun w w' h ↦ q.injective (mul_left_cancel₀ (a := q (Ideal.Quotient.mk _ f)) ?_707      (by simpa only [map_mul] using congrArg q h))708    change φ f ≠ 0709    rw [hφf]; exact pow_ne_zero _ PowerSeries.X_ne_zero710  have hβ := residue_basis_of_reduction pi hpi x f r φ711    (q.surjective.comp Ideal.Quotient.mk_surjective) hφx hφc hφker hφf712  obtain ⟨B, hB⟩ := concrete_surface_curve_basis O pi hpi 1 1 0 one_pos f hf _ hβ713  subst hdeg714  let ψ : AdjoinRoot F →ₐ[O] R ⧸ Ideal.span {f} :=715    AdjoinRoot.liftAlgHom F (Algebra.ofId O _) (Ideal.Quotient.mk _ x)716      ((Polynomial.aeval_algHom_apply (Ideal.Quotient.mkₐ O _) x F).trans717        (Ideal.Quotient.eq_zero_iff_mem.2 (Ideal.subset_span rfl)))718  have hψ (P : Polynomial O) :719      ψ (AdjoinRoot.mk F P) = Ideal.Quotient.mk (Ideal.span {f}) (Polynomial.aeval x P) :=720    (AdjoinRoot.liftAlgHom_mk ..).trans (Polynomial.aeval_algHom_apply (Ideal.Quotient.mkₐ O _) x P)721  let pb := AdjoinRoot.powerBasis' hF722  let L : AdjoinRoot F ≃ₗ[O] R ⧸ Ideal.span {f} := pb.basis.equiv B (Equiv.refl _)723  have hψL : ψ.toLinearMap = L.toLinearMap := pb.basis.ext fun i ↦ by724    rw [AlgHom.toLinearMap_apply, LinearEquiv.coe_coe,725      show L (pb.basis i) = B i from Module.Basis.equiv_apply _ _ _ _]726    refine Eq.trans ?_ (hB i).symm727    rw [pb.basis_eq_pow, AdjoinRoot.powerBasis'_gen, ← AdjoinRoot.mk_X, ← map_pow, hψ, map_pow,728      Polynomial.aeval_X]729  have hbij : Function.Bijective ψ := by730    rw [show ⇑ψ = ⇑L from congrArg DFunLike.coe hψL]; exact L.bijective731  refine ⟨(AlgEquiv.ofBijective ψ hbij).symm, fun P ↦ ?_⟩732  rw [AlgEquiv.symm_apply_eq, AlgEquiv.ofBijective_apply, hψ]733 734/-- In the repeated-root chart `x^r` with basis `(x^i)`, the coordinate ideal of `z` has algebra735type `σ` iff the monic polynomial with lower coefficients `π • z` has polynomial type `σ`. -/736theorem repeated_root_chart_type (O : Type) [CommRing O] [IsDomain O] [IsDiscreteValuationRing O]737    [IsAdicComplete (IsLocalRing.maximalIdeal O) O] [Finite (IsLocalRing.ResidueField O)] (pi : O)738    (hpi : Irreducible pi) (r : ℕ) (hr : 0 < r) (z : Fin r → O) (σ : FactorType) :739    HasAlgebraType O (ConcreteSurface O pi 1 1 0 ⧸ coordinateIdeal pi (surfaceX O pi 1 1 0 ^ r)740        (fun i : Fin r ↦ surfaceX O pi 1 1 0 ^ i.val) z) σ ↔741    HasPolynomialTypeF O (monicPolynomial O (pi • z)) σ := by742  obtain ⟨hm, hd, hc, -⟩ := monic_poly_reconstruct O r (pi • z)743  have hI : coordinateIdeal pi (surfaceX O pi 1 1 0 ^ r)744      (fun i : Fin r ↦ surfaceX O pi 1 1 0 ^ i.val) z745      = Ideal.span {Polynomial.aeval (surfaceX O pi 1 1 0) (monicPolyO (pi • z))} := by746    unfold coordinateIdeal normalizedIdeal normalizedGenerator coordinateLift747    congr 2748    simp [monicPolyO, Polynomial.aeval_add, Algebra.smul_def, mul_assoc]749  have hred : ∀ i : ℕ, i < r → (monicPolyO (pi • z)).coeff i ∈ IsLocalRing.maximalIdeal O := by750    intro i hi751    have := hc ⟨i, hi⟩752    simp only at this753    rw [this, (IsDiscreteValuationRing.irreducible_iff_uniformizer pi).1 hpi]754    exact Ideal.mem_span_singleton.2 ⟨z ⟨i, hi⟩, by simp⟩755  obtain ⟨e, -⟩ := series_quotient_equiv_adjoinRoot O pi hpi _ hm r hr hd hred756  rw [hI, ← monicPolyO_map_fraction, polynomial_type_iff_algebra_type O _ hm]757  exact ⟨algebra_type_algEquiv O _ _ e σ, algebra_type_algEquiv O _ _ e.symm σ⟩758 759/-- The quotient of the concrete surface `(1, 1, 0)` by `x^n` (`n > 0`) has the `O`-basis760`1, x, …, x^(n-1)`. -/761private theorem surface_quotient_xpow_basis (O : Type) [CommRing O] [IsDomain O]762    [IsDiscreteValuationRing O] [IsAdicComplete (IsLocalRing.maximalIdeal O) O] (pi : O)763    (hpi : Irreducible pi) (n : ℕ) (hn : 0 < n) :764    ∃ B : Module.Basis (Fin n) O765        (ConcreteSurface O pi 1 1 0 ⧸ Ideal.span {surfaceX O pi 1 1 0 ^ n}),766      ∀ i, B i = Ideal.Quotient.mk (Ideal.span {surfaceX O pi 1 1 0 ^ n})767        (surfaceX O pi 1 1 0 ^ i.val) := by768  set x := surfaceX O pi 1 1 0769  obtain ⟨φ, hφ⟩ := series_quotient_equiv_adjoinRoot O pi hpi (Polynomial.X ^ n)770    (Polynomial.monic_X_pow n) n hn (Polynomial.natDegree_X_pow n)771    (fun i hi ↦ by simp [Polynomial.coeff_X_pow, hi.ne])772  generalize hg : Polynomial.aeval x (Polynomial.X ^ n : Polynomial O) = g at φ hφ773  simp only [map_pow, Polynomial.aeval_X] at hg774  subst hg775  let pb := AdjoinRoot.powerBasis' (Polynomial.monic_X_pow (R := O) n)776  refine ⟨(pb.basis.reindex (finCongr (Polynomial.natDegree_X_pow n))).map777    φ.symm.toLinearEquiv, fun i ↦ ?_⟩778  apply φ.injective779  have := hφ (Polynomial.X ^ i.val)780  simp only [Polynomial.aeval_X_pow] at this781  rw [this, Module.Basis.map_apply, Module.Basis.reindex_apply, pb.basis_eq_pow]782  simp [pb, map_pow, AdjoinRoot.mk_X]783  rfl784 785/-- The state `single 1 r` on the concrete surface `(1, 1, 0)` admits a one-chart ideal atlas,786with chart `x^r` and basis `(x^i)`, whose state measure is `q⁻ʳ` times the pushforward of the787coefficient measure under the coordinate ideal map. -/788theorem repeated_root_one_chart_atlas (O : Type) [CommRing O] [IsDomain O](7.1)789    [IsDiscreteValuationRing O] [IsAdicComplete (IsLocalRing.maximalIdeal O) O]790    [Finite (IsLocalRing.ResidueField O)] [TopologicalSpace O] [IsTopologicalRing O]791    [CompactSpace O] [T2Space O] [SecondCountableTopology O] [MeasurableSpace O] [BorelSpace O]792    (pi : O) (hpi : Irreducible pi)793    [IsDomain (ConcreteSurface O pi 1 1 0)] [IsRegularLocalRing (ConcreteSurface O pi 1 1 0)]794    (S : SurfaceData O (ConcreteSurface O pi 1 1 0)) (hSpi : S.pi = pi)795    (hSt : S.t = surfaceT O pi 1 1 0) (hSa : S.a = 1)796    (hSb : S.b = 0) (r : ℕ) (hr : 0 < r) :797    ∃ A : IdealAtlas O (ConcreteSurface O pi 1 1 0) S.pi (State.single 1 r).degree798      (surfaceStateSet O (ConcreteSurface O pi 1 1 0) S (State.single 1 r)),799    ∃ i₀ : A.ι, (∀ i, i = i₀) ∧800    (A.chart i₀).f = (surfaceX O pi 1 1 0) ^ (State.single 1 r).degree ∧801    (A.chart i₀).b = (fun i : Fin (State.single 1 r).degree ↦ (surfaceX O pi 1 1 0) ^ i.val) ∧802    (letI : MeasurableSpace (Ideal (ConcreteSurface O pi 1 1 0)) :=803      idealChartSigma O (ConcreteSurface O pi 1 1 0) S.pi804    stateMeasure O (ConcreteSurface O pi 1 1 0) S.pi (State.single 1 r).degree805      (Nat.card (IsLocalRing.ResidueField O)) A =806    ((Nat.card (IsLocalRing.ResidueField O) : ℝ≥0∞)⁻¹ ^ (State.single 1 r).degree) •807      (coefficientMeasure O (State.single 1 r).degree).map808        (coordinateIdeal S.pi ((surfaceX O pi 1 1 0) ^ (State.single 1 r).degree)809          (fun i : Fin (State.single 1 r).degree ↦ (surfaceX O pi 1 1 0) ^ i.val))) := by810  set n := (State.single 1 r).degree with hn_def811  have hn : n = r := by simp [n, State.degree]812  set R := ConcreteSurface O pi 1 1 0813  set k := IsLocalRing.ResidueField O814  set x : R := surfaceX O pi 1 1 0815  obtain ⟨e, he⟩ := concrete_surface_special_fiber_equiv O pi hpi 1 1 0816  have hpar := concrete_surface_special_fiber_equiv_parameters O pi 1 1 0 e he817  -- the image of `x^n` in the special fibre818  have hex : e (Ideal.Quotient.mk (Ideal.span {algebraMap O R pi}) (x ^ n)) =819      Ideal.Quotient.mk (monomialIdeal k 1 0) (axisX k ^ n) := by820    rw [map_pow, map_pow, hpar.2.1, fiberX, map_pow]821  have hcont : contact (Ideal.Quotient.mk (monomialIdeal k 1 0) (axisX k ^ n))822      (fiberT k 1 0) = r := by823    rw [contact_fiberT_eq_axisQuotientLength _ 1 0 one_pos,824      axisQuotientLength_eq _ (by decide : (0 : Fin 2) ≠ 1) _ n, hn]825    · intro j hj826      rw [axisX, MvPowerSeries.coeff_X_pow, ite_eq_right]827      intro h828      have := congrArg (fun m ↦ m 1) h829      simp at this; omega830    · rw [axisX, MvPowerSeries.coeff_X_pow, ite_eq_left rfl]; exact one_ne_zero831  have hxne : x ^ n ≠ 0 := by832    intro h833    rw [h, map_zero, map_zero, ← map_zero (Ideal.Quotient.mk (monomialIdeal k 1 0))] at hex834    rw [← hex, contact_fiberT_eq_axisQuotientLength _ 1 0 one_pos,835      axisQuotientLength_eq_top _ (by decide : (0 : Fin 2) ≠ 1) _ (fun j ↦ by simp)] at hcont836    exact ENat.top_ne_natCast r hcont837  have hreg : Function.Injective fun y : R ⧸ Ideal.span {algebraMap O R pi} ↦838      y * Ideal.Quotient.mk (Ideal.span {algebraMap O R pi}) (x ^ n) := by839    have h501 := concrete_surface_residue_regular_of_special_fiber O pi 1 1 0 _ e840      (special_fiber_single_contact_regular k 1 r one_pos _ (hex ▸ hcont))841    intro a b hab842    apply h501843    change _ * a = _ * b844    rw [mul_comm _ a, mul_comm _ b]; exact hab845  obtain ⟨B, hB⟩ := surface_quotient_xpow_basis O pi hpi n (hn ▸ hr)846  obtain ⟨E, hE⟩ := division_linear_equivalence O R n (x ^ n) B (fun i ↦ x ^ i.val)847    (fun i ↦ (hB i).symm) hxne848  let c₀ : IdealChart O R pi n := ⟨x ^ n, fun i ↦ x ^ i.val, E, hE, hreg⟩849  have hcover : surfaceStateSet O R S (State.single 1 r) =850      residueIdealCell (algebraMap O R pi) (x ^ n) := by851    have hcard := single_residue_ideal_count k 1 r one_pos852    rw [one_mul, Nat.sub_self, pow_zero, Nat.card_eq_one_iff_unique] at hcard853    obtain ⟨hsub, hne⟩ := hcard854    let I0 : singleResidueIdeals k 1 r :=855      ⟨Ideal.span {Ideal.Quotient.mk (monomialIdeal k 1 0) (axisX k ^ n)}, _, rfl, hcont⟩856    obtain ⟨h1, -⟩ := concrete_single_state_eq_union_cells O pi 1 1 one_pos S hSt hSa hSb e he r hr857      (fun _ ↦ x ^ n) (fun I ↦ by858        rw [hex]; exact congrArg Subtype.val (Subsingleton.elim I0 I))859    rw [h1]860    exact Set.iUnion_const _861  rw [hSpi]862  refine ⟨⟨Unit, fun _ ↦ c₀, ?_, ?_⟩, (), fun _ ↦ rfl, rfl, rfl, ?_⟩863  · rw [hcover]; exact (Set.iUnion_const _).symm864  · exact Subsingleton.pairwise865  · simp only [stateMeasure, Fintype.sum_unique]; rfl866 867/-! ### Child data at points of the exceptional line -/868 869/-- Transporting the strict transform at a point of a blowup chart along a ring isomorphism of870its completed local ring gives the strict transform ideal for the composite map. -/871private theorem strict_transform_map_along_point_equiv (O R : Type) [CommRing O] [CommRing R]872    [Algebra O R]873    (t x : R) (P : Ideal (BlowupChart R t x)) [P.IsPrime] (S' : Type) [CommRing S'] [Algebra O S']874    (Eq : CompletedLocalAt (BlowupChart R t x) P ≃+* S') (alpha : R →ₐ[O] S')875    (halpha : ∀ r : R, alpha r = Eq (completedPointMap (BlowupChart R t x) P (chartBase R t x r)))876    (d : ℕ) (J : Ideal R) :877    Ideal.map (Eq : CompletedLocalAt (BlowupChart R t x) P →+* S') (strictTransformAt R t x P d J) =878        strictTransformIdeal alpha879        (Eq (completedPointMap (BlowupChart R t x) P (chartBase R t x t))) d J := by880  unfold strictTransformAt strictTransformIdeal881  have h1 : J.map alpha.toRingHom =882    (J.map ((completedPointMap (BlowupChart R t x) P).comp883    (chartBase R t x))).map (Eq : CompletedLocalAt (BlowupChart R t x) P →+* S') := by884    rw [Ideal.map_map]885    congr 1886    ext r887    exact halpha r888  rw [h1, ← map_pow]889  generalize J.map ((completedPointMap (BlowupChart R t x) P).comp (chartBase R t x)) = I890  generalize (completedPointMap (BlowupChart R t x) P (chartBase R t x t)) ^ d = z891  ext y892  have key : ∀ (K : Ideal (CompletedLocalAt (BlowupChart R t x) P)) w, w ∈893    K.map (Eq : CompletedLocalAt (BlowupChart R t x) P →+* S') ↔ Eq.symm w ∈ K := by894    intro K w895    have := Ideal.comap_symm (I := K) Eq896    exact (Iff.of_eq (congrArg (w ∈ ·) this.symm))897  rw [key, Submodule.mem_colon_singleton, Submodule.mem_colon_singleton, key, smul_eq_mul,898    smul_eq_mul]899  simp900 901/-- The divisor strict transform at a support point, transported along a ring isomorphism of its902local ring, is the strict transform ideal for the composite map. -/903private theorem divisor_strict_transform_map_along_equiv (R : Type) [CommRing R] (t x : R)904    [IsLocalRing R]905    (e : (BlowupChart R t x ⧸ chartExceptional R t x) ≃+* Polynomial (IsLocalRing.ResidueField R))906    (Dv : ExceptionalDivisor (IsLocalRing.ResidueField R)) (hinf : (infinityPoint R t x).IsPrime)907    (Q : divisorSupport Dv) (O S' : Type) [CommRing O] [Algebra O R] [CommRing S'] [Algebra O S']908    (E : divisorLocalRing R t x e Dv hinf Q ≃+* S') (alpha : R →ₐ[O] S')909    (halpha : ∀ r : R, alpha r = E (divisorFromSurface R t x e Dv hinf Q r)) (d : ℕ) (J : Ideal R) :910    Ideal.map (E : divisorLocalRing R t x e Dv hinf Q →+* S')911        (divisorStrictTransform R t x e Dv hinf d J Q) =912        strictTransformIdeal alpha (E (divisorException R t x e Dv hinf Q)) d J := by913  rcases Q with ⟨_ | φ, h⟩914  · exact @strict_transform_map_along_point_equiv O R _ _ _ x t (infinityPoint R t x) hinf S' _ _915      E alpha halpha d J916  · exact @strict_transform_map_along_point_equiv O R _ _ _ t x (directionPoint R t x e φ)917      (directionPoint_isPrime R t x e φ) S' _ _ E alpha halpha d J918 919/-- The child map `D.Φ` of cell child data is the image of the divisor strict transform under920the identification `D.Eq j` of local rings. -/921theorem cell_child_Phi_eq_map (m : ConcreteMember) (c : m.cellIndex) (D : CellChildData m c)922    (J : Ideal m.R) (j : m.toMeasured.childIdx c) :923    D.Φ J j = Ideal.map (D.Eq j : divisorLocalRing m.R m.S.t m.S.x D.e c.2.1 D.hinf (D.point j) →+*924        (D.mc j).R) (divisorStrictTransform m.R m.S.t m.S.x D.e c.2.1 D.hinf925        (m.toMeasured.cellDegree c) J (D.point j)) := by926  rw [divisor_strict_transform_map_along_equiv m.R m.S.t m.S.x D.e c.2.1 D.hinf (D.point j) m.O927    (D.mc j).R (D.Eq j) (D.alpha j) (fun r ↦ rfl), D.hEq_e j]928  rfl929 930private theorem natDegree_eq_of_span_eq (R : Type) [CommRing R] (t x : R)931    [(Ideal.span ({t,x} : Set R)).IsMaximal]932    (O : Type) [CommRing O] (f : O →+* R)933    (P : Ideal (BlowupChart R t x)) [P.IsMaximal] (hP : chartBase R t x t ∈ P)934    (Φ : Polynomial O) (hΦ : Φ.Monic)935    (hspan : P = Ideal.span {chartBase R t x t,936      Polynomial.eval₂ ((chartBase R t x).comp f) (chartSlope R t x) Φ}) (δ : ℕ)937    (hdeg : Module.length R (BlowupChart R t x ⧸ P) = (δ : ℕ∞)) : Φ.natDegree = δ := by938  obtain ⟨e, he, heZ⟩ := exceptional_line_equiv_chart_exceptional R t x939  obtain ⟨φ, hmon, hirr, himg, -, hlen⟩ :=940    blowup_chart_exceptional_point_polynomial R t x e he heZ P hP941  rw [hdeg] at hlen942  have hδ : φ.natDegree = δ := by exact_mod_cast hlen.symm943  set g : O →+* (R ⧸ Ideal.span ({t,x} : Set R)) :=944    (Ideal.Quotient.mk _).comp f with hg945  have key : (P.map (Ideal.Quotient.mk (chartExceptional R t x))).map e = Ideal.span {Φ.map g} := by946    rw [hspan, Ideal.map_span, Ideal.map_span]947    have h0 : e (Ideal.Quotient.mk (chartExceptional R t x) (chartBase R t x t)) = 0 := by948      have : Ideal.Quotient.mk (chartExceptional R t x) (chartBase R t x t) = 0 :=949        Ideal.Quotient.eq_zero_iff_mem.2 (Ideal.subset_span rfl)950      rw [this, map_zero]951    have h1 : e (Ideal.Quotient.mk (chartExceptional R t x)952        (Polynomial.eval₂ ((chartBase R t x).comp f) (chartSlope R t x) Φ)) = Φ.map g := by953      have := Polynomial.hom_eval₂ Φ ((chartBase R t x).comp f)954        (e.toRingHom.comp (Ideal.Quotient.mk (chartExceptional R t x))) (chartSlope R t x)955      change (e.toRingHom.comp (Ideal.Quotient.mk (chartExceptional R t x))) _ = _956      rw [this]957      change Polynomial.eval₂ _958        (e (Ideal.Quotient.mk (chartExceptional R t x) (chartSlope R t x))) Φ =959        Polynomial.eval₂ (Polynomial.C.comp g) Polynomial.X Φ960      rw [heZ]961      congr 1962      ext r963      simp [he, hg]964    rw [Set.image_pair, Set.image_pair, h0, h1]965    simp966  rw [himg] at key967  have hassoc : Associated φ (Φ.map g) := by968    rwa [Ideal.span_singleton_eq_span_singleton] at key969  have := Polynomial.eq_of_monic_of_associated hmon (hΦ.map g) hassoc970  rw [← hδ, this, hΦ.natDegree_map]971 972/-- A closed point of degree `δ ≥ 2` on the exceptional line of the `t`-chart is cut out by an973unramified lift `Φ` of degree `δ`, and its completed local ring is a concrete surface over974`AdjoinRoot Φ` with explicit `t`-parameter and `O`-structure. -/975theorem t_chart_nonrational_point_child_data (O : Type) [CommRing O] [IsDomain O]976    [IsDiscreteValuationRing O] [IsAdicComplete (IsLocalRing.maximalIdeal O) O]977    [Finite (IsLocalRing.ResidueField O)] (pi : O) (hpi : Irreducible pi) (u : (TwoSeries O)ˣ)978    (a b : ℕ) (ha : 0 < a)979    (P : Ideal (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)980        (surfaceX O pi u a b)))981    [P.IsMaximal] [P.IsPrime]982    (hP : (chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b))983        (surfaceT O pi u a b) ∈ P)984    (δ : ℕ)985    (hdeg : Module.length (ConcreteSurface O pi u a b)986        ((BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b)) ⧸987          P) = (δ : ℕ∞))988    (h2 : 2 ≤ δ) :989    ∃ Φ : Polynomial O, IsUnramifiedLift O Φ ∧ Φ.natDegree = δ ∧990    P = Ideal.span {(chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b)991        (surfaceX O pi u a b)) (surfaceT O pi u a b),992        Polynomial.eval₂ ((chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b)993          (surfaceX O pi u a b)).comp (algebraMap O (ConcreteSurface O pi u a b)))994          (chartSlope (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b)) Φ} ∧995    ∃ (hθ : IsUnit (AdjoinRoot.root Φ))996        (Eq : CompletedLocalAt (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)997        (surfaceX O pi u a b)) P ≃+*998        ConcreteSurface (AdjoinRoot Φ) (algebraMap O (AdjoinRoot Φ) pi)999        (substUnit (AdjoinRoot Φ) (AdjoinRoot.root Φ)1000        (baseChangeUnit O (algebraMap O (AdjoinRoot Φ)) u) *1001        shiftUnit (AdjoinRoot Φ) (AdjoinRoot.root Φ) hθ ^ b) (a + b) 0),1002    Eq ((completedPointMap (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1003        (surfaceX O pi u a b)) P) ((chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1004        (surfaceX O pi u a b)) (surfaceT O pi u a b))) =1005        surfaceT (AdjoinRoot Φ) (algebraMap O (AdjoinRoot Φ) pi)1006        (substUnit (AdjoinRoot Φ) (AdjoinRoot.root Φ)1007        (baseChangeUnit O (algebraMap O (AdjoinRoot Φ)) u) *1008        shiftUnit (AdjoinRoot Φ) (AdjoinRoot.root Φ) hθ ^ b) (a + b) 0 ∧1009    ∀ c : O,1010    Eq ((completedPointMap (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1011        (surfaceX O pi u a b)) P) ((chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1012        (surfaceX O pi u a b)) (algebraMap O (ConcreteSurface O pi u a b) c))) =1013        algebraMap (AdjoinRoot Φ) (ConcreteSurface (AdjoinRoot Φ) (algebraMap O (AdjoinRoot Φ) pi)1014        (substUnit (AdjoinRoot Φ) (AdjoinRoot.root Φ)1015        (baseChangeUnit O (algebraMap O (AdjoinRoot Φ)) u) *1016        shiftUnit (AdjoinRoot Φ) (AdjoinRoot.root Φ) hθ ^ b) (a + b) 0)1017        (algebraMap O (AdjoinRoot Φ) c) := by1018  obtain ⟨e459, -⟩ := concrete_surface_quotient_parameters_equiv O pi hpi u a b ha1019  have hmax : (Ideal.span ({surfaceT O pi u a b, surfaceX O pi u a b} :1020      Set (ConcreteSurface O pi u a b))).IsMaximal :=1021    Ideal.Quotient.maximal_of_isField _ (e459.toMulEquiv.isField (Field.toIsField _))1022  have hspanform := concrete_chart_point_span_form O pi hpi u a b ha P hP1023  have hdeg' := natDegree_eq_of_span_eq (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1024    (surfaceX O pi u a b)1025    O (algebraMap O (ConcreteSurface O pi u a b)) P hP1026  rcases hspanform with h | ⟨α, -, h⟩ | ⟨Φ, hΦ, h2Φ, hPΦ⟩1027  · exfalso1028    have := hdeg' Polynomial.X (Polynomial.monic_X) (by simpa using h) δ hdeg1029    simp at this; omega1030  · exfalso1031    have := hdeg' (Polynomial.X - Polynomial.C α) (Polynomial.monic_X_sub_C α)1032      (by simpa [sub_eq_add_neg] using h) δ hdeg1033    rw [Polynomial.natDegree_X_sub_C] at this; omega1034  · have hnd : Φ.natDegree = δ := hdeg' Φ hΦ.1 hPΦ δ hdeg1035    have hθ := unramified_root_isUnit_of_two_le_natDegree O Φ hΦ h2Φ1036    obtain ⟨Eq, hs, -, hc, -⟩ :=1037      t_chart_nonrational_point_completion_equiv O pi hpi u a b ha Φ hΦ hθ P hPΦ1038    refine ⟨Φ, hΦ, hnd, hPΦ, hθ, Eq, ?_, hc⟩1039    have := hs (axisT O)1040    obtain ⟨-, h2, -⟩ := chartSubst_apply_generators (AdjoinRoot Φ) (AdjoinRoot.root Φ)1041    have hm : MvPowerSeries.map (algebraMap O (AdjoinRoot Φ)) (axisT O) = axisT (AdjoinRoot Φ) := by1042      simp [axisT, MvPowerSeries.map_X]1043    rwa [hm, h2] at this1044 1045private theorem not_two_le_natDegree_of_length_one (O R : Type) [CommRing O] [CommRing R]1046    (f : O →+* R) (t x : R)1047    [(Ideal.span ({t, x} : Set R)).IsMaximal] (P : Ideal (BlowupChart R t x)) [P.IsMaximal]1048    (Φ : Polynomial O) (hΦ : Φ.Monic) (h2 : 2 ≤ Φ.natDegree)1049    (hPeq : P = Ideal.span {chartBase R t x t,1050      Polynomial.eval₂ ((chartBase R t x).comp f) (chartSlope R t x) Φ})1051    (hdeg : Module.length R (BlowupChart R t x ⧸ P) = (1 : ℕ∞)) : False := by1052  obtain ⟨e1, he, heZ⟩ := exceptional_line_equiv_chart_exceptional R t x1053  have hP : chartBase R t x t ∈ P := hPeq ▸ Ideal.subset_span (by simp)1054  obtain ⟨φ, hmon, hirr, hmap, -, hlen⟩ :=1055    blowup_chart_exceptional_point_polynomial R t x e1 he heZ P hP1056  rw [hdeg] at hlen1057  have hφ : φ.natDegree = 1 := by exact_mod_cast hlen.symm1058  have hk : (Ideal.Quotient.mk (chartExceptional R t x)) (chartBase R t x t) = 0 :=1059    Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span rfl)1060  rw [hPeq, Ideal.map_span, Set.image_pair, hk, Ideal.map_span] at hmap1061  simp only [Set.image_pair] at hmap1062  have hev : e1 ((Ideal.Quotient.mk (chartExceptional R t x))1063      (Polynomial.eval₂ ((chartBase R t x).comp f) (chartSlope R t x) Φ))1064      = Φ.map ((Ideal.Quotient.mk (Ideal.span ({t, x} : Set R))).comp f) := by1065    have := Polynomial.hom_eval₂ Φ ((chartBase R t x).comp f)1066      (((e1 : _ ≃+* _).toRingHom).comp1067        (Ideal.Quotient.mk (chartExceptional R t x))) (chartSlope R t x)1068    simp only [RingHom.coe_comp, Function.comp_apply, RingEquiv.toRingHom_eq_coe,1069      RingHom.coe_coe] at this1070    rw [this, heZ]1071    simp only [Polynomial.map]1072    congr 11073    ext c1074    simp [he]1075  simp only [hev, map_zero] at hmap1076  have h0 : ∀ (K : Type) [CommRing K] (p : K), Ideal.span ({0, p} : Set K) = Ideal.span {p} := by1077    intro K _ p1078    rw [Ideal.span_insert, Ideal.span_singleton_eq_bot.mpr rfl, bot_sup_eq]1079  rw [h0] at hmap1080  obtain ⟨w, hw⟩ := Ideal.span_singleton_eq_span_singleton.mp hmap1081  have hne : (Φ.map ((Ideal.Quotient.mk (Ideal.span ({t, x} : Set R))).comp f)) ≠ 0 :=1082    (hΦ.map _).ne_zero1083  have := congrArg Polynomial.natDegree hw1084  rw [Polynomial.natDegree_mul hne w.ne_zero, Polynomial.natDegree_coe_units,1085    hΦ.natDegree_map, hφ] at this1086  omega1087 1088open scoped Classical in1089/-- A degree-one point on the exceptional line of the `t`-chart has slope `α` with `α = 0` or a1090unit, and its completed local ring is a concrete surface over `O` with explicit parameters. -/1091theorem t_chart_rational_point_child_data (O : Type) [CommRing O] [IsDomain O]1092    [IsDiscreteValuationRing O] [IsAdicComplete (IsLocalRing.maximalIdeal O) O]1093    [Finite (IsLocalRing.ResidueField O)] (pi : O) (hpi : Irreducible pi) (u : (TwoSeries O)ˣ)1094    (a b : ℕ) (ha : 0 < a)1095    (P : Ideal (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1096        (surfaceX O pi u a b)))1097    [P.IsMaximal] [P.IsPrime]1098    (hP : (chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b))1099        (surfaceT O pi u a b) ∈ P)1100    (hdeg : Module.length (ConcreteSurface O pi u a b)1101        ((BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b)) ⧸1102          P) = (1 : ℕ∞)) :1103    ∃ α : O, (α = 0 ∨ IsUnit α) ∧1104    P = Ideal.span {(chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1105        (surfaceX O pi u a b)) (surfaceT O pi u a b),1106        (chartSlope (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b)) -1107          (chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b))1108          (algebraMap O (ConcreteSurface O pi u a b) α)} ∧1109    ∃ (u' : (TwoSeries O)ˣ) (Eq : CompletedLocalAt1110        (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b) (surfaceX O pi u a b)) P ≃+*1111        ConcreteSurface O pi u' (a + b) (if α = 0 then b else 0)),1112    Eq ((completedPointMap (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1113        (surfaceX O pi u a b)) P) ((chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1114        (surfaceX O pi u a b)) (surfaceT O pi u a b))) =1115        surfaceT O pi u' (a + b) (if α = 0 then b else 0) ∧1116    Eq ((completedPointMap (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1117        (surfaceX O pi u a b)) P) (chartSlope (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1118        (surfaceX O pi u a b))) = surfaceX O pi u' (a + b) (if α = 0 then b else 0) +1119        algebraMap O (ConcreteSurface O pi u' (a + b) (if α = 0 then b else 0)) α ∧1120    ∀ c : O,1121    Eq ((completedPointMap (BlowupChart (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1122        (surfaceX O pi u a b)) P) ((chartBase (ConcreteSurface O pi u a b) (surfaceT O pi u a b)1123        (surfaceX O pi u a b)) (algebraMap O (ConcreteSurface O pi u a b) c))) =1124        algebraMap O (ConcreteSurface O pi u' (a + b) (if α = 0 then b else 0)) c := by1125  obtain ⟨e, -⟩ := concrete_surface_quotient_parameters_equiv O pi hpi u a b ha1126  have hmax : (Ideal.span ({surfaceT O pi u a b, surfaceX O pi u a b} :1127      Set (ConcreteSurface O pi u a b))).IsMaximal :=1128    Ideal.Quotient.maximal_of_isField _ (e.toMulEquiv.isField (Field.toIsField _))1129  obtain ⟨h1, h2, h3, h4, h5, h6, -⟩ := chartSubst_apply_generators O 01130  rcases concrete_chart_point_span_form O pi hpi u a b ha P hP with h | ⟨α, hα, h⟩ | ⟨Φ, hΦ, h2', h⟩1131  · have hb : (if (0 : O) = 0 then b else 0) = b := ite_eq_left rfl1132    obtain ⟨E, hE1, hE2, hE3⟩ := t_chart_origin_completion_equiv O pi hpi u a b ha P h1133    refine ⟨0, Or.inl rfl, ?_, ?_⟩1134    · simpa using h1135    · rw [hb]1136      refine ⟨substUnit O 0 u, E, ?_, ?_, hE3⟩1137      · have := hE1 (axisT O)1138        rwa [h2] at this1139      · simpa using hE21140  · have hα0 : α ≠ 0 := hα.ne_zero1141    have hb : (if α = 0 then b else 0) = 0 := ite_eq_right hα01142    obtain ⟨E, hE1, hE2, hE3⟩ := t_chart_unit_point_completion_equiv O pi hpi u a b ha α hα P h1143    refine ⟨α, Or.inr hα, h, ?_⟩1144    rw [hb]1145    refine ⟨_, E, ?_, hE2, hE3⟩1146    have := hE1 (axisT O)1147    rwa [(chartSubst_apply_generators O α).2.1] at this1148  · exact (not_two_le_natDegree_of_length_one O _ (algebraMap O _) _ _ P Φ hΦ.1 h2' h hdeg).elim1149 1150end SurfaceBlowup