Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(AlgebraicGeometry): clean up erw and porting notes #22272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 18 additions & 27 deletions Mathlib/AlgebraicGeometry/AffineScheme.lean
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,26 @@ namespace AffineScheme
def Spec : CommRingCatᵒᵖ ⥤ AffineScheme :=
Scheme.Spec.toEssImage

-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11081): cannot automatically derive
/-! We copy over instances from `Scheme.Spec.toEssImage`. -/

instance Spec_full : Spec.Full := Functor.Full.toEssImage _

-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11081): cannot automatically derive
instance Spec_faithful : Spec.Faithful := Functor.Faithful.toEssImage _

-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11081): cannot automatically derive
instance Spec_essSurj : Spec.EssSurj := Functor.EssSurj.toEssImage (F := _)

/-- The forgetful functor `AffineScheme ⥤ Scheme`. -/
@[simps!]
def forgetToScheme : AffineScheme ⥤ Scheme :=
Scheme.Spec.essImageInclusion

-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11081): cannot automatically derive
/-! We copy over instances from `Scheme.Spec.essImageInclusion`. -/

instance forgetToScheme_full : forgetToScheme.Full :=
show (Scheme.Spec.essImageInclusion).Full from inferInstance
inferInstanceAs Scheme.Spec.essImageInclusion.Full

-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11081): cannot automatically derive
instance forgetToScheme_faithful : forgetToScheme.Faithful :=
show (Scheme.Spec.essImageInclusion).Faithful from inferInstance
inferInstanceAs Scheme.Spec.essImageInclusion.Faithful

/-- The global section functor of an affine scheme. -/
def Γ : AffineSchemeᵒᵖ ⥤ CommRingCat :=
Expand Down Expand Up @@ -609,13 +608,10 @@ theorem isLocalization_basicOpen :
(IsLocalization.isLocalization_iff_of_ringEquiv (Submonoid.powers f)
(asIso <| basicOpenSectionsToAffine hU f).commRingCatIsoToRingEquiv).mpr
convert StructureSheaf.IsLocalization.to_basicOpen _ f using 1
-- Porting note: more hand holding is required here, the next 4 lines were not necessary
delta StructureSheaf.openAlgebra
-- Porting note: more hand holding is required here, the next 3 lines were not necessary
congr 1
rw [RingEquiv.toRingHom_eq_coe, CategoryTheory.Iso.commRingCatIsoToRingEquiv_toRingHom, asIso_hom]
dsimp [CommRingCat.ofHom, RingHom.algebraMap_toAlgebra]
change (X.presheaf.map _ ≫ basicOpenSectionsToAffine hU f).hom = _
delta basicOpenSectionsToAffine
dsimp [CommRingCat.ofHom, RingHom.algebraMap_toAlgebra, ← CommRingCat.hom_comp,
basicOpenSectionsToAffine]
rw [hU.fromSpec.naturality_assoc, hU.fromSpec_app_self]
simp only [Category.assoc, ← Functor.map_comp, ← op_comp]
exact CommRingCat.hom_ext_iff.mp (StructureSheaf.toOpen_res _ _ _ _)
Expand Down Expand Up @@ -685,13 +681,10 @@ theorem basicOpen_basicOpen_is_basicOpen (g : Γ(X, X.basicOpen f)) :
have := isLocalization_basicOpen hU f
obtain ⟨x, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.surj'' (Submonoid.powers f) g
use f * x
rw [Algebra.smul_def, Scheme.basicOpen_mul, Scheme.basicOpen_mul, RingHom.algebraMap_toAlgebra]
rw [Scheme.basicOpen_res]
refine (inf_eq_left.mpr ?_).symm
-- Porting note: a little help is needed here
convert inf_le_left (α := X.Opens) using 1
apply Scheme.basicOpen_of_isUnit
apply
rw [Algebra.smul_def, Scheme.basicOpen_mul, Scheme.basicOpen_mul, RingHom.algebraMap_toAlgebra,
Scheme.basicOpen_res]
refine (inf_eq_left.mpr (inf_le_left.trans_eq (Scheme.basicOpen_of_isUnit _ ?_).symm)).symm
exact
Submonoid.leftInv_le_isUnit _
(IsLocalization.toInvSubmonoid (Submonoid.powers f) (Γ(X, X.basicOpen f))
_).prop
Expand Down Expand Up @@ -733,12 +726,8 @@ theorem isLocalization_stalk' (y : PrimeSpectrum Γ(X, U)) (hy : hU.fromSpec.bas
(S := X.presheaf.stalk (hU.fromSpec.base y)) _ y.asIdeal.primeCompl _
(TopCat.Presheaf.algebra_section_stalk X.presheaf ⟨hU.fromSpec.base y, hy⟩) _ _
(asIso <| hU.fromSpec.stalkMap y).commRingCatIsoToRingEquiv).mpr
-- Porting note: need to know what the ring is and after convert, instead of equality
-- we get an `iff`.
convert StructureSheaf.IsLocalization.to_stalk Γ(X, U) y using 1
delta IsLocalization.AtPrime StructureSheaf.stalkAlgebra
rw [iff_iff_eq]
congr 2
rw [RingHom.algebraMap_toAlgebra, RingEquiv.toRingHom_eq_coe,
CategoryTheory.Iso.commRingCatIsoToRingEquiv_toRingHom, asIso_hom, ← CommRingCat.hom_comp,
Scheme.stalkMap_germ, IsAffineOpen.fromSpec_app_self, Category.assoc, TopCat.Presheaf.germ_res]
Expand Down Expand Up @@ -979,7 +968,8 @@ is the zero locus in terms of the prime spectrum of `Γ(X, ⊤)`. -/
lemma isoSpec_image_zeroLocus [IsAffine X]
(s : Set Γ(X, ⊤)) :
X.isoSpec.hom.base '' X.zeroLocus s = PrimeSpectrum.zeroLocus s := by
erw [← X.toSpecΓ_preimage_zeroLocus, Set.image_preimage_eq]
rw [← X.toSpecΓ_preimage_zeroLocus]
erw [Set.image_preimage_eq]
exact (bijective_of_isIso X.isoSpec.hom.base).surjective

lemma toSpecΓ_image_zeroLocus [IsAffine X] (s : Set Γ(X, ⊤)) :
Expand Down Expand Up @@ -1010,15 +1000,16 @@ lemma eq_zeroLocus_of_isClosed_of_isAffine [IsAffine X] (s : Set X) :
obtain ⟨I, (hI : Z = _)⟩ := (PrimeSpectrum.isClosed_iff_zeroLocus_ideal _).mp hZ
use I
simp only [← Scheme.toSpecΓ_preimage_zeroLocus, ← hI, Z]
erw [Set.preimage_image_eq _ (bijective_of_isIso X.isoSpec.hom.base).injective]
symm
exact Set.preimage_image_eq _ (bijective_of_isIso X.isoSpec.hom.base).injective
· rintro ⟨I, rfl⟩
exact zeroLocus_isClosed X I.carrier

open Set.Notation in
lemma Opens.toSpecΓ_preimage_zeroLocus {X : Scheme.{u}} (U : X.Opens)
(s : Set Γ(X, U)) :
U.toSpecΓ.base ⁻¹' PrimeSpectrum.zeroLocus s = U.1 ↓∩ X.zeroLocus s := by
rw [toSpecΓ, Scheme.comp_base, TopCat.coe_comp, Set.preimage_comp, Spec.map_base]
rw [toSpecΓ, Scheme.comp_base, TopCat.coe_comp, Set.preimage_comp, Spec.map_base, hom_ofHom]
erw [PrimeSpectrum.preimage_comap_zeroLocus]
rw [Scheme.toSpecΓ_preimage_zeroLocus]
show _ = U.ι.base ⁻¹' (X.zeroLocus s)
Expand Down
7 changes: 4 additions & 3 deletions Mathlib/AlgebraicGeometry/Cover/Open.lean
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def affineCover (X : Scheme.{u}) : OpenCover X where
f x := x
covers := by
intro x
erw [TopCat.coe_comp] -- now `erw` after https://github.com/leanprover-community/mathlib4/pull/13170
simp only [LocallyRingedSpace.comp_toShHom, SheafedSpace.comp_base, TopCat.hom_comp,
ContinuousMap.coe_comp]
rw [Set.range_comp, Set.range_eq_univ.mpr, Set.image_univ]
· erw [Subtype.range_coe_subtype]
exact (X.local_affine x).choose.2
Expand Down Expand Up @@ -271,8 +272,8 @@ theorem affineBasisCover_map_range (X : Scheme.{u}) (x : X)
(r : (X.local_affine x).choose_spec.choose) :
Set.range (X.affineBasisCover.map ⟨x, r⟩).base =
(X.affineCover.map x).base '' (PrimeSpectrum.basicOpen r).1 := by
erw [TopCat.coe_comp]
rw [Set.range_comp]
simp only [affineBasisCover, Cover.bind_map, comp_coeBase, TopCat.hom_comp,
ContinuousMap.coe_comp, Set.range_comp]
-- Porting note: `congr` fails to see the goal is comparing image of the same function
refine congr_arg (_ '' ·) ?_
exact (PrimeSpectrum.localization_away_comap_range (Localization.Away r) r :)
Expand Down
1 change: 0 additions & 1 deletion Mathlib/AlgebraicGeometry/EllipticCurve/Affine.lean
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ lemma irreducible_polynomial [IsDomain R] : Irreducible W.polynomial := by
rw [Cubic.degree_of_a_ne_zero' <| neg_ne_zero.mpr <| one_ne_zero' R, degree_mul] at h0
apply (h1.symm.le.trans Cubic.degree_of_b_eq_zero').not_lt
rcases Nat.WithBot.add_eq_three_iff.mp h0.symm with h | h | h | h
-- Porting note: replaced two `any_goals` proofs with two `iterate 2` proofs
iterate 2 rw [degree_add_eq_right_of_degree_lt] <;> simp only [h] <;> decide
iterate 2 rw [degree_add_eq_left_of_degree_lt] <;> simp only [h] <;> decide

Expand Down
8 changes: 3 additions & 5 deletions Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ theorem isUnit_res_toΓSpecMapBasicOpen : IsUnit (X.toToΓSpecMapBasicOpen r r)
convert
(X.presheaf.map <| (eqToHom <| X.toΓSpecMapBasicOpen_eq r).op).hom.isUnit_map
(X.toRingedSpace.isUnit_res_basicOpen r)
-- Porting note: `rw [comp_apply]` to `erw [comp_apply]`
erw [← CommRingCat.comp_apply, ← Functor.map_comp]
rw [← CommRingCat.comp_apply, ← Functor.map_comp]
congr

/-- Define the sheaf hom on individual basic opens for the unit. -/
Expand Down Expand Up @@ -217,8 +216,8 @@ def toΓSpec : X ⟶ Spec.locallyRingedSpaceObj (Γ.obj (op X)) where
rw [he]
refine IsLocalization.map_units S (⟨r, ?_⟩ : p.asIdeal.primeCompl)
apply (not_mem_prime_iff_unit_in_stalk _ _ _).mpr
rw [← toStalk_stalkMap_toΓSpec]
erw [CommRingCat.comp_apply, ← he]
rw [← toStalk_stalkMap_toΓSpec, CommRingCat.comp_apply]
erw [← he]
rw [RingHom.map_mul]
exact ht.mul <| (IsLocalization.map_units (R := Γ.obj (op X)) S s).map _

Expand Down Expand Up @@ -249,7 +248,6 @@ theorem comp_ring_hom_ext {X : LocallyRingedSpace.{u}} {R : CommRingCat.{u}} {f
toOpen R (basicOpen r) ≫ β.c.app (op (basicOpen r))) :
X.toΓSpec ≫ Spec.locallyRingedSpaceMap f = β := by
ext1
-- Porting note: was `apply Spec.basicOpen_hom_ext`
refine Spec.basicOpen_hom_ext w ?_
intro r U
rw [LocallyRingedSpace.comp_c_app]
Expand Down
18 changes: 9 additions & 9 deletions Mathlib/AlgebraicGeometry/Gluing.lean
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def gluedScheme : Scheme := by
refine ⟨_, ((D.U i).affineCover.map y).toLRSHom ≫
D.toLocallyRingedSpaceGlueData.toGlueData.ι i, ?_⟩
constructor
· erw [TopCat.coe_comp] -- now `erw` after https://github.com/leanprover-community/mathlib4/pull/13170
rw [Set.range_comp]
· simp only [LocallyRingedSpace.comp_toShHom, SheafedSpace.comp_base, TopCat.hom_comp,
ContinuousMap.coe_comp, Set.range_comp]
refine Set.mem_image_of_mem _ ?_
exact (D.U i).affineCover.covers y
· infer_instance
Expand Down Expand Up @@ -167,7 +167,7 @@ theorem ι_jointly_surjective (x : 𝖣.glued.carrier) :
∃ (i : D.J) (y : (D.U i).carrier), (D.ι i).base y = x :=
𝖣.ι_jointly_surjective (forgetToTop ⋙ forget TopCat) x

-- Porting note: promote to higher priority to short circuit simplifier
/-- Promoted to higher priority to short circuit simplifier. -/
@[simp (high), reassoc]
theorem glue_condition (i j : D.J) : D.t i j ≫ D.f j i ≫ D.ι j = D.f i j ≫ D.ι i :=
𝖣.glue_condition i j
Expand Down Expand Up @@ -374,7 +374,8 @@ theorem fromGlued_open_map : IsOpenMap 𝒰.fromGlued.base := by
· rw [← Set.image_preimage_eq_inter_range]
apply (show IsOpenImmersion (𝒰.map (𝒰.f x)) from inferInstance).base_open.isOpenMap
convert hU (𝒰.f x) using 1
rw [← ι_fromGlued]; erw [TopCat.coe_comp]; rw [Set.preimage_comp]
simp only [← ι_fromGlued, gluedCover_U, comp_coeBase, TopCat.hom_comp, ContinuousMap.coe_comp,
Set.preimage_comp]
congr! 1
exact Set.preimage_image_eq _ 𝒰.fromGlued_injective
· exact ⟨hx, 𝒰.covers x⟩
Expand Down Expand Up @@ -420,22 +421,21 @@ def glueMorphisms {Y : Scheme} (f : ∀ x, 𝒰.obj x ⟶ Y)
· exact f
rintro ⟨i, j⟩
change pullback.fst _ _ ≫ f i = (_ ≫ _) ≫ f j
erw [pullbackSymmetry_hom_comp_fst]
simp [pullbackSymmetry_hom_comp_fst]
exact hf i j

@[simp, reassoc]
theorem ι_glueMorphisms {Y : Scheme} (f : ∀ x, 𝒰.obj x ⟶ Y)
(hf : ∀ x y, pullback.fst (𝒰.map x) (𝒰.map y) ≫ f x = pullback.snd _ _ ≫ f y)
(x : 𝒰.J) : 𝒰.map x ≫ 𝒰.glueMorphisms f hf = f x := by
rw [← ι_fromGlued, Category.assoc]
erw [IsIso.hom_inv_id_assoc, Multicoequalizer.π_desc]
rw [← ι_fromGlued, Category.assoc, glueMorphisms, IsIso.hom_inv_id_assoc]
erw [Multicoequalizer.π_desc]

theorem hom_ext {Y : Scheme} (f₁ f₂ : X ⟶ Y) (h : ∀ x, 𝒰.map x ≫ f₁ = 𝒰.map x ≫ f₂) : f₁ = f₂ := by
rw [← cancel_epi 𝒰.fromGlued]
apply Multicoequalizer.hom_ext
intro x
erw [Multicoequalizer.π_desc_assoc]
erw [Multicoequalizer.π_desc_assoc]
rw [fromGlued, Multicoequalizer.π_desc_assoc, Multicoequalizer.π_desc_assoc]
exact h x

end Cover
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/AlgebraicGeometry/IdealSheaf.lean
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ lemma glueDataObjMap_glueDataObjι {U V : X.affineOpens} (h : U ≤ V) :
Ideal.quotientMap_comp_mk, CommRingCat.ofHom_comp, Spec.map_comp_assoc, glueDataObjι,
Category.assoc]
congr 1
rw [Iso.eq_inv_comp, IsAffineOpen.isoSpec_hom]
rw [Iso.eq_inv_comp, IsAffineOpen.isoSpec_hom, CommRingCat.ofHom_hom]
erw [Scheme.Opens.toSpecΓ_SpecMap_map_assoc U.1 V.1 h]
rw [← IsAffineOpen.isoSpec_hom, Iso.hom_inv_id, Category.comp_id]

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/AlgebraicGeometry/Morphisms/ClosedImmersion.lean
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ lemma stalkMap_injective_of_isOpenMap_of_injective [CompactSpace X]
have h0 (i : 𝒰.J) : (𝒰.map i).appLE _ (W i) (by simp) (φ g) = 0 := by
rw [← Scheme.Hom.appLE_map _ _ (homOfLE <| hwle i).op, ← Scheme.Hom.map_appLE _ le_rfl w.op]
simp only [CommRingCat.comp_apply]
erw [hg]
rw [hg]
simp only [map_zero]
have h1 (i : 𝒰.J) : ∃ n, (res i) (φ (s ^ n * g)) = 0 := by
obtain ⟨n, hn⟩ := exists_of_res_zero_of_qcqs_of_top (s := ((res i) (φ s))) (h0 i)
Expand Down
8 changes: 2 additions & 6 deletions Mathlib/AlgebraicGeometry/OpenImmersion.lean
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,13 @@ instance pullback_snd_of_left : IsOpenImmersion (pullback.snd f g) := by

instance pullback_fst_of_right : IsOpenImmersion (pullback.fst g f) := by
rw [← pullbackSymmetry_hom_comp_snd]
-- Porting note: was just `infer_instance`, it is a bit weird that no explicit class instance is
-- provided but still class inference fail to find this
exact LocallyRingedSpace.IsOpenImmersion.comp (H := inferInstance) _ _
infer_instance

instance pullback_to_base [IsOpenImmersion g] :
IsOpenImmersion (limit.π (cospan f g) WalkingCospan.one) := by
rw [← limit.w (cospan f g) WalkingCospan.Hom.inl]
change IsOpenImmersion (_ ≫ f)
-- Porting note: was just `infer_instance`, it is a bit weird that no explicit class instance is
-- provided but still class inference fail to find this
exact LocallyRingedSpace.IsOpenImmersion.comp (H := inferInstance) _ _
infer_instance

instance forgetToTop_preserves_of_left : PreservesLimit (cospan f g) Scheme.forgetToTop := by
delta Scheme.forgetToTop
Expand Down
17 changes: 8 additions & 9 deletions Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Scheme.lean
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ open GradedAlgebra SetLike

open Finset hiding mk_zero

-- Porting note: _root_ doesn't work here
open HomogeneousLocalization

variable {𝒜}
Expand Down Expand Up @@ -339,9 +338,9 @@ theorem carrier.add_mem (q : Spec.T A⁰_ f) {a b : A} (ha : a ∈ carrier f_deg
letI l : A⁰_ f := HomogeneousLocalization.mk
⟨m * i, ⟨proj 𝒜 i a ^ j * proj 𝒜 i b ^ (m - j), ?_⟩,
⟨_, by rw [mul_comm]; mem_tac⟩, ⟨i, rfl⟩⟩
letI r : A⁰_ f := HomogeneousLocalization.mk
letI r : A⁰_ f := (HomogeneousLocalization.mk
⟨m * i, ⟨proj 𝒜 i b ^ m, by rw [← smul_eq_mul]; mem_tac⟩,
⟨_, by rw [mul_comm]; mem_tac⟩, ⟨i, rfl⟩⟩
⟨_, by rw [mul_comm]; mem_tac⟩, ⟨i, rfl⟩⟩)
l * r
else
letI l : A⁰_ f := HomogeneousLocalization.mk
Expand All @@ -353,8 +352,7 @@ theorem carrier.add_mem (q : Spec.T A⁰_ f) {a b : A} (ha : a ∈ carrier f_deg
l * r
rotate_left
· rw [(_ : m * i = _)]
-- Porting note: it seems unification with mul_mem is more fiddly reducing value of mem_tac
apply GradedMonoid.toGradedMul.mul_mem (i := j • i) (j := (m - j) • i) <;> mem_tac_aux
apply GradedMonoid.toGradedMul.mul_mem <;> mem_tac_aux
rw [← add_smul, Nat.add_sub_of_le h1]; rfl
· rw [(_ : m * i = _)]
apply GradedMonoid.toGradedMul.mul_mem (i := (j-m) • i) (j := (m + m - j) • i) <;> mem_tac_aux
Expand Down Expand Up @@ -393,14 +391,15 @@ theorem carrier.smul_mem (c x : A) (hx : x ∈ carrier f_deg q) : c • x ∈ ca
· rw [zero_smul]; exact carrier.zero_mem f_deg hm _
· rintro n ⟨a, ha⟩ i
simp_rw [proj_apply, smul_eq_mul, coe_decompose_mul_of_left_mem 𝒜 i ha]
-- Porting note: having trouble with Mul instance
let product : A⁰_ f :=
Mul.mul (HomogeneousLocalization.mk ⟨_, ⟨a ^ m, pow_mem_graded m ha⟩, ⟨_, ?_⟩, ⟨n, rfl⟩⟩)
(HomogeneousLocalization.mk ⟨_, ⟨proj 𝒜 (i - n) x ^ m, by mem_tac⟩, ⟨_, ?_⟩, ⟨i - n, rfl⟩⟩)
(HomogeneousLocalization.mk
⟨_, ⟨a ^ m, pow_mem_graded m ha⟩, ⟨_, ?_⟩, ⟨n, rfl⟩⟩ : A⁰_ f) *
(HomogeneousLocalization.mk
⟨_, ⟨proj 𝒜 (i - n) x ^ m, by mem_tac⟩, ⟨_, ?_⟩, ⟨i - n, rfl⟩⟩ : A⁰_ f)
· split_ifs with h
· convert_to product ∈ q.1
· dsimp [product]
erw [HomogeneousLocalization.ext_iff_val, HomogeneousLocalization.val_mk,
rw [HomogeneousLocalization.ext_iff_val, HomogeneousLocalization.val_mk,
HomogeneousLocalization.val_mul, HomogeneousLocalization.val_mk,
HomogeneousLocalization.val_mk]
· simp_rw [mul_pow]; rw [Localization.mk_mul]
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Topology.lean
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ theorem sup_vanishingIdeal_le (t t' : Set (ProjectiveSpectrum 𝒜)) :
rw [← HomogeneousIdeal.mem_iff, HomogeneousIdeal.toIdeal_sup, mem_vanishingIdeal,
Submodule.mem_sup]
rintro ⟨f, hf, g, hg, rfl⟩ x ⟨hxt, hxt'⟩
erw [mem_vanishingIdeal] at hf hg
rw [HomogeneousIdeal.mem_iff, mem_vanishingIdeal] at hf hg
apply Submodule.add_mem <;> solve_by_elim

theorem mem_compl_zeroLocus_iff_not_mem {f : A} {I : ProjectiveSpectrum 𝒜} :
Expand Down Expand Up @@ -316,9 +316,9 @@ theorem zeroLocus_vanishingIdeal_eq_closure (t : Set (ProjectiveSpectrum 𝒜))

theorem vanishingIdeal_closure (t : Set (ProjectiveSpectrum 𝒜)) :
vanishingIdeal (closure t) = vanishingIdeal t := by
have := (gc_ideal 𝒜).u_l_u_eq_u t
have : (vanishingIdeal (zeroLocus 𝒜 (vanishingIdeal t))).toIdeal = _ := (gc_ideal 𝒜).u_l_u_eq_u t
ext1
erw [zeroLocus_vanishingIdeal_eq_closure 𝒜 t] at this
rw [zeroLocus_vanishingIdeal_eq_closure 𝒜 t] at this
exact this

section BasicOpen
Expand Down Expand Up @@ -372,7 +372,7 @@ theorem basicOpen_eq_union_of_projection (f : A) :
basicOpen 𝒜 f = ⨆ i : ℕ, basicOpen 𝒜 (GradedAlgebra.proj 𝒜 i f) :=
TopologicalSpace.Opens.ext <|
Set.ext fun z => by
erw [mem_coe_basicOpen, TopologicalSpace.Opens.mem_sSup]
rw [mem_coe_basicOpen, mem_coe, iSup, TopologicalSpace.Opens.mem_sSup]
constructor <;> intro hz
· rcases show ∃ i, GradedAlgebra.proj 𝒜 i f ∉ z.asHomogeneousIdeal by
contrapose! hz with H
Expand Down
11 changes: 4 additions & 7 deletions Mathlib/AlgebraicGeometry/Restrict.lean
Original file line number Diff line number Diff line change
Expand Up @@ -529,16 +529,14 @@ theorem image_morphismRestrict_preimage {X Y : Scheme.{u}} (f : X ⟶ Y) (U : Y.
constructor
· rintro ⟨⟨x, hx⟩, hx' : (f ∣_ U).base _ ∈ V, rfl⟩
refine ⟨⟨_, hx⟩, ?_, rfl⟩
-- Porting note: this rewrite was not necessary
rw [SetLike.mem_coe]
convert hx'
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext1` is not compiling
refine Subtype.ext ?_
exact (morphismRestrict_base_coe f U ⟨x, hx⟩).symm
· rintro ⟨⟨x, hx⟩, hx' : _ ∈ V.1, rfl : x = _⟩
refine ⟨⟨_, hx⟩, (?_ : (f ∣_ U).base ⟨x, hx⟩ ∈ V.1), rfl⟩
convert hx'
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext1` is compiling
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext1` is not compiling
refine Subtype.ext ?_
exact morphismRestrict_base_coe f U ⟨x, hx⟩

Expand Down Expand Up @@ -636,8 +634,7 @@ def morphismRestrictRestrictBasicOpen {X Y : Scheme.{u}} (f : X ⟶ Y) (U : Y.Op
have e := Scheme.preimage_basicOpen U.ι r
rw [Scheme.Opens.ι_app] at e
rw [← U.toScheme.basicOpen_res_eq _ (eqToHom U.inclusion'_map_eq_top).op]
erw [← CommRingCat.comp_apply]
erw [← Y.presheaf.map_comp]
erw [← elementwise_of% Y.presheaf.map_comp]
rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
erw [← e]
ext1
Expand Down Expand Up @@ -758,8 +755,8 @@ def Scheme.OpenCover.restrict {X : Scheme.{u}} (𝒰 : X.OpenCover) (U : Opens X
U.toScheme.OpenCover := by
refine Cover.copy (𝒰.pullbackCover U.ι) 𝒰.J _ (𝒰.map · ∣_ U) (Equiv.refl _)
(fun i ↦ IsOpenImmersion.isoOfRangeEq (Opens.ι _) (pullback.snd _ _) ?_) ?_
· erw [IsOpenImmersion.range_pullback_snd_of_left U.ι (𝒰.map i)]
rw [Opens.opensRange_ι]
· dsimp only [Cover.pullbackCover_obj, Cover.pullbackCover_J, Equiv.refl_apply]
rw [IsOpenImmersion.range_pullback_snd_of_left U.ι (𝒰.map i), Opens.opensRange_ι]
exact Subtype.range_val
· intro i
rw [← cancel_mono U.ι]
Expand Down
Loading
Loading