Lean sources / SurfaceBlowup / Blowup / CurveSections.lean

Curve sections on the two-chart blow-up

1115 lines · 18 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.Blowup.H0Comparison7import SurfaceBlowup.Blowup.StrictNormalizer8 9/-!10# Curve sections on the two-chart blow-up11 12Let `(t, x)` be a regular parameter pair of `R` and consider the two affine charts of the blow-up13of `(t, x)` together with their overlap. This file studies the lattices of curve sections cut out14by a compatible system of glued generators: it identifies their pullbacks to the surface, proves15that the layer-by-layer reduction maps are surjective (via a Laurent-polynomial description of the16exceptional layers of the overlap), constructs glued generators from compatible chart generators,17and establishes the basic transversality and finiteness properties of two-chart curve data.18 19## Main results20 21* `SurfaceBlowup.surface_to_curve_quotient_kernel`: a surface function lies in the level-`j` curve22  lattice iff it lies in `(f) + (t, x)^j`.23* `SurfaceBlowup.two_chart_layer_correction`: every element of the `j`-th exceptional layer of the24  overlap is a twisted Čech coboundary modulo the next layer.25* `SurfaceBlowup.curve_limit_level_map_surjective`: the projection from the curve order limit to26  each level is surjective.27* `SurfaceBlowup.glued_generators_exist`: compatible chart generators glue to glued generators.28* `SurfaceBlowup.mul_injective_quotient_transport`,29  `SurfaceBlowup.exists_pow_le_span_pair_transport`: transversality and finite contact transport30  along a ring isomorphism sending the exceptional parameter to a unit multiple of another.31* `SurfaceBlowup.strict_transform_equation_of_kernels`: the chart-independent strict-transform32  equation `f = eᵈ · g · unit` at a point of finite support.33* `SurfaceBlowup.two_chart_left_data_transverse_finite`,34  `SurfaceBlowup.two_chart_right_data_transverse_finite`: transversality and finiteness of the local35  data of two-chart curve data at the points of the two charts.36 37Provenance: `Thm_SurfaceBlowupV2_{surface_to_curve_quotient_kernel,38parent_ideal_unique_of_level_lattice, surface_to_curve_limit_kernel, two_chart_layer_correction,39curve_sections_reduction_surjective, curve_limit_level_map_surjective,40two_chart_additive_approximation, curve_sections_cover_overlap, two_chart_layer_correction_positive,41glued_generators_step, glued_generators_exist, two_chart_left_data_transverse_finite,42two_chart_left_points_maximal, strict_transform_left_point_equation,43two_chart_right_data_transverse_finite}` (the node `glued_generators_step` is the private44`glued_generators_succ` here).45-/46 47namespace SurfaceBlowup48 49/-! ### Transport between the charts and the overlap -/50 51section Transport52 53variable {R : Type} [CommRing R] {t x : R}54 55/-- The right chart map sends `x` to `e · z` on the overlap. -/56theorem beta_right_chartBase_self (beta : BlowupRestriction R t x) :57    beta.right (chartBase R x t x) = overlapException R t x * overlapSlope R t x := by58  rw [beta_right_chartBase, ← blowup_chart_relation, map_mul]59  rfl60 61private theorem algebraMap_mem_overlap_pow (j : ℕ) (a : BlowupChart R t x)62    (ha : a ∈ (chartExceptional R t x) ^ j) :63    algebraMap (BlowupChart R t x) (BlowupOverlap R t x) a ∈64      (Ideal.span {overlapException R t x})^j := by65  have := Ideal.mem_map_of_mem (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) ha66  rwa [Ideal.map_pow, chartExceptional, Ideal.map_span, Set.image_singleton] at this67 68private theorem beta_right_mem_overlap_pow (beta : BlowupRestriction R t x) (j : ℕ)69    (b : BlowupChart R x t) (hb : b ∈ (chartExceptional R x t) ^ j) :70    beta.right b ∈ (Ideal.span {overlapException R t x})^j := by71  have := Ideal.mem_map_of_mem (beta.right : BlowupChart R x t →+* BlowupOverlap R t x) hb72  rw [Ideal.map_pow, chartExceptional, Ideal.map_span, Set.image_singleton] at this73  refine Ideal.pow_right_mono ?_ j this74  rw [Ideal.span_singleton_le_span_singleton]75  change _ ∣ beta.right (chartBase R x t x)76  rw [beta_right_chartBase_self]77  exact dvd_mul_right _ _78 79end Transport80 81/-! ### Curve lattices and the surface -/82 83private theorem algebraMap_sub_mul_mem {R A : Type} [CommRing R] [CommRing A] [Algebra R A]84    (I : Ideal A) (T g a c : A) (d : ℕ) {r f s : R}85    (hyc : a * g + c = algebraMap R A r) (hs : a - T ^ d * algebraMap R A s ∈ I) (hc : c ∈ I)86    (hf : algebraMap R A f - T ^ d * g ∈ I) : algebraMap R A (r - f * s) ∈ I := by87  have : algebraMap R A (r - f * s) =88      g * (a - T ^ d * algebraMap R A s) + c -89        (algebraMap R A f - T ^ d * g) * algebraMap R A s := by90    rw [map_sub, map_mul, ← hyc]; ring91  rw [this]92  exact sub_mem (add_mem (Ideal.mul_mem_left _ _ hs) hc) (Ideal.mul_mem_right _ _ hf)93 94private theorem algebraMap_mem_span_sup {R A : Type} [CommRing R] [CommRing A] [Algebra R A]95    (I : Ideal A) (T g : A) (d : ℕ) {f : R} (hf : algebraMap R A f - T ^ d * g ∈ I) :96    algebraMap R A f ∈ Ideal.span {g} ⊔ I := by97  rw [← sub_add_cancel (algebraMap R A f) (T ^ d * g)]98  exact add_mem (Ideal.mem_sup_right hf)99    (Ideal.mem_sup_left (Ideal.mem_span_singleton.mpr (dvd_mul_left _ _)))100 101/-- A surface function `r` lies in the level-`j` curve lattice of the glued generators `G` iff102`r ∈ (f) + (t, x)^j`, where `f` is a surface function inducing `G` at every level. -/103theorem surface_to_curve_quotient_kernel (R : Type) [CommRing R] (t x : R)104    (beta : BlowupRestriction R t x) (d : ℕ) (G : GluedGenerators R t x beta d)105    (hreg : RegularParameterPair R t x) (hregSwap : RegularParameterPair R x t) (j : ℕ)106    (hregF : Function.Injective (fun c : BlowupOverlap R t x ⧸107      (Ideal.span {overlapException R t x})^j =>108      Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j)109      ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j)) * c))110    (f : R)111    (hf : ∀ j : ℕ, surfaceToCechInput R t x j f =112      (cechInputLattice R t x j).mkQ (gluedFunctionPair R t x G j))113    (r : R) :114    surfaceToChartPair R t x r ∈ curveIdealLattice R t x beta G j ↔ r ∈ Ideal.span {f} ⊔115      (Ideal.span {t,x})^j := by116  have hker := surface_to_cech_kernel R t x hreg j117  have hfA := glued_function_left_chart R t x beta d G f hf j118  have hfB := glued_function_right_chart R t x beta d G f hf j119  -- kernel elements map into the input lattice120  have hlat : ∀ u : R, u ∈ (Ideal.span {t,x})^j ↔121      surfaceToChartPair R t x u ∈ cechInputLattice R t x j := by122    intro u123    rw [← hker, LinearMap.mem_ker]124    change (cechInputLattice R t x j).mkQ _ = 0 ↔ _125    rw [Submodule.mkQ_apply, Submodule.Quotient.mk_eq_zero]126  have hin : cechInputLattice R t x j ≤ curveIdealLattice R t x beta G j := by127    rintro ⟨a, b⟩ ⟨ha, hb⟩128    exact ⟨Ideal.mem_sup_right ha, Ideal.mem_sup_right hb⟩129  constructor130  · intro h131    obtain ⟨hA, hB⟩ := h132    change algebraMap R (BlowupChart R t x) r ∈ Ideal.span {G.left j} ⊔ _ at hA133    change algebraMap R (BlowupChart R x t) r ∈ Ideal.span {G.right j} ⊔ _ at hB134    obtain ⟨y, hy, c, hc, hyc⟩ := Submodule.mem_sup.mp hA135    obtain ⟨a, rfl⟩ := Ideal.mem_span_singleton'.mp hy136    obtain ⟨y', hy', c', hc', hyc'⟩ := Submodule.mem_sup.mp hB137    obtain ⟨b, rfl⟩ := Ideal.mem_span_singleton'.mp hy'138    set alpha := algebraMap (BlowupChart R t x) (BlowupOverlap R t x) with halpha139    set Zi := IsLocalization.Away.invSelf (chartSlope R t x) (S := BlowupOverlap R t x) with hZi140    set I := (Ideal.span {overlapException R t x})^j with hI141    have hZ : overlapSlope R t x * Zi = 1 := IsLocalization.Away.mul_invSelf _142    have hZd : overlapSlope R t x ^ d * Zi ^ d = 1 := by rw [← mul_pow, hZ, one_pow]143    have h1 : alpha (a * G.left j + c) = beta.right (b * G.right j + c') := by144      rw [hyc, hyc', AlgHom.commutes, halpha, ← IsScalarTower.algebraMap_apply]145    rw [map_add, map_add, map_mul, map_mul] at h1146    have hov := G.overlap j147    have hmem : alpha (G.left j) * (alpha a - Zi ^ d * beta.right b) ∈ I := by148      have heq : alpha (G.left j) * (alpha a - Zi ^ d * beta.right b) =149          beta.right c' - alpha c - Zi ^ d * beta.right b *150            (alpha (G.left j) - overlapSlope R t x ^ d * beta.right (G.right j)) := by151        linear_combination h1 - (beta.right b * beta.right (G.right j)) * hZd152      rw [heq]153      exact sub_mem (sub_mem (beta_right_mem_overlap_pow beta j c' hc')154        (algebraMap_mem_overlap_pow j c hc)) (Ideal.mul_mem_left _ _ hov)155    have hcl : alpha a - Zi ^ d * beta.right b ∈ I := by156      rw [← Ideal.Quotient.eq_zero_iff_mem]157      apply hregF158      simp only [mul_zero]159      rw [← map_mul, Ideal.Quotient.eq_zero_iff_mem]160      exact hmem161    have hle : cechInputLattice R t x j ≤162        (cechOutputLattice R t x j).comap (fullCechDifferential R t x beta d) := by163      rintro ⟨a₁, b₁⟩ ⟨ha₁, hb₁⟩164      change alpha a₁ - Zi ^ d * beta.right b₁ ∈ I165      exact sub_mem (algebraMap_mem_overlap_pow j a₁ ha₁)166        (Ideal.mul_mem_left _ _ (beta_right_mem_overlap_pow beta j b₁ hb₁))167    obtain ⟨s, hs⟩ := twisted_kernel_from_surface R t x hreg hregSwap beta d j hle168      ((cechInputLattice R t x j).mkQ (a, b)) (by169        rw [finiteCechDifferential, Submodule.mkQ_apply, Submodule.mapQ_apply,170          Submodule.Quotient.mk_eq_zero]171        exact hcl)172    rw [Submodule.mkQ_apply, Submodule.mkQ_apply, Submodule.Quotient.eq] at hs173    obtain ⟨hsA, hsB⟩ := hs174    refine Submodule.mem_sup.mpr ⟨f * s, Ideal.mul_mem_right _ _ (Ideal.mem_span_singleton_self f),175      r - f * s, ?_, by ring⟩176    rw [hlat]177    exact ⟨algebraMap_sub_mul_mem _ _ _ a c d hyc hsA hc hfA,178      algebraMap_sub_mul_mem _ _ _ b c' d hyc' hsB hc' hfB⟩179  · intro h180    obtain ⟨y, hy, u, hu, rfl⟩ := Submodule.mem_sup.mp h181    obtain ⟨s, rfl⟩ := Ideal.mem_span_singleton'.mp hy182    rw [map_add]183    refine add_mem ?_ (hin ((hlat u).mp hu))184    rw [show s * f = s • f from rfl, map_smul]185    exact Submodule.smul_mem _ _186      ⟨algebraMap_mem_span_sup _ _ _ d hfA, algebraMap_mem_span_sup _ _ _ d hfB⟩187 188/-- In a regular local ring, a surface function `f'` lying in every curve lattice of `G` and of189multiplicity at most `d` generates the same principal ideal as the function `f` inducing `G`. -/190theorem parent_ideal_unique_of_level_lattice (R : Type) [CommRing R] (t x : R)191    [(Ideal.span ({t,x} : Set R)).IsMaximal] [IsLocalRing R] [IsNoetherianRing R]192    (hreg : RegularParameterPair R t x) (hregSwap : RegularParameterPair R x t)193    (beta : BlowupRestriction R t x) (d : ℕ) (G : GluedGenerators R t x beta d)194    (hregF : ∀ j : ℕ, Function.Injective (fun c : BlowupOverlap R t x ⧸195      (Ideal.span {overlapException R t x})^j =>196      Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j)197      ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j)) * c))198    (f : R)199    (hf : ∀ j : ℕ, surfaceToCechInput R t x j f =200      (cechInputLattice R t x j).mkQ (gluedFunctionPair R t x G j))201    (f' : R) (hf' : ∀ j : ℕ, surfaceToChartPair R t x f' ∈ curveIdealLattice R t x beta G j)202    (hmult : f' ∉ (Ideal.span {t,x})^(d+1)) :203    Ideal.span {f'} = Ideal.span {f} := by204  have hm : Ideal.span ({t,x} : Set R) = IsLocalRing.maximalIdeal R :=205    IsLocalRing.eq_maximalIdeal inferInstance206  have h1 : f' ∈ Ideal.span {f} := by207    have := ideal_closed_noetherian_local R (Ideal.span {f})208    rw [← this, Ideal.mem_iInf]209    intro j210    rw [← hm]211    exact (surface_to_curve_quotient_kernel R t x beta d G hreg hregSwap j (hregF j) f hf f').mp212      (hf' j)213  obtain ⟨r, hr⟩ := Ideal.mem_span_singleton'.mp h1214  have hfd := glued_function_order R t x beta d G hreg f hf215  have hru : IsUnit r := by216    by_contra hn217    apply hmult218    rw [hm] at hfd ⊢219    have : r ∈ IsLocalRing.maximalIdeal R := by220      simpa [IsLocalRing.mem_maximalIdeal, mem_nonunits_iff] using hn221    rw [← hr, pow_succ, mul_comm]222    exact Ideal.mul_mem_mul this hfd223  obtain ⟨u, rfl⟩ := hru224  rw [← hr]225  exact principal_ideal_unit_invariance R f u226 227/-- If `(f)` is closed in the `(t, x)`-adic topology, the kernel of a section `σ` of the map from228the surface to the curve order limit is the principal ideal `(f)`. -/229theorem surface_to_curve_limit_kernel (R : Type) [CommRing R] (t x : R)230    (beta : BlowupRestriction R t x) (d : ℕ) (G : GluedGenerators R t x beta d)231    (hreg : RegularParameterPair R t x) (hregSwap : RegularParameterPair R x t)232    (hregF : ∀ j : ℕ, Function.Injective (fun c : BlowupOverlap R t x ⧸233      (Ideal.span {overlapException R t x})^j =>234      Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j)235      ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j)) * c))236    (f : R)237    (hf : ∀ j : ℕ, surfaceToCechInput R t x j f =238      (cechInputLattice R t x j).mkQ (gluedFunctionPair R t x G j))239    (hclosed : (⨅ j : ℕ, (Ideal.span {f} ⊔ (Ideal.span {t,x})^j)) = Ideal.span {f})240    (σ : R →ₗ[R] CurveOrderLimit R t x beta G)241    (hσ : ∀ r : R, ∃ p : curveThreads R t x beta G, σ r = curveLimitMk R t x beta G p ∧ ∀ j : ℕ,242      p.val j = surfaceToChartPair R t x r) :243    LinearMap.ker σ = (Ideal.span {f} : Submodule R R) := by244  ext r245  obtain ⟨p, hp, hpj⟩ := hσ r246  have key : σ r = 0 ↔ ∀ j, r ∈ Ideal.span {f} ⊔ (Ideal.span {t,x})^j := by247    rw [hp]248    change Submodule.Quotient.mk p = 0 ↔ _249    rw [Submodule.Quotient.mk_eq_zero]250    change (∀ j ∈ (Set.univ : Set ℕ), p.val j ∈ curveIdealLattice R t x beta G j) ↔ _251    simp only [Set.mem_univ, forall_true_left]252    refine forall_congr' fun j => ?_253    rw [hpj j]254    exact surface_to_curve_quotient_kernel R t x beta d G hreg hregSwap j (hregF j) f hf r255  rw [LinearMap.mem_ker, key]256  rw [← Submodule.mem_iInf, hclosed]257 258/-! ### Exceptional layers of the overlap -/259 260private theorem principalLayerMap_apply' {A : Type} [CommRing A] (e : A) (j : ℕ) (a : A) :261    principalLayerMap A e j a = Ideal.Quotient.mk ((Ideal.span {e})^(j+1)) (a * e^j) := by262  simp [principalLayerMap, LinearMap.toSpanSingleton_apply, Algebra.smul_def]263 264/-- Twisted layer correction with an arbitrary integral twist `k ≥ -1 - j`: an element of the265`j`-th power of the exceptional ideal of the overlap is, modulo the `(j + 1)`-st power,266of the form `a - z^k β(b)` with `a`, `b` in the `j`-th powers of the exceptional ideals of the267charts (`z` the slope). -/268private theorem two_chart_layer_correction_zpow (R : Type) [CommRing R] (t x : R)269    (hreg : RegularParameterPair R t x) (beta : BlowupChart R x t →+* BlowupOverlap R t x)270    (hbase : ∀ r : R, beta (chartBase R x t r) =271      algebraMap (BlowupChart R t x) (BlowupOverlap R t x) (chartBase R t x r))272    (hslope : beta (chartSlope R x t) = IsLocalization.Away.invSelf (chartSlope R t x))273    (j : ℕ) (k : ℤ) (hk : -1 ≤ (j : ℤ) + k) (w : BlowupOverlap R t x)274    (hw : w ∈ (Ideal.span {algebraMap (BlowupChart R t x) (BlowupOverlap R t x)275                             (chartBase R t x t)})^j) :276    ∃ a ∈ (chartExceptional R t x)^j, ∃ b ∈ (chartExceptional R x t)^j,277      w - (algebraMap (BlowupChart R t x) (BlowupOverlap R t x) a -278        selfZPow (chartSlope R t x) (BlowupOverlap R t x) k * beta b) ∈279      (Ideal.span {algebraMap (BlowupChart R t x) (BlowupOverlap R t x)280                     (chartBase R t x t)})^(j+1) := by281  obtain ⟨L, hL⟩ := overlap_layer_laurent_coordinates R t x hreg j282  have hP : ∀ P : Polynomial (R ⧸ Ideal.span {t, x}), ∃ a ∈ (chartExceptional R t x)^j,283      (L P.toLaurent).val = Ideal.Quotient.mk284        ((Ideal.span {algebraMap (BlowupChart R t x) (BlowupOverlap R t x)285                        (chartBase R t x t)})^(j+1))286        (algebraMap (BlowupChart R t x) (BlowupOverlap R t x) a) := by287    intro P288    induction P using Polynomial.induction_on' with289    | add p q hp hq =>290      obtain ⟨a1, ha1, h1⟩ := hp291      obtain ⟨a2, ha2, h2⟩ := hq292      refine ⟨a1 + a2, add_mem ha1 ha2, ?_⟩293      rw [map_add, map_add, Submodule.coe_add, h1, h2, map_add, map_add]294    | monomial n c =>295      obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective c296      refine ⟨chartBase R t x r * chartSlope R t x ^ n * chartBase R t x t ^ j,297        Ideal.mul_mem_left _ _ (Ideal.pow_mem_pow (Ideal.mem_span_singleton_self _) j), ?_⟩298      rw [Polynomial.toLaurent_C_mul_T, hL, principalLayerMap_apply']299      simp only [map_mul, map_pow, selfZPow_natCast]300  have hQ : ∀ Q : Polynomial (R ⧸ Ideal.span {t, x}), ∃ b ∈ (chartExceptional R x t)^j,301      (L (LaurentPolynomial.T ((j : ℤ) + k) * LaurentPolynomial.invert Q.toLaurent)).val302        = Ideal.Quotient.mk303          ((Ideal.span {algebraMap (BlowupChart R t x) (BlowupOverlap R t x)304                          (chartBase R t x t)})^(j+1))305          (selfZPow (chartSlope R t x) (BlowupOverlap R t x) k * beta b) := by306    intro Q307    induction Q using Polynomial.induction_on' with308    | add p q hp hq =>309      obtain ⟨a1, ha1, h1⟩ := hp310      obtain ⟨a2, ha2, h2⟩ := hq311      refine ⟨a1 + a2, add_mem ha1 ha2, ?_⟩312      rw [map_add, map_add, mul_add, map_add, Submodule.coe_add, h1, h2, map_add, mul_add, map_add]313    | monomial n c =>314      obtain ⟨r, rfl⟩ := Ideal.Quotient.mk_surjective c315      refine ⟨chartBase R x t r * chartBase R x t x ^ j * chartSlope R x t ^ n,316        Ideal.mul_mem_right _ _317          (Ideal.mul_mem_left _ _ (Ideal.pow_mem_pow (Ideal.mem_span_singleton_self _) j)), ?_⟩318      have hT : LaurentPolynomial.T ((j : ℤ) + k) * LaurentPolynomial.invert319          (Polynomial.toLaurent (Polynomial.monomial n (Ideal.Quotient.mk (Ideal.span {t, x}) r)))320          = LaurentPolynomial.C (Ideal.Quotient.mk (Ideal.span {t, x}) r)321            * LaurentPolynomial.T ((j : ℤ) + k + -(n : ℤ)) := by322        rw [Polynomial.toLaurent_C_mul_T, map_mul, LaurentPolynomial.invert_C,323          LaurentPolynomial.invert_T, mul_left_comm, ← LaurentPolynomial.T_add]324      rw [hT, hL, principalLayerMap_apply']325      congr 1326      rw [map_mul, map_mul, map_pow, map_pow, hbase, hbase, hslope,327        ← blowup_chart_relation R t x, map_mul, selfZPow_add, selfZPow_add, selfZPow_natCast,328        invSelf_pow_eq_selfZPow]329      ring330  obtain ⟨P, Q, hF⟩ := laurent_split_nonnegative_twist (R ⧸ Ideal.span {t, x}) ((j : ℤ) + k) hk331    (L.symm ⟨Ideal.Quotient.mk332      ((Ideal.span {algebraMap (BlowupChart R t x) (BlowupOverlap R t x)333                      (chartBase R t x t)})^(j+1)) w, by334      rw [LinearMap.mem_ker]335      unfold principalPowerReduction336      rw [AlgHom.toLinearMap_apply, Ideal.Quotient.factorₐ_apply, Ideal.Quotient.factor_mk]337      exact Ideal.Quotient.eq_zero_iff_mem.mpr hw⟩)338  obtain ⟨a, ha, hPa⟩ := hP P339  obtain ⟨b, hb, hQb⟩ := hQ Q340  refine ⟨a, ha, b, hb, ?_⟩341  rw [← Ideal.Quotient.eq_zero_iff_mem]342  have := congrArg (fun F => (L F).val) hF343  simp only [LinearEquiv.apply_symm_apply, map_sub, Submodule.coe_sub] at this344  rw [hPa, hQb] at this345  rw [map_sub, this, map_sub, sub_self]346 347/-- Layer correction with negative twist: for `d ≤ j + 1`, every `w` in the `j`-th power of the348exceptional ideal of the overlap agrees modulo the `(j + 1)`-st power with `a - z⁻ᵈ β(b)`, where349`a`, `b` lie in the `j`-th powers of the exceptional ideals of the two charts. -/350theorem two_chart_layer_correction (R : Type) [CommRing R] (t x : R)351    (hreg : RegularParameterPair R t x) (beta : (BlowupChart R x t) →+* (BlowupOverlap R t x))352    (hbase : ∀ r : R, beta (chartBase R x t r) =353      (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (chartBase R t x r))354    (hslope : beta (chartSlope R x t) = IsLocalization.Away.invSelf (chartSlope R t x)) (j d : ℕ)355    (hd : d ≤ j+1) (w : (BlowupOverlap R t x))356    (hw : w ∈357      (Ideal.span {(algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (chartBase R t x t)})^j) :358    ∃ a : (BlowupChart R t x), ∃ b : (BlowupChart R x t), a ∈ (chartExceptional R t x)^j ∧ b ∈359      (chartExceptional R x t)^j ∧ w - ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) a -360      (IsLocalization.Away.invSelf (chartSlope R t x))^d * beta b) ∈ (Ideal.span361      {(algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (chartBase R t x t)})^(j+1) := by362  obtain ⟨a, ha, b, hb, h⟩ :=363    two_chart_layer_correction_zpow R t x hreg beta hbase hslope j (-d) (by omega) w hw364  exact ⟨a, b, ha, hb, by rwa [← invSelf_pow_eq_selfZPow] at h⟩365 366/-- The reduction map from the level-`(j + 1)` to the level-`j` quotient of curve sections is367surjective. -/368private theorem curve_sections_reduction_surjective (R : Type) [CommRing R] (t x : R)369    (beta : BlowupRestriction R t x) (d : ℕ) (G : GluedGenerators R t x beta d)370    (hreg : RegularParameterPair R t x) (j : ℕ)371    (ρ : curveSectionsQuot R t x beta G (j + 1) →ₗ[R] curveSectionsQuot R t x beta G j)372    (hρ : ∀ q : curveSectionsQuot R t x beta G (j+1), ∀ p : BlowupChart R t x × BlowupChart R x t,373      (q : (BlowupChart R t x × BlowupChart R x t) ⧸ curveIdealLattice R t x beta G (j+1)) =374      (curveIdealLattice R t x beta G (j+1)).mkQ p → ((ρ q : curveSectionsQuot R t x beta G j) :375      (BlowupChart R t x × BlowupChart R x t) ⧸ curveIdealLattice R t x beta G j) =376      (curveIdealLattice R t x beta G j).mkQ p) :377    Function.Surjective ρ := by378  set α := algebraMap (BlowupChart R t x) (BlowupOverlap R t x) with hα379  set E : Ideal (BlowupOverlap R t x) := Ideal.span {α (chartBase R t x t)} with hE380  have hbase : ∀ r : R, beta.right.toRingHom (chartBase R x t r) = α (chartBase R t x r) :=381    beta_right_chartBase beta382  have hdiff : ∀ p : BlowupChart R t x × BlowupChart R x t,383      fullCechDifferential R t x beta 0 p = α p.1 - beta.right p.2 := by384    intro p385    change α p.1 - (IsLocalization.Away.invSelf (chartSlope R t x))^0 * beta.right p.2 = _386    simp387  rintro ⟨y, hy⟩388  obtain ⟨p, hp, rfl⟩ := Submodule.mem_map.mp hy389  have hp' : α p.1 - beta.right p.2 ∈ overlapCurveIdeal R t x beta G j := by390    rw [← hdiff]; exact hp391  obtain ⟨u, hu, v, hv, huv⟩ := Submodule.mem_sup.mp hp'392  obtain ⟨c, rfl⟩ := Ideal.mem_span_singleton'.mp hu393  have hEeq : Ideal.span {overlapException R t x} = E := rfl394  rw [hEeq] at hv395  have hcompat : α (G.left j) - α (G.left (j+1)) ∈ E ^ j := by396    have := Ideal.mem_map_of_mem α (G.left_compat j)397    rw [chartExceptional, Ideal.map_pow, Ideal.map_span, Set.image_singleton] at this398    rw [← neg_sub, ← map_sub]399    exact neg_mem this400  set w := α p.1 - beta.right p.2 - c * α (G.left (j+1)) with hw401  have hwmem : w ∈ E ^ j := by402    have : w = c * (α (G.left j) - α (G.left (j+1))) + v := by403      rw [hw, ← huv]; ring404    rw [this]405    exact add_mem (Ideal.mul_mem_left _ _ hcompat) hv406  obtain ⟨a₁, b₁, ha₁, hb₁, hres⟩ := two_chart_layer_correction R t x hreg beta.right.toRingHom407    hbase beta.slope j 0 (by omega) w hwmem408  simp only [pow_zero, one_mul] at hres409  set p' : BlowupChart R t x × BlowupChart R x t := (p.1 - a₁, p.2 - b₁) with hp'def410  have hp'mem : p' ∈ curveSections R t x beta G (j+1) := by411    change fullCechDifferential R t x beta 0 p' ∈ overlapCurveIdeal R t x beta G (j+1)412    rw [hdiff]413    have : α p'.1 - beta.right p'.2 = c * α (G.left (j+1)) +414        (w - (α a₁ - beta.right.toRingHom b₁)) := by415      simp only [hp'def, hw, map_sub]; change _ = _ + (_ - (_ - beta.right b₁))416      ring417    rw [this]418    exact add_mem (Submodule.mem_sup_left (Ideal.mul_mem_left _ _ (Ideal.subset_span rfl)))419      (Submodule.mem_sup_right hres)420  refine ⟨⟨(curveIdealLattice R t x beta G (j+1)).mkQ p', Submodule.mem_map_of_mem hp'mem⟩, ?_⟩421  apply Subtype.ext422  rw [hρ _ p' rfl]423  simp only [Submodule.mkQ_apply]424  rw [Submodule.Quotient.eq]425  refine ⟨?_, ?_⟩426  · change p.1 - a₁ - p.1 ∈ leftCurveIdeal R t x beta G j427    rw [sub_sub_cancel_left]428    exact Submodule.mem_sup_right (neg_mem ha₁)429  · change p.2 - b₁ - p.2 ∈ rightCurveIdeal R t x beta G j430    rw [sub_sub_cancel_left]431    exact Submodule.mem_sup_right (neg_mem hb₁)432 433/-- The projection from the curve order limit to the level-`J` quotient of curve sections is434surjective. -/435theorem curve_limit_level_map_surjective (R : Type) [CommRing R] (t x : R)Lemma 4.1436    (beta : BlowupRestriction R t x) (d : ℕ) (G : GluedGenerators R t x beta d)437    (hreg : RegularParameterPair R t x) (J : ℕ)438    (π : CurveOrderLimit R t x beta G →ₗ[R] curveSectionsQuot R t x beta G J)439    (hπ : ∀ p : curveThreads R t x beta G,440      ((π (curveLimitMk R t x beta G p) : curveSectionsQuot R t x beta G J) :441      (BlowupChart R t x × BlowupChart R x t) ⧸ curveIdealLattice R t x beta G J) =442      (curveIdealLattice R t x beta G J).mkQ (p.val J)) :443    Function.Surjective π := by444  classical445  -- key lifting step446  have key : ∀ j : ℕ, ∀ a, a ∈ curveSections R t x beta G j →447      ∃ b, b ∈ curveSections R t x beta G (j+1) ∧ a - b ∈ curveIdealLattice R t x beta G j := by448    intro j a ha449    obtain ⟨ρ, hρ⟩ := curve_sections_quot_reduction_exists R t x beta d G j450    have hs := curve_sections_reduction_surjective R t x beta d G hreg j ρ hρ451    obtain ⟨q', hq'⟩ := hs ⟨(curveIdealLattice R t x beta G j).mkQ a, Submodule.mem_map_of_mem ha⟩452    obtain ⟨b, hb, hbq⟩ := Submodule.mem_map.mp q'.2453    refine ⟨b, hb, ?_⟩454    have h1 := hρ q' b hbq.symm455    rw [hq'] at h1456    have h2 : (curveIdealLattice R t x beta G j).mkQ (a - b) = 0 := by457      rw [map_sub]; exact sub_eq_zero.mpr h1458    exact (Submodule.Quotient.mk_eq_zero _).mp h2459  have anti : Antitone (fun j => curveSections R t x beta G j) :=460    antitone_nat_of_succ_le (fun j => (curve_lattices_antitone R t x beta d G j).2)461  intro q462  obtain ⟨a, ha, haq⟩ := Submodule.mem_map.mp q.2463  let f : ℕ → ChartPair R t x := fun n => Nat.rec a (fun n fn =>464    if h : fn ∈ curveSections R t x beta G (J+n) then Classical.choose (key (J+n) fn h) else 0) n465  have f0 : f 0 = a := rfl466  have fmem : ∀ n, f n ∈ curveSections R t x beta G (J+n) ∧467      f n - f (n+1) ∈ curveIdealLattice R t x beta G (J+n) := by468    have hs : ∀ n (h : f n ∈ curveSections R t x beta G (J+n)),469        f (n+1) = Classical.choose (key (J+n) (f n) h) := fun n h => dite_eq_left h470    intro n471    induction n with472    | zero => exact ⟨ha, by rw [hs 0 ha]; exact (Classical.choose_spec (key _ _ ha)).2⟩473    | succ n ih =>474      have h : f (n+1) ∈ curveSections R t x beta G (J+(n+1)) := by475        rw [hs n ih.1]; exact (Classical.choose_spec (key _ _ ih.1)).1476      exact ⟨h, by rw [hs (n+1) h]; exact (Classical.choose_spec (key _ _ h)).2⟩477  let p : ℕ → ChartPair R t x := fun j => f (j - J)478  have hp : p ∈ curveThreads R t x beta G := by479    refine ⟨?_, ?_⟩480    · intro j _481      exact anti (show j ≤ J + (j - J) by omega) (fmem (j - J)).1482    · intro j _483      change p j - LinearMap.id (p (j+1)) ∈ curveIdealLattice R t x beta G j484      simp only [LinearMap.id_apply, p]485      by_cases hj : j < J486      · rw [show j - J = 0 by omega, show j + 1 - J = 0 by omega, sub_self]487        exact Submodule.zero_mem _488      · rw [show j + 1 - J = (j - J) + 1 by omega]489        have := (fmem (j - J)).2490        rwa [show J + (j - J) = j by omega] at this491  refine ⟨curveLimitMk R t x beta G ⟨p, hp⟩, ?_⟩492  apply Subtype.ext493  rw [hπ]494  change (curveIdealLattice R t x beta G J).mkQ (f (J - J)) = _495  rw [Nat.sub_self, f0, haq]496 497/-- Every element of the overlap is, modulo the `n`-th power of the exceptional ideal, a498difference `a - β(b)` of functions on the two charts. -/499private theorem two_chart_additive_approximation (R : Type) [CommRing R] (t x : R)500    (hreg : RegularParameterPair R t x) (beta : (BlowupChart R x t) →+* (BlowupOverlap R t x))501    (hbase : ∀ r : R, beta (chartBase R x t r) =502      (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (chartBase R t x r))503    (hslope : beta (chartSlope R x t) = IsLocalization.Away.invSelf (chartSlope R t x)) (n : ℕ)504    (w : (BlowupOverlap R t x)) :505    ∃ a : (BlowupChart R t x), ∃ b : (BlowupChart R x t),506      w - ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) a - beta b) ∈507        (Ideal.span {(algebraMap (BlowupChart R t x) (BlowupOverlap R t x))508                       (chartBase R t x t)})^n := by509  induction n with510  | zero => exact ⟨0, 0, by simp⟩511  | succ n ih =>512    obtain ⟨a, b, hab⟩ := ih513    obtain ⟨c, d, -, -, hcd⟩ := two_chart_layer_correction R t x hreg beta hbase514      hslope n 0 (Nat.zero_le _) _ hab515    refine ⟨a + c, b + d, ?_⟩516    simp only [pow_zero, one_mul] at hcd517    convert hcd using 1518    rw [map_add, map_add]; ring519 520/-- Every multiple `G.left j * c` on the overlap is the untwisted Čech differential of a level-`j`521curve section, modulo the `j`-th power of the exceptional ideal. -/522theorem curve_sections_cover_overlap (R : Type) [CommRing R] (t x : R)523    (beta : BlowupRestriction R t x) (d : ℕ) (G : GluedGenerators R t x beta d)524    (hreg : RegularParameterPair R t x) (j : ℕ) (c : BlowupOverlap R t x) :525    ∃ p ∈ curveSections R t x beta G j, fullCechDifferential R t x beta 0 p -526      (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j) * c ∈527      (Ideal.span {overlapException R t x})^j := by528  obtain ⟨a, b, hab⟩ := two_chart_additive_approximation R t x hreg529    (beta.right : BlowupChart R x t →+* BlowupOverlap R t x) (beta_right_chartBase beta)530    beta.slope j531    ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j) * c)532  have hdiff : fullCechDifferential R t x beta 0 (a, b)533      = (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) a - beta.right b := by534    simp [fullCechDifferential, ringCechDifferential]535  have key : fullCechDifferential R t x beta 0 (a, b)536      - (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j) * c537      ∈ (Ideal.span {overlapException R t x})^j := by538    rw [hdiff]539    have := (Ideal.neg_mem_iff _).2 hab540    convert this using 1541    · rfl542    · change _ - beta.right b - _ = -(_ - (_ - beta.right b)); ring543  refine ⟨(a, b), ?_, key⟩544  change fullCechDifferential R t x beta 0 (a, b) ∈ overlapCurveIdeal R t x beta G j545  have : fullCechDifferential R t x beta 0 (a, b)546      = (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j) * c547        + (fullCechDifferential R t x beta 0 (a, b)548          - (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (G.left j) * c) := by ring549  rw [this]550  exact Ideal.add_mem _551    (Ideal.mem_sup_left (Ideal.mul_mem_right _ _ (Ideal.subset_span rfl)))552    (Ideal.mem_sup_right key)553 554/-- Layer correction with nonnegative twist: every `w` in the `j`-th power of the exceptional ideal555of the overlap agrees modulo the `(j + 1)`-st power with `a - zᵈ β(b)`, where `a`, `b` lie in the556`j`-th powers of the exceptional ideals of the two charts. -/557private theorem two_chart_layer_correction_positive (R : Type) [CommRing R] (t x : R)558    (beta : BlowupRestriction R t x) (hreg : RegularParameterPair R t x) (j d : ℕ)559    (w : BlowupOverlap R t x) (hw : w ∈ (Ideal.span {overlapException R t x}) ^ j) :560    ∃ a ∈ (chartExceptional R t x)^j, ∃ b ∈ (chartExceptional R x t)^j, w -561      ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) a - (overlapSlope R t x)^d *562      beta.right b) ∈ (Ideal.span {overlapException R t x})^(j+1) := by563  obtain ⟨a, ha, b, hb, h⟩ := two_chart_layer_correction_zpow R t x hreg beta.right564    (beta_right_chartBase beta) beta.slope j d (by omega) w hw565  exact ⟨a, ha, b, hb, by rwa [selfZPow_natCast] at h⟩566 567/-! ### Gluing generators level by level -/568 569private theorem isUnit_mk_map {A C : Type} [CommRing A] [CommRing C] (f : A →+* C) (I : Ideal A)570    (J : Ideal C) (h : ∀ a ∈ I, f a ∈ J) (a : A) (ha : IsUnit (Ideal.Quotient.mk I a)) :571    IsUnit (Ideal.Quotient.mk J (f a)) :=572  ha.map (Ideal.quotientMap J f h)573 574private theorem injective_unit_mul_mul {Q : Type} [CommRing Q] (U g : Q) (hU : IsUnit U)575    (hg : Function.Injective (fun c : Q => g * c)) :576    Function.Injective (fun c : Q => (U * g) * c) := by577  obtain ⟨u, rfl⟩ := hU578  intro a b hab579  apply hg580  simpa [mul_assoc] using congrArg (fun y => (↑u⁻¹ : Q) * y) hab581 582private theorem exists_unit_eq_mul_of_span_eq {Q : Type} [CommRing Q] (g F : Q)583    (hg : Function.Injective (fun c : Q => g * c)) (h : Ideal.span {F} = Ideal.span {g}) :584    ∃ u : Qˣ, F = (u : Q) * g := by585  apply regular_principal_generators_associated Q g F586  · intro a b hab; apply hg; simpa [mul_comm] using hab587  · exact h.symm588 589private theorem chart_generator_step {A : Type} [CommRing A] (T : A) (j : ℕ) (hj : 1 ≤ j)590    (g g' F : A)591    (hg' : Ideal.span {Ideal.Quotient.mk ((Ideal.span {T})^j) g'} =592      Ideal.span {Ideal.Quotient.mk ((Ideal.span {T})^j) g})593    (hreg : Function.Injective (fun c : A ⧸ (Ideal.span {T})^j =>594      Ideal.Quotient.mk ((Ideal.span {T})^j) g * c))595    (hF : Ideal.span {Ideal.Quotient.mk ((Ideal.span {T})^j) F} =596      Ideal.span {Ideal.Quotient.mk ((Ideal.span {T})^j) g}) :597    ∃ w : A, IsUnit (Ideal.Quotient.mk ((Ideal.span {T})^(j+1)) w) ∧598      w * g' - F ∈ (Ideal.span {T})^j ∧599      Ideal.span {Ideal.Quotient.mk ((Ideal.span {T})^(j+1)) (w * g')} =600        Ideal.span {Ideal.Quotient.mk ((Ideal.span {T})^(j+1)) g'} := by601  obtain ⟨u1, hu1⟩ := exists_unit_eq_mul_of_span_eq _ _ hreg hg'602  obtain ⟨u, hu⟩ := exists_unit_eq_mul_of_span_eq _ _ hreg hF603  obtain ⟨w, hwu, hw⟩ := principal_power_unit_lift A T j hj604    ((u * u1⁻¹ : _ˣ) : A ⧸ (Ideal.span {T})^j) (Units.isUnit _)605  refine ⟨w, hwu, ?_, ?_⟩606  · rw [← Ideal.Quotient.eq, map_mul, hw, hu1, hu]607    simp only [Units.val_mul]608    rw [mul_assoc, Units.inv_mul_cancel_left]609  · obtain ⟨v, hv⟩ := hwu610    rw [map_mul, ← hv]611    exact Ideal.span_singleton_mul_left_unit v.isUnit _612 613private theorem span_mk_mul_eq_of_mul_one_add {S : Type} [CommRing S] (I : Ideal S)614    (a' a F g : S) (h : a' * (1 + a) - 1 ∈ I)615    (hF : Ideal.span {Ideal.Quotient.mk I F} = Ideal.span {Ideal.Quotient.mk I g}) :616    Ideal.span {Ideal.Quotient.mk I (a' * F)} = Ideal.span {Ideal.Quotient.mk I g} := by617  have h1 : Ideal.Quotient.mk I a' * Ideal.Quotient.mk I (1 + a) = 1 := by618    rw [← map_mul, ← sub_eq_zero, ← map_one (Ideal.Quotient.mk I), ← map_sub,619      Ideal.Quotient.eq_zero_iff_mem]620    exact h621  rw [map_mul]622  exact (Ideal.span_singleton_mul_left_unit ⟨⟨_, _, h1, by rw [mul_comm, h1]⟩, rfl⟩ _).trans hF623 624private theorem glued_step_combination {S : Type} [CommRing S] (J : Ideal S) (X aF Y P v γ β : S)625    (hv : aF - v * P ∈ J) (hcd : v - 1 - (γ - β) ∈ J) (h3 : X * (1 + γ) - 1 ∈ J)626    (h4 : Y * (1 + β) - 1 ∈ J) (h5 : (v - 1) * β ∈ J) : X * aF - Y * P ∈ J := by627  have : X * aF - Y * P = X * (aF - v * P) + P * (-(X * v) * (Y * (1 + β) - 1) +628      Y * (X * (1 + γ) - 1) + X * Y * ((v - 1 - (γ - β)) + (v - 1) * β)) := by ring629  rw [this]630  refine J.add_mem (J.mul_mem_left _ hv) (J.mul_mem_left _ ?_)631  exact J.add_mem (J.add_mem (J.mul_mem_left _ h4) (J.mul_mem_left _ h3))632    (J.mul_mem_left _ (J.add_mem hcd h5))633 634private theorem mul_mem_pow_succ {S : Type} [CommRing S] (I : Ideal S) {j : ℕ} (hj : 1 ≤ j)635    {a b : S} (ha : a ∈ I ^ j) (hb : b ∈ I ^ j) : a * b ∈ I ^ (j + 1) := by636  have := Ideal.mul_mem_mul ha hb637  rw [← pow_add] at this638  exact Ideal.pow_le_pow_right (by omega) this639 640/-- For `a ∈ I^j` (`j ≥ 1`), `1 + a` is invertible modulo `I^(j+1)` with inverse `≡ 1 mod I^j`. -/641private theorem exists_inv_one_add {S : Type} [CommRing S] (I : Ideal S) {j : ℕ} (hj : 1 ≤ j)642    {a : S} (ha : a ∈ I ^ j) : ∃ a' : S, a' * (1 + a) - 1 ∈ I ^ (j + 1) ∧ a' - 1 ∈ I ^ j := by643  have hn : IsNilpotent (Ideal.Quotient.mk (I ^ (j + 1)) a) :=644    ⟨2, by645      rw [← map_pow, Ideal.Quotient.eq_zero_iff_mem, pow_two]; exact mul_mem_pow_succ I hj ha ha⟩646  have hu := hn.isUnit_one_add647  obtain ⟨a', ha'⟩ :=648    Ideal.Quotient.mk_surjective ((hu.unit⁻¹ : (S ⧸ I ^ (j + 1))ˣ) : S ⧸ I ^ (j + 1))649  have h1 : a' * (1 + a) - 1 ∈ I ^ (j + 1) := by650    rw [← Ideal.Quotient.eq_zero_iff_mem, map_sub, map_mul, ha', map_add, map_one,651      hu.val_inv_mul, sub_self]652  refine ⟨a', h1, ?_⟩653  rw [show a' - 1 = (a' * (1 + a) - 1) - a' * a by ring]654  exact Ideal.sub_mem _ (Ideal.pow_le_pow_right (Nat.le_succ j) h1) (Ideal.mul_mem_left _ _ ha)655 656/-- If `g` is regular modulo `I` and `F` generates the same ideal as `g` there, then a unit657multiple of `f F` is regular modulo `J` whenever `f g` is. -/658private theorem injective_mk_mul_of_span_eq {A C : Type} [CommRing A] [CommRing C] (f : A →+* C)659    (I : Ideal A) (J : Ideal C) (hIJ : ∀ a ∈ I, f a ∈ J) (g F : A) (z : C)660    (hz : IsUnit (Ideal.Quotient.mk J z))661    (hreg : Function.Injective (fun c : A ⧸ I => Ideal.Quotient.mk I g * c))662    (hF : Ideal.span {Ideal.Quotient.mk I F} = Ideal.span {Ideal.Quotient.mk I g})663    (hregJ : Function.Injective (fun c : C ⧸ J => Ideal.Quotient.mk J (f g) * c)) :664    Function.Injective (fun c : C ⧸ J => Ideal.Quotient.mk J (z * f F) * c) := by665  obtain ⟨u, hu⟩ := exists_unit_eq_mul_of_span_eq _ _ hreg hF666  obtain ⟨b, hb⟩ := Ideal.Quotient.mk_surjective (u : A ⧸ I)667  have hbu : IsUnit (Ideal.Quotient.mk J (f b)) :=668    isUnit_mk_map f I J hIJ b (by rw [hb]; exact u.isUnit)669  have hdiff : F - b * g ∈ I := by rw [← Ideal.Quotient.eq, map_mul, hb, hu]670  have hdiff' := hIJ _ hdiff671  rw [map_sub, ← Ideal.Quotient.eq, map_mul] at hdiff'672  have : Ideal.Quotient.mk J (z * f F) =673      (Ideal.Quotient.mk J z * Ideal.Quotient.mk J (f b)) * Ideal.Quotient.mk J (f g) := by674    rw [map_mul, hdiff', map_mul, mul_assoc]675  rw [this]676  exact injective_unit_mul_mul _ _ (hz.mul hbu) hregJ677 678/-- If `p ≡ u q` modulo `J` for a unit `u` and `b`, `z` are units modulo `J`, then `a p` is679congruent modulo `J` to some multiple of `z (b q)`. -/680private theorem exists_mul_sub_mul_mem {C : Type} [CommRing C] (J : Ideal C) (a b p q z : C)681    (hb : IsUnit (Ideal.Quotient.mk J b)) (hz : IsUnit (Ideal.Quotient.mk J z))682    (u : (C ⧸ J)ˣ) (hu : Ideal.Quotient.mk J p = u * Ideal.Quotient.mk J q) :683    ∃ v : C, a * p - v * (z * (b * q)) ∈ J := by684  obtain ⟨v, hv⟩ := Ideal.Quotient.mk_surjective685    (Ideal.Quotient.mk J a * (u : C ⧸ J) * ((hb.unit⁻¹ : (C ⧸ J)ˣ) : C ⧸ J) *686      ((hz.unit⁻¹ : (C ⧸ J)ˣ) : C ⧸ J))687  refine ⟨v, ?_⟩688  rw [← Ideal.Quotient.eq, map_mul, map_mul, map_mul, map_mul, hu, hv]689  have e1 := hb.mul_val_inv690  have e2 := hz.mul_val_inv691  linear_combination (Ideal.Quotient.mk J a * (u : C ⧸ J) * Ideal.Quotient.mk J q) *692    (-(Ideal.Quotient.mk J z * ((hz.unit⁻¹ : (C ⧸ J)ˣ) : C ⧸ J)) * e1 - e2)693 694/-- One step of the gluing: chart representatives `FA`, `FB` of the level-`j` generators that agree695on the overlap modulo the `j`-th exceptional power can be corrected, modulo the `j`-th powers, to696representatives of the level-`(j + 1)` generators agreeing modulo the `(j + 1)`-st power. -/697private theorem glued_generators_succ (R : Type) [CommRing R] (t x : R)698    (beta : BlowupRestriction R t x) (hreg : RegularParameterPair R t x) (d : ℕ)699    (gA : ℕ → BlowupChart R t x) (gB : ℕ → BlowupChart R x t)700    (hA : ∀ j : ℕ, Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA (j+1))} =701      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA j)})702    (hB : ∀ j : ℕ, Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB (j+1))} =703      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB j)})704    (hregA : ∀ j : ℕ, Function.Injective (fun c : BlowupChart R t x ⧸ (chartExceptional R t x)^j =>705      Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA j) * c))706    (hregBc : ∀ j : ℕ, Function.Injective (fun c : BlowupChart R x t ⧸ (chartExceptional R x t)^j =>707      Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB j) * c))708    (hoverlap : ∀ j : ℕ,709      Ideal.span {Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j)710                    ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (gA j))} =711      Ideal.span {Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j) (beta.right (gB j))})712    (hregC : ∀ j : ℕ, Function.Injective (fun c : BlowupOverlap R t x ⧸713      (Ideal.span {overlapException R t x})^j =>714      Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j) (beta.right (gB j)) * c))715    (j : ℕ) (hj : 1 ≤ j) (FA : BlowupChart R t x) (FB : BlowupChart R x t)716    (hIA : Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) FA} =717      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA j)})718    (hIB : Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) FB} =719      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB j)})720    (hIC : (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) FA - (overlapSlope R t x)^d *721      beta.right FB ∈ (Ideal.span {overlapException R t x})^j) :722    ∃ (FA' : BlowupChart R t x) (FB' : BlowupChart R x t), FA' - FA ∈ (chartExceptional R t x)^j ∧723      FB' - FB ∈ (chartExceptional R x t)^j ∧724      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^(j+1)) FA'} =725      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^(j+1)) (gA (j+1))} ∧726      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^(j+1)) FB'} =727      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^(j+1)) (gB (j+1))} ∧728      (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) FA' - (overlapSlope R t x)^d *729      beta.right FB' ∈ (Ideal.span {overlapException R t x})^(j+1) := by730  set α := algebraMap (BlowupChart R t x) (BlowupOverlap R t x) with hα731  set E := Ideal.span {overlapException R t x} with hE732  set Z := overlapSlope R t x with hZ733  have TA : ∀ m (a : BlowupChart R t x), a ∈ (chartExceptional R t x)^m → α a ∈ E^m :=734    algebraMap_mem_overlap_pow735  have TB : ∀ m (b : BlowupChart R x t), b ∈ (chartExceptional R x t)^m → beta.right b ∈ E^m :=736    beta_right_mem_overlap_pow beta737  have hZu : ∀ m, IsUnit (Ideal.Quotient.mk (E^m) (Z^d)) :=738    fun _ => ((IsLocalization.Away.algebraMap_isUnit _).pow d).map _739  -- normalize the level-`(j + 1)` generators on each chart740  obtain ⟨wA, hwAu, hwA, hwAI⟩ := chart_generator_step (chartBase R t x t) j hj (gA j)741    (gA (j+1)) FA (hA j) (hregA j) hIA742  obtain ⟨wB, hwBu, hwB, hwBI⟩ := chart_generator_step (chartBase R x t x) j hj (gB j)743    (gB (j+1)) FB (hB j) (hregBc j) hIB744  -- the transition unit `v` between the normalized representatives on the overlap745  obtain ⟨u2, hu2⟩ := exists_unit_eq_mul_of_span_eq _ _ (hregC (j+1)) (hoverlap (j+1))746  obtain ⟨v, hv⟩ := exists_mul_sub_mul_mem (E^(j+1)) (α wA) (beta.right wB) (α (gA (j+1)))747    (beta.right (gB (j+1))) (Z^d)748    (isUnit_mk_map beta.right.toRingHom _ _ (fun y hy => TB (j+1) y hy) wB hwBu) (hZu _) u2 hu2749  rw [← map_mul, ← map_mul] at hv750  have hv1 : v - 1 ∈ E^j := transition_unit_congruent_one R t x beta d j FA _ FB _ hwA hwB hIC751    (injective_mk_mul_of_span_eq beta.right.toRingHom _ _ (fun y hy => TB j y hy) _ FB _752      (hZu j) (hregBc j) hIB (hregC j))753    v (Ideal.pow_le_pow_right (Nat.le_succ j) hv)754  -- correct `v` by a Čech coboundary `c - d1`755  obtain ⟨c, hc, d1, hd1, hcd⟩ :=756    two_chart_layer_correction_positive R t x beta hreg j 0 (v - 1) hv1757  rw [pow_zero, one_mul] at hcd758  obtain ⟨c', hc'1, hc'2⟩ := exists_inv_one_add _ hj hc759  obtain ⟨d', hd'1, hd'2⟩ := exists_inv_one_add _ hj hd1760  refine ⟨c' * (wA * gA (j+1)), d' * (wB * gB (j+1)), ?_, ?_, ?_, ?_, ?_⟩761  · rw [show c' * (wA * gA (j+1)) - FA = (c' - 1) * (wA * gA (j+1)) + (wA * gA (j+1) - FA) by762      ring]763    exact Ideal.add_mem _ (Ideal.mul_mem_right _ _ hc'2) hwA764  · rw [show d' * (wB * gB (j+1)) - FB = (d' - 1) * (wB * gB (j+1)) + (wB * gB (j+1) - FB) by765      ring]766    exact Ideal.add_mem _ (Ideal.mul_mem_right _ _ hd'2) hwB767  · exact span_mk_mul_eq_of_mul_one_add _ c' c _ (gA (j+1)) hc'1 hwAI768  · exact span_mk_mul_eq_of_mul_one_add _ d' d1 _ (gB (j+1)) hd'1 hwBI769  · have h3 := TA (j+1) _ hc'1770    have h4 := TB (j+1) _ hd'1771    rw [map_sub, map_mul, map_add, map_one] at h3 h4772    rw [map_mul α c', map_mul beta.right d', mul_left_comm (Z^d)]773    exact glued_step_combination _ (α c') _ (beta.right d') _ v (α c) (beta.right d1) hv hcd h3 h4774      (mul_mem_pow_succ E hj hv1 (TB j d1 hd1))775 776/-- Compatible systems of chart generators `gA`, `gB` that are regular, agree on the overlap and are777normalized at level one can be replaced by glued generators generating the same ideals at every778level. -/779theorem glued_generators_exist (R : Type) [CommRing R] (t x : R) (beta : BlowupRestriction R t x)Lemma 4.3780    (hreg : RegularParameterPair R t x) (d : ℕ)781    (gA : ℕ → BlowupChart R t x) (gB : ℕ → BlowupChart R x t)782    (hA : ∀ j : ℕ, Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA (j+1))} =783      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA j)})784    (hB : ∀ j : ℕ, Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB (j+1))} =785      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB j)})786    (hregA : ∀ j : ℕ, Function.Injective (fun c : BlowupChart R t x ⧸ (chartExceptional R t x)^j =>787      Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA j) * c))788    (hregBc : ∀ j : ℕ, Function.Injective (fun c : BlowupChart R x t ⧸ (chartExceptional R x t)^j =>789      Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB j) * c))790    (hoverlap : ∀ j : ℕ,791      Ideal.span {Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j)792                    ((algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (gA j))} =793      Ideal.span {Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j) (beta.right (gB j))})794    (hregC : ∀ j : ℕ, Function.Injective (fun c : BlowupOverlap R t x ⧸795      (Ideal.span {overlapException R t x})^j =>796      Ideal.Quotient.mk ((Ideal.span {overlapException R t x})^j) (beta.right (gB j)) * c))797    (hnorm : ∃ u : Rˣ, (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) (gA 1) - algebraMap798      R (BlowupOverlap R t x) (u : R) * ((overlapSlope R t x)^d * beta.right (gB 1)) ∈799      (Ideal.span {overlapException R t x})) :800    ∃ G : GluedGenerators R t x beta d, ∀ j : ℕ,801      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (G.left j)} =802      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA j)} ∧803      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (G.right j)} =804      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB j)} := by805  let A := BlowupChart R t x806  let B := BlowupChart R x t807  let Inv : ℕ → A × B → Prop := fun j p =>808    Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) p.1} =809      Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (gA j)} ∧810    Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) p.2} =811      Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (gB j)} ∧812    algebraMap (BlowupChart R t x) (BlowupOverlap R t x) p.1 - (overlapSlope R t x)^d *813      beta.right p.2 ∈ (Ideal.span {overlapException R t x})^j814  have hstep : ∀ n : ℕ, ∀ p : {p : A × B // Inv (n+1) p}, ∃ q : A × B,815      (q.1 - p.1.1 ∈ (chartExceptional R t x)^(n+1) ∧816        q.2 - p.1.2 ∈ (chartExceptional R x t)^(n+1)) ∧ Inv (n+2) q := by817    intro n p818    obtain ⟨FA', FB', h1, h2, h3⟩ := glued_generators_succ R t x beta hreg d gA gB hA hB hregA819      hregBc hoverlap hregC (n+1) (by omega) p.1.1 p.1.2 p.2.1 p.2.2.1 p.2.2.2820    exact ⟨(FA', FB'), ⟨h1, h2⟩, h3⟩821  obtain ⟨FA1, FB1, h1⟩ := glued_generators_level_one R t x beta d (gA 1) (gB 1) hnorm822  choose next hnext using hstep823  let seq : ∀ n : ℕ, {p : A × B // Inv (n+1) p} := fun n =>824    Nat.rec ⟨(FA1, FB1), h1⟩ (fun n p => ⟨next n p, (hnext n p).2⟩) n825  let left : ℕ → A := fun j => match j with | 0 => gA 0 | n+1 => (seq n).1.1826  let right : ℕ → B := fun j => match j with | 0 => gB 0 | n+1 => (seq n).1.2827  refine ⟨⟨left, right, ?_, ?_, ?_⟩, ?_⟩ <;> rintro (_ | n)828  · simp829  · exact (hnext n (seq n)).1.1830  · simp831  · exact (hnext n (seq n)).1.2832  · simp833  · exact (seq n).2.2.2834  · exact ⟨rfl, rfl⟩835  · exact ⟨(seq n).2.1, (seq n).2.2.1⟩836 837/-! ### Transport of transversality and finite contact along completion isomorphisms -/838 839section TransportCompletion840 841variable {S T : Type} [CommRing S] [CommRing T]842 843private theorem injective_mk_mul_iff (g e : S) :844    Function.Injective (fun a : S ⧸ Ideal.span {g} => Ideal.Quotient.mk (Ideal.span {g}) e * a) ↔845      ∀ a, e * a ∈ Ideal.span {g} → a ∈ Ideal.span {g} := by846  constructor847  · intro h a ha848    rw [← Ideal.Quotient.eq_zero_iff_mem]849    apply h850    simp only [mul_zero]851    rw [← map_mul, Ideal.Quotient.eq_zero_iff_mem]852    exact ha853  · intro h a b hab854    induction a using Quotient.inductionOn' with | h a => ?_855    induction b using Quotient.inductionOn' with | h b => ?_856    change Ideal.Quotient.mk _ a = Ideal.Quotient.mk _ b857    change Ideal.Quotient.mk _ e * Ideal.Quotient.mk _ a =858      Ideal.Quotient.mk _ e * Ideal.Quotient.mk _ b at hab859    rw [← map_mul, ← map_mul, Ideal.Quotient.eq] at hab860    rw [Ideal.Quotient.eq]861    apply h862    rw [mul_sub]; exact hab863 864/-- Transversality transports along a ring isomorphism `Θ` sending the parameter `e` to a unit865multiple of `eT`: if multiplication by `e` is injective modulo `g`, then multiplication by `eT` is866injective modulo `Θ g`. -/867theorem mul_injective_quotient_transport (Θ : S ≃+* T) {g e : S} {eT u : T} (hu : IsUnit u)868    (he : Θ e * u = eT)869    (h : Function.Injective870      (fun a : S ⧸ Ideal.span {g} => Ideal.Quotient.mk (Ideal.span {g}) e * a)) :871    Function.Injective872      (fun a : T ⧸ Ideal.span {Θ g} => Ideal.Quotient.mk (Ideal.span {Θ g}) eT * a) := by873  rw [injective_mk_mul_iff] at h ⊢874  intro b hb875  rw [← he, mul_assoc, Ideal.mem_span_singleton] at hb876  have h1 := h (Θ.symm (u * b)) (Ideal.mem_span_singleton.mpr (by simpa using map_dvd Θ.symm hb))877  rw [Ideal.mem_span_singleton, ← hu.dvd_mul_left]878  simpa using map_dvd Θ (Ideal.mem_span_singleton.mp h1)879 880private theorem sup_pow_le (I J : Ideal S) (j : ℕ) : (I ⊔ J) ^ j ≤ I ⊔ J ^ j := by881  induction j with882  | zero => simp883  | succ n ih =>884    calc (I ⊔ J) ^ (n+1) = (I ⊔ J) * (I ⊔ J) ^ n := pow_succ' _ _885      _ ≤ (I ⊔ J) * (I ⊔ J ^ n) := Ideal.mul_mono_right ih886      _ ≤ I ⊔ J ^ (n+1) := by887        rw [Ideal.sup_mul, Ideal.mul_sup, Ideal.mul_sup, pow_succ']888        exact sup_le (sup_le (le_sup_of_le_left Ideal.mul_le_right)889          (le_sup_of_le_left Ideal.mul_le_left))890          (sup_le (le_sup_of_le_left Ideal.mul_le_right) le_sup_right)891 892private theorem exists_pow_le_span_pair {M : Ideal S} {g e : S}893    (h : ∃ L, M ^ L ≤ Ideal.span {g, e ^ 1}) (j : ℕ) : ∃ L, M ^ L ≤ Ideal.span {g, e ^ j} := by894  obtain ⟨L, hL⟩ := h895  refine ⟨L * j, ?_⟩896  rw [pow_mul]897  refine (Ideal.pow_right_mono hL j).trans ?_898  rw [Ideal.span_insert, Ideal.span_insert, pow_one, ← Ideal.span_singleton_pow]899  exact sup_pow_le _ _ j900 901/-- Finite contact transports along a ring isomorphism `Θ` sending the parameter `e` to a unit902multiple of `eT`: if a power of `MS` lies in `(g, e)` and `MT ⊆ Θ(MS)`, then for every `j` a power903of `MT` lies in `(Θ g, eT^j)`. -/904theorem exists_pow_le_span_pair_transport (Θ : S ≃+* T) {g e : S} {eT u : T} (hu : IsUnit u)905    (he : Θ e * u = eT) {MS : Ideal S} {MT : Ideal T} (hM : MT ≤ MS.map Θ)906    (h : ∃ L, MS ^ L ≤ Ideal.span {g, e ^ 1}) (j : ℕ) :907    ∃ L, MT ^ L ≤ Ideal.span {Θ g, eT ^ j} := by908  refine exists_pow_le_span_pair ?_ j909  obtain ⟨L, hL⟩ := h910  refine ⟨L, (Ideal.pow_right_mono hM L).trans ?_⟩911  rw [← Ideal.map_pow]912  refine (Ideal.map_mono hL).trans ?_913  rw [Ideal.map_span, Set.image_pair, Ideal.span_le]914  rintro _ (rfl | rfl)915  · exact Ideal.subset_span (Set.mem_insert _ _)916  · obtain ⟨v, rfl⟩ := hu917    have : Θ e = eT * ↑v⁻¹ := by rw [← he, mul_assoc, Units.mul_inv, mul_one]918    simp only [this, pow_one]919    exact Ideal.mul_mem_right _ _ (Ideal.subset_span (Set.mem_insert_of_mem _ rfl))920 921end TransportCompletion922 923/-- The maximal ideal of `A_P` generates in the completion `(A_P)^` the extension of `P`. -/924theorem map_maximalIdeal_localCompletion {A : Type} [CommRing A] (P : Ideal A) [P.IsPrime] :925    (IsLocalRing.maximalIdeal (Localization.AtPrime P)).map926        (localCompletionMap (Localization.AtPrime P)) =927      P.map (completedPointMap A P) := by928  calc _ = (P.map (algebraMap A (Localization.AtPrime P))).map929          (localCompletionMap (Localization.AtPrime P)) := by930        rw [Localization.AtPrime.map_eq_maximalIdeal]931    _ = _ := by rw [Ideal.map_map]; rfl932 933/-- A ring isomorphism `Θ : (B_Q)^ ≃ (A_P)^` compatible with `f : A → B` carries the extension of934`f(P)` to the maximal ideal of `(A_P)^`. -/935theorem map_maximalIdeal_localCompletion_transport {A B : Type} [CommRing A] [CommRing B]936    (f : A →+* B) (P : Ideal A) (Q : Ideal B) [P.IsPrime] [Q.IsPrime]937    (Θ : CompletedLocalAt B Q ≃+* CompletedLocalAt A P)938    (hΘ : ∀ a, Θ (completedPointMap B Q (f a)) = completedPointMap A P a) :939    ((P.map f).map (completedPointMap B Q)).map (Θ : _ →+* _) =940      (IsLocalRing.maximalIdeal (Localization.AtPrime P)).map (localCompletionMap _) := by941  rw [map_maximalIdeal_localCompletion, Ideal.map_map, Ideal.map_map]942  exact congrArg (Ideal.map · P) (RingHom.ext hΘ)943 944/-- For a ring isomorphism `Θ : (B_Q)^ ≃ (A_{f⁻¹Q})^` compatible with `f : A → B`, the maximal ideal945of `(A_{f⁻¹Q})^` is contained in the image under `Θ` of the maximal ideal of `(B_Q)^`. -/946theorem map_maximalIdeal_localCompletion_comap_le {A B : Type} [CommRing A] [CommRing B]947    (f : A →+* B) (Q : Ideal B) [Q.IsPrime]948    (Θ : CompletedLocalAt B Q ≃+* CompletedLocalAt A (Q.comap f))949    (hΘ : ∀ a, Θ (completedPointMap B Q (f a)) = completedPointMap A (Q.comap f) a) :950    (IsLocalRing.maximalIdeal (Localization.AtPrime (Q.comap f))).map (localCompletionMap _) ≤951      ((IsLocalRing.maximalIdeal (Localization.AtPrime Q)).map (localCompletionMap _)).map952        (Θ : _ →+* _) := by953  rw [← map_maximalIdeal_localCompletion_transport f _ Q Θ hΘ, map_maximalIdeal_localCompletion Q]954  exact Ideal.map_mono (Ideal.map_mono Ideal.map_comap_le)955 956/-- Chart-independent form of the strict-transform equation: let `P` be finitely many distinct957maximal ideals of a noetherian ring `A` containing `z`, with local equations `g` of finite contact958with `z`, and let `F` be generators of the level kernels, `(F j) + (z)^j = ⋂ (g, z^j)`. If959`y ≡ z^d F j mod z^j` for every `j` and `z`, `g` form a regular sequence in `(A_P)^`, then960`y = z^d · g · unit` in `(A_P)^`. -/961theorem strict_transform_equation_of_kernels {A ι : Type} [CommRing A] [IsNoetherianRing A]962    [Finite ι] (P : ι → Ideal A) [∀ s, (P s).IsMaximal] (hP : Function.Injective P) (z : A)963    (hz : ∀ s, z ∈ P s) (g : ∀ s, CompletedLocalAt A (P s))964    (hfin : ∀ j s, ∃ L, ((IsLocalRing.maximalIdeal (Localization.AtPrime (P s))).map965      (localCompletionMap _)) ^ L ≤ finiteLocalCurveIdeal A (P s) z (g s) j)966    (F : ℕ → A) (hF : ∀ j, Ideal.span {F j} ⊔ Ideal.span {z} ^ j =967      finiteSupportKernel A ι P (fun s => finiteLocalCurveIdeal A (P s) z (g s) j))968    (d : ℕ) (y : A) (hy : ∀ j, y - z ^ d * F j ∈ Ideal.span {z} ^ j) (s : ι)969    [IsNoetherianRing (CompletedLocalAt A (P s))]970    (hereg : Function.Injective971      (fun a : CompletedLocalAt A (P s) => completedPointMap A (P s) z * a))972    (hgreg : Function.Injective (fun a : CompletedLocalAt A (P s) ⧸973      Ideal.span {completedPointMap A (P s) z} =>974      Ideal.Quotient.mk (Ideal.span {completedPointMap A (P s) z}) (g s) * a)) :975    ∃ v : (CompletedLocalAt A (P s))ˣ, completedPointMap A (P s) y =976      completedPointMap A (P s) z ^ d * g s * (v : CompletedLocalAt A (P s)) := by977  set φ := completedPointMap A (P s)978  have he : φ z ∈ IsLocalRing.maximalIdeal (CompletedLocalAt A (P s)) := by979    have h1 : algebraMap A (Localization.AtPrime (P s)) z ∈980        IsLocalRing.maximalIdeal (Localization.AtPrime (P s)) := by981      rw [Localization.AtPrime.map_eq_maximalIdeal.symm]982      exact Ideal.mem_map_of_mem _ (hz s)983    have := AdicCompletion.algebraMap_isLocalHom_of_fg (R := Localization.AtPrime (P s))984      (IsNoetherian.noetherian _)985    have : IsLocalHom (localCompletionMap (Localization.AtPrime (P s))) := this986    exact map_nonunit (localCompletionMap (Localization.AtPrime (P s))) _ h1987  refine strict_transform_equation_from_levels _ (φ z) (g s) he hereg hgreg d (fun j => φ (F j))988    (fun j => ?_) _ (fun j => ?_)989  · have hrec := finite_support_completion_recovers A ι P hP (fun s => (hfin j s).choose) _990      (fun s => (hfin j s).choose_spec) s991    rw [← hF, Ideal.map_sup, Ideal.map_span, Ideal.map_pow, Ideal.map_span, Set.image_singleton,992      Set.image_singleton, Ideal.span_singleton_pow, finiteLocalCurveIdeal] at hrec993    rw [← hrec, Ideal.span_insert]994  · have := Ideal.mem_map_of_mem φ (hy j)995    rw [Ideal.map_pow, Ideal.map_span, Set.image_singleton, Ideal.span_singleton_pow] at this996    simpa [map_sub, map_mul, map_pow] using this997 998/-! ### Two-chart curve data -/999 1000/-- At every point of the first chart in two-chart curve data, the exceptional parameter is a1001nonzerodivisor modulo the local equation, and some power of the maximal ideal of the completion lies1002in the level-`j` local curve ideal. -/1003theorem two_chart_left_data_transverse_finite (R : Type) [CommRing R] (t x : R)1004    (beta : BlowupRestriction R t x) (D : TwoChartCurveData R t x beta) (j : ℕ) :1005    (∀ s, Function.Injective (fun a : CompletedLocalAt (BlowupChart R t x) (leftPoint D s) ⧸1006      Ideal.span {leftData D s} => Ideal.Quotient.mk (Ideal.span {leftData D s})1007      (completedPointMap (BlowupChart R t x) (leftPoint D s) (chartBase R t x t)) * a)) ∧ ∀ s, ∃ L :1008      ℕ, ((IsLocalRing.maximalIdeal (Localization.AtPrime (leftPoint D s))).map (localCompletionMap1009      (Localization.AtPrime (leftPoint D s))))^L ≤ leftLevelIdeal D j s := by1010  have he (i : D.ι) : D.leftIso i (completedPointMap _ (D.Q i) (overlapException R t x)) * 1 =1011      completedPointMap _ (leftPoint D (.inl i)) (chartBase R t x t) :=1012    (mul_one _).trans (D.leftIso_compat i _)1013  constructor1014  · rintro (i | k)1015    · exact mul_injective_quotient_transport (D.leftIso i) isUnit_one (he i) (D.transverse i)1016    · exact D.transverse0 k1017  · rintro (i | k)1018    · exact exists_pow_le_span_pair_transport (D.leftIso i) isUnit_one (he i)1019        (map_maximalIdeal_localCompletion_comap_le _ _ _ (D.leftIso_compat i)) (D.finite i) j1020    · exact exists_pow_le_span_pair (D.finite0 k) j1021 1022/-- The points of the first chart in two-chart curve data are distinct maximal ideals lying on the1023exceptional divisor. -/1024theorem two_chart_left_points_maximal (R : Type) [CommRing R] (t x : R)1025    (beta : BlowupRestriction R t x) (D : TwoChartCurveData R t x beta)1026    [(Ideal.span ({t,x} : Set R)).IsMaximal] :1027    (∀ s, (leftPoint D s).IsMaximal) ∧ Function.Injective (leftPoint D) ∧ ∀ s, chartBase R t x t ∈1028      leftPoint D s := by1029  have key : ∀ i, ((D.Q i).comap (algebraMap (BlowupChart R t x) (BlowupOverlap R t x))).IsMaximal ∧1030      chartSlope R t x ∉ (D.Q i).comap (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) ∧1031      chartBase R t x t ∈ (D.Q i).comap (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) :=1032    fun i => overlap_exceptional_point_comap_maximal R t x (D.Q i) (D.onE i)1033  refine ⟨?_, ?_, ?_⟩1034  · rintro (i | k)1035    · exact (key i).11036    · exact D.maximal0 k1037  · rintro (i | i) (j | j) h1038    · congr 11039      apply D.inj1040      have h' : (D.Q i).comap (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) =1041          (D.Q j).comap (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) := h1042      have := congrArg (Ideal.map (algebraMap (BlowupChart R t x) (BlowupOverlap R t x))) h'1043      rwa [IsLocalization.map_under (Submonoid.powers (chartSlope R t x)),1044        IsLocalization.map_under (Submonoid.powers (chartSlope R t x))] at this1045    · exfalso1046      have h' : (D.Q i).comap (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) = D.P0 j := h1047      exact (key i).2.1 (h' ▸ D.slope0 j)1048    · exfalso1049      have h' : D.P0 i = (D.Q j).comap (algebraMap (BlowupChart R t x) (BlowupOverlap R t x)) := h1050      exact (key j).2.1 (h' ▸ D.slope0 i)1051    · congr 11052      exact D.inj0 h1053  · rintro (i | k)1054    · exact (key i).2.21055    · exact D.onE0 k1056 1057/-- At a point of the first chart, the pullback of the surface function `f` factors in the completed1058local ring as `tᵈ · (local equation) · unit`. -/1059theorem strict_transform_left_point_equation (R : Type) [CommRing R] (t x : R)1060    [(Ideal.span ({t,x} : Set R)).IsMaximal] [IsNoetherianRing (BlowupChart R t x)]1061    [IsNoetherianRing (BlowupChart R x t)] (beta : BlowupRestriction R t x)1062    (D : TwoChartCurveData R t x beta) (d : ℕ) (G : GluedGenerators R t x beta d)1063    (hG : ∀ j : ℕ, Ideal.span {Ideal.Quotient.mk ((chartExceptional R t x)^j) (G.left j)} =1064      leftLevelKernel D j ∧ Ideal.span {Ideal.Quotient.mk ((chartExceptional R x t)^j) (G.right j)}1065      = rightLevelKernel D j)1066    (f : R)1067    (hf : ∀ j : ℕ, surfaceToCechInput R t x j f =1068      (cechInputLattice R t x j).mkQ (gluedFunctionPair R t x G j))1069    (s : D.ι ⊕ D.ι0) [IsNoetherianRing (CompletedLocalAt (BlowupChart R t x) (leftPoint D s))]1070    (hereg : Function.Injective (fun a : CompletedLocalAt (BlowupChart R t x) (leftPoint D s) =>1071      completedPointMap (BlowupChart R t x) (leftPoint D s) (chartBase R t x t) * a))1072    (hgreg : Function.Injective (fun a : CompletedLocalAt (BlowupChart R t x) (leftPoint D s) ⧸1073      Ideal.span {completedPointMap (BlowupChart R t x) (leftPoint D s) (chartBase R t x t)} =>1074      Ideal.Quotient.mk1075      (Ideal.span {completedPointMap (BlowupChart R t x) (leftPoint D s) (chartBase R t x t)})1076      (leftData D s) * a)) :1077    ∃ v : (CompletedLocalAt (BlowupChart R t x) (leftPoint D s))ˣ, completedPointMap1078      (BlowupChart R t x) (leftPoint D s) (algebraMap R (BlowupChart R t x) f) =1079      (completedPointMap (BlowupChart R t x) (leftPoint D s) (chartBase R t x t))^d * leftData D s *1080      (v : CompletedLocalAt (BlowupChart R t x) (leftPoint D s)) := by1081  obtain ⟨hmax, hinj, hmem⟩ := two_chart_left_points_maximal R t x beta D1082  have : ∀ s, (leftPoint D s).IsMaximal := hmax1083  exact strict_transform_equation_of_kernels (leftPoint D) hinj _ hmem (leftData D)1084    (fun j => (two_chart_left_data_transverse_finite R t x beta D j).2) G.left1085    (fun j => (curve_ideal_lattice_eq_kernels R t x beta D d G hG j).1) d _1086    (glued_function_left_chart R t x beta d G f hf) s hereg hgreg1087 1088/-- At every point of the second chart in two-chart curve data, the exceptional parameter is a1089nonzerodivisor modulo the local equation, and some power of the maximal ideal of the completion lies1090in the level-`j` local curve ideal. -/1091theorem two_chart_right_data_transverse_finite (R : Type) [CommRing R] (t x : R)1092    (beta : BlowupRestriction R t x) (D : TwoChartCurveData R t x beta) (j : ℕ) :1093    (∀ s, Function.Injective (fun a : CompletedLocalAt (BlowupChart R x t) (rightPoint D s) ⧸1094      Ideal.span {rightData D s} => Ideal.Quotient.mk (Ideal.span {rightData D s})1095      (completedPointMap (BlowupChart R x t) (rightPoint D s) (chartBase R x t x)) * a)) ∧ ∀ s, ∃ L1096      : ℕ, ((IsLocalRing.maximalIdeal (Localization.AtPrime (rightPoint D s))).map1097      (localCompletionMap (Localization.AtPrime (rightPoint D s))))^L ≤ rightLevelIdeal D j s := by1098  -- `x = t · (x/t)` on the overlap, and the slope `x/t` is a unit there1099  have hu (i : D.ι) : IsUnit (D.rightIso i (completedPointMap _ (D.Q i) (overlapSlope R t x))) :=1100    ((IsLocalization.Away.algebraMap_isUnit _).map _).map _1101  have he (i : D.ι) : D.rightIso i (completedPointMap _ (D.Q i) (overlapException R t x)) *1102      D.rightIso i (completedPointMap _ (D.Q i) (overlapSlope R t x)) =1103      completedPointMap _ (rightPoint D (.inl i)) (chartBase R x t x) := by1104    rw [← map_mul, ← map_mul, ← beta_right_chartBase_self]1105    exact D.rightIso_compat i _1106  constructor1107  · rintro (i | l)1108    · exact mul_injective_quotient_transport (D.rightIso i) (hu i) (he i) (D.transverse i)1109    · exact D.transverseinf l1110  · rintro (i | l)1111    · exact exists_pow_le_span_pair_transport (D.rightIso i) (hu i) (he i)1112        (map_maximalIdeal_localCompletion_comap_le _ _ _ (D.rightIso_compat i)) (D.finite i) j1113    · exact exists_pow_le_span_pair (D.finiteinf l) j1114 1115end SurfaceBlowup