import OAI.AlgebraicGeometry.Divisors.LineBundles.RingPushoutKernel import Mathlib.AlgebraicGeometry.Morphisms.Flat import Mathlib.AlgebraicGeometry.Morphisms.ClosedImmersion /-! # Pullback Affine Kernel -/ namespace OAI.AlgebraicGeometry.Divisors.LineBundles.Closed.PullbackAffineKernel.BundleCycles noncomputable section /-! In an actual closed-immersion pullback, the equation ideal on an affine source chart is generated by the pulled-back affine base ideal. -/ open _root_.AlgebraicGeometry _root_.CategoryTheory variable {X Z X' Z' : Scheme.{0}} (i : Z ⟶ X) [IsClosedImmersion i] (j : Z' ⟶ X') (f : X' ⟶ X) (g : Z' ⟶ Z) (hp : IsPullback j g f i) (U : X.affineOpens) (V : X'.affineOpens) (hV : V.1 ≤ f ⁻¹ᵁ U.1) include hp in theorem closedPullback_affineChart_kernel : RingHom.ker (j.app V.1).hom = (RingHom.ker (i.app U.1).hom).map (f.appLE U.1 V.1 hV).hom := by have hg : j ⁻¹ᵁ V.1 ≤ g ⁻¹ᵁ (i ⁻¹ᵁ U.1) := by intro z hz have he : f (j z) = i (g z) := congrArg (fun k => k z) hp.w change i (g z) ∈ U.1 rw [← he] exact hV hz have hY : j ⁻¹ᵁ V.1 = j ⁻¹ᵁ V.1 ⊓ g ⁻¹ᵁ (i ⁻¹ᵁ U.1) := (inf_eq_left.mpr hg).symm let : IsIso (pushoutSection hp (show i ⁻¹ᵁ U.1 ≤ i ⁻¹ᵁ U.1 from le_rfl) hV hY) := isIso_pushoutSection_of_isAffineOpen hp le_rfl hV hY U.2 (U.2.preimage i) V.2 have H := (isIso_pushoutSection_iff hp (show i ⁻¹ᵁ U.1 ≤ i ⁻¹ᵁ U.1 from le_rfl) hV hY).mp inferInstance have H' : IsPushout (f.appLE U.1 V.1 hV) (i.app U.1) (j.app V.1) (g.appLE (i ⁻¹ᵁ U.1) (j ⁻¹ᵁ V.1) hg) := by simpa only [Scheme.Hom.appLE_eq_app] using H exact RingPushoutKernel.BundleCycles.ringPushout_kernel (i.app U.1) (f.appLE U.1 V.1 hV) (g.appLE (i ⁻¹ᵁ U.1) (j ⁻¹ᵁ V.1) hg) (j.app V.1) H'.flip (i.app_surjective U.1 U.2) end end OAI.AlgebraicGeometry.Divisors.LineBundles.Closed.PullbackAffineKernel.BundleCycles