import OAI.AlgebraicGeometry.AbhyankarSathaye.Identities import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Localization.Away.Basic namespace OAI /-! An explicit retraction proves saturation of the subring generated by `F + 1`. -/ noncomputable section namespace AbhyankarSathaye.CommutingDerivations /-- A retract of a domain is saturated by powers of any nonzero element of the retract. The maps and their left-inverse law are explicit hypotheses. -/ theorem retract_power_saturated {A B : Type*} [CommRing A] [IsDomain A] [CommRing B] (ι : B →+* A) (ρ : A →+* B) (hρι : ∀ b, ρ (ι b) = b) (b q : B) (a : A) (n : ℕ) (hb : ι b ≠ 0) (he : (ι b)^n * a = ι q) : a = ι (ρ a) := by apply mul_left_cancel₀ (pow_ne_zero n hb) calc (ι b)^n * a = ι q := he _ = (ι b)^n * ι (ρ a) := by have hh := congrArg ι (congrArg ρ he) simpa only [map_mul, map_pow, hρι] using hh.symm /-- The parameter inverted in the localization, `F + 1`. -/ def ambientParameter : R := F + 1 /-- Restriction to the line `(h,u,v,w)=(t,0,0,0)`. -/ def parameterSlice : R →ₐ[ℂ] Polynomial ℂ := MvPolynomial.aeval (fun i : Fin 4 => if i = 0 then Polynomial.X else 0) @[simp] theorem parameterSlice_parameter : parameterSlice ambientParameter = Polynomial.X := by simp [parameterSlice, ambientParameter, F, p, P, x, y, s, S, h, u, v, w] theorem parameterSlice_aeval : parameterSlice.comp (Polynomial.aeval ambientParameter) = AlgHom.id ℂ (Polynomial ℂ) := by apply Polynomial.algHom_ext simp @[simp] theorem parameterSlice_aeval_apply (q : Polynomial ℂ) : parameterSlice (Polynomial.aeval ambientParameter q) = q := by exact AlgHom.congr_fun parameterSlice_aeval q theorem parameter_aeval_injective : Function.Injective (Polynomial.aeval ambientParameter : Polynomial ℂ →ₐ[ℂ] R) := (show Function.LeftInverse parameterSlice (Polynomial.aeval ambientParameter : Polynomial ℂ →ₐ[ℂ] R) from parameterSlice_aeval_apply).injective theorem parameter_ne_zero : ambientParameter ≠ 0 := by intro hh have he := congrArg parameterSlice hh simp at he /-- Exact polynomial witness for descent from a Laurent expression. -/ theorem parameter_power_saturated (a : R) (q : Polynomial ℂ) (n : ℕ) (he : ambientParameter^n * a = Polynomial.aeval ambientParameter q) : a = Polynomial.aeval ambientParameter (parameterSlice a) := by apply mul_left_cancel₀ (pow_ne_zero n parameter_ne_zero) have hh := congrArg (Polynomial.aeval ambientParameter : Polynomial ℂ →ₐ[ℂ] R) (congrArg parameterSlice he) have hh' : ambientParameter^n * Polynomial.aeval ambientParameter (parameterSlice a) = Polynomial.aeval ambientParameter q := by simpa only [map_mul, map_pow, parameterSlice_parameter, parameterSlice_aeval_apply, Polynomial.aeval_X] using hh exact he.trans hh'.symm theorem parameter_localization_injective (L : Type*) [CommRing L] [Algebra R L] [IsLocalization.Away ambientParameter L] : Function.Injective (algebraMap R L) := by apply IsLocalization.injective L (M := Submonoid.powers ambientParameter) intro z hz obtain ⟨n, rfl⟩ := hz exact mem_nonZeroDivisors_of_ne_zero (pow_ne_zero n parameter_ne_zero) /-- Exact intersection with the ambient ring, in denominator-cleared form. The left side says that the localized image has a Laurent expression in `c`. The right side supplies an ordinary polynomial expression in `c`. There is no fraction-field-intersection hypothesis. -/ theorem parameter_laurent_intersection (L : Type*) [CommRing L] [Algebra R L] [IsLocalization.Away ambientParameter L] (a : R) : (∃ (n : ℕ) (q : Polynomial ℂ), (algebraMap R L ambientParameter)^n * algebraMap R L a = algebraMap R L (Polynomial.aeval ambientParameter q)) ↔ ∃ q : Polynomial ℂ, a = Polynomial.aeval ambientParameter q := by constructor · rintro ⟨n, q, hq⟩ refine ⟨parameterSlice a, parameter_power_saturated a q n ?_⟩ apply parameter_localization_injective L simpa only [map_mul, map_pow] using hq · rintro ⟨q, rfl⟩ exact ⟨0, q, by simp⟩ end AbhyankarSathaye.CommutingDerivations end end OAI