File: Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Scheme.lean

full_name: AlgebraicGeometry._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termProj_1
code: /-- `Proj` as a locally ringed space -/
local notation3 "Proj" => Proj.toLocallyRingedSpace 𝒜
goal: Lean.Macro

full_name: AlgebraicGeometry.«_aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termProj.T_1»
code: /-- The underlying topological space of `Proj` -/
local notation3 "Proj.T" => PresheafedSpace.carrier <| SheafedSpace.toPresheafedSpace
  <| LocallyRingedSpace.toSheafedSpace <| Proj.toLocallyRingedSpace 𝒜
goal: Lean.Macro

full_name: AlgebraicGeometry.«_aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termProj|__1»
code: macro "Proj| " U:term : term =>
  `((Proj.toLocallyRingedSpace 𝒜).restrict (Opens.openEmbedding (X := Proj.T) ($U : Opens Proj.T)))
goal: Lean.Macro

full_name: AlgebraicGeometry.«termProj|_»
code: macro "Proj| " U:term : term =>
  `((Proj.toLocallyRingedSpace 𝒜).restrict (Opens.openEmbedding (X := Proj.T) ($U : Opens Proj.T)))
goal: Lean.ParserDescr

full_name: AlgebraicGeometry.«_aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termProj.T|__1»
code: /-- the underlying topological space of `Proj` restricted to some open set -/
local notation "Proj.T| " U => PresheafedSpace.carrier <| SheafedSpace.toPresheafedSpace
  <| LocallyRingedSpace.toSheafedSpace
    <| (LocallyRingedSpace.restrict Proj (Opens.openEmbedding (X := Proj.T) (U : Opens Proj.T)))
goal: Lean.Macro

full_name: AlgebraicGeometry._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termPbo__1
code: /-- basic open sets in `Proj` -/
local notation "pbo " x => ProjectiveSpectrum.basicOpen 𝒜 x
goal: Lean.Macro

full_name: AlgebraicGeometry._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___unexpand_ProjectiveSpectrum_basicOpen_1
code: /-- basic open sets in `Proj` -/
local notation "pbo " x => ProjectiveSpectrum.basicOpen 𝒜 x
goal: Lean.PrettyPrinter.Unexpander

full_name: AlgebraicGeometry._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termSbo__1
code: /-- basic open sets in `Spec` -/
local notation "sbo " f => PrimeSpectrum.basicOpen f
goal: Lean.Macro

full_name: AlgebraicGeometry._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___unexpand_PrimeSpectrum_basicOpen_1
code: /-- basic open sets in `Spec` -/
local notation "sbo " f => PrimeSpectrum.basicOpen f
goal: Lean.PrettyPrinter.Unexpander

full_name: AlgebraicGeometry._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termSpec__1
code: /-- `Spec` as a locally ringed space -/
local notation3 "Spec " ring => Spec.locallyRingedSpaceObj (CommRingCat.of ring)
goal: Lean.Macro

full_name: AlgebraicGeometry.«_aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termSpec.T__1»
code: /-- the underlying topological space of `Spec` -/
local notation "Spec.T " ring =>
  (Spec.locallyRingedSpaceObj (CommRingCat.of ring)).toSheafedSpace.toPresheafedSpace.1
goal: Lean.Macro

full_name: AlgebraicGeometry.«_aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_termA⁰___1»
code: local notation3 "A⁰_ " f => HomogeneousLocalization.Away 𝒜 f
goal: Lean.Macro

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.carrier
code: /--
For any `x` in `Proj| (pbo f)`, the corresponding ideal in `Spec A⁰_f`. This fact that this ideal
is prime is proven in `TopComponent.Forward.toFun`-/
def carrier : Ideal (A⁰_ f) 
goal: Ideal (HomogeneousLocalization.Away 𝒜 f)

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.mk_mem_carrier
code: @[simp]
theorem mk_mem_carrier (z : HomogeneousLocalization.NumDenSameDeg 𝒜 (.powers f)) :
    HomogeneousLocalization.mk z ∈ carrier x ↔ z.num.1 ∈ x.1.asHomogeneousIdeal 
goal: HomogeneousLocalization.mk z ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.carrier x ↔
  ↑z.num ∈ (↑x).asHomogeneousIdeal

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.isPrime_carrier
code: theorem isPrime_carrier : Ideal.IsPrime (carrier x) 
goal: (AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.carrier x).IsPrime

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.toFun_asIdeal
code: /-- The function between the basic open set `D(f)` in `Proj` to the corresponding basic open set in
`Spec A⁰_f`. This is bundled into a continuous map in `TopComponent.forward`.
-/
@[simps (config := .lemmasOnly)]
def toFun (x : Proj.T| pbo f) : Spec.T A⁰_ f 
goal: (AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.toFun f x).asIdeal =
  AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.carrier x

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.toFun
code: /-- The function between the basic open set `D(f)` in `Proj` to the corresponding basic open set in
`Spec A⁰_f`. This is bundled into a continuous map in `TopComponent.forward`.
-/
@[simps (config := .lemmasOnly)]
def toFun (x : Proj.T| pbo f) : Spec.T A⁰_ f 
goal: ↑↑(AlgebraicGeometry.Spec.locallyRingedSpaceObj (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))).toPresheafedSpace

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.preimage_basicOpen
code: theorem preimage_basicOpen (z : HomogeneousLocalization.NumDenSameDeg 𝒜 (.powers f)) :
    toFun f ⁻¹' (sbo (HomogeneousLocalization.mk z) : Set (PrimeSpectrum (A⁰_ f))) =
      Subtype.val ⁻¹' (pbo z.num.1 : Set (ProjectiveSpectrum 𝒜)) 
goal: AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.toFun f ⁻¹' ↑(PrimeSpectrum.basicOpen (HomogeneousLocalization.mk z)) =
  Subtype.val ⁻¹' ↑(ProjectiveSpectrum.basicOpen 𝒜 ↑z.num)

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec_apply_asIdeal
code: /-- The continuous function from the basic open set `D(f)` in `Proj`
to the corresponding basic open set in `Spec A⁰_f`. -/
@[simps! (config := .lemmasOnly) apply_asIdeal]
def toSpec (f : A) : (Proj.T| pbo f) ⟶ Spec.T A⁰_ f 
goal: ((AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f) x).asIdeal =
  AlgebraicGeometry.ProjIsoSpecTopComponent.ToSpec.carrier x

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec
code: /-- The continuous function from the basic open set `D(f)` in `Proj`
to the corresponding basic open set in `Spec A⁰_f`. -/
@[simps! (config := .lemmasOnly) apply_asIdeal]
def toSpec (f : A) : (Proj.T| pbo f) ⟶ Spec.T A⁰_ f 
goal: ↑((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).toPresheafedSpace ⟶
  ↑(AlgebraicGeometry.Spec.locallyRingedSpaceObj (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))).toPresheafedSpace

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec_preimage_basicOpen
code: lemma toSpec_preimage_basicOpen {f} (z : HomogeneousLocalization.NumDenSameDeg 𝒜 (.powers f)) :
    toSpec 𝒜 f ⁻¹' (sbo (HomogeneousLocalization.mk z) : Set (PrimeSpectrum (A⁰_ f))) =
      Subtype.val ⁻¹' (pbo z.num.1 : Set (ProjectiveSpectrum 𝒜)) 
goal: ⇑(AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f) ⁻¹' ↑(PrimeSpectrum.basicOpen (HomogeneousLocalization.mk z)) =
  Subtype.val ⁻¹' ↑(ProjectiveSpectrum.basicOpen 𝒜 ↑z.num)

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.tacticMem_tac_aux
code: macro "mem_tac_aux" : tactic =>
  `(tactic| first | exact pow_mem_graded _ (Submodule.coe_mem _) | exact natCast_mem_graded _ _ |
    exact pow_mem_graded _ f_deg)
goal: Lean.ParserDescr

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_ProjIsoSpecTopComponent_FromSpec_tacticMem_tac_aux_1
code: macro "mem_tac_aux" : tactic =>
  `(tactic| first | exact pow_mem_graded _ (Submodule.coe_mem _) | exact natCast_mem_graded _ _ |
    exact pow_mem_graded _ f_deg)
goal: Lean.Macro

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.tacticMem_tac
code: macro "mem_tac" : tactic =>
  `(tactic| first | mem_tac_aux |
    repeat (all_goals (apply SetLike.GradedMonoid.toGradedMul.mul_mem)); mem_tac_aux)
goal: Lean.ParserDescr

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec._aux_Mathlib_AlgebraicGeometry_ProjectiveSpectrum_Scheme___macroRules_AlgebraicGeometry_ProjIsoSpecTopComponent_FromSpec_tacticMem_tac_1
code: macro "mem_tac" : tactic =>
  `(tactic| first | mem_tac_aux |
    repeat (all_goals (apply SetLike.GradedMonoid.toGradedMul.mul_mem)); mem_tac_aux)
goal: Lean.Macro

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier
code: /-- The function from `Spec A⁰_f` to `Proj|D(f)` is defined by `q ↦ {a | aᵢᵐ/fⁱ ∈ q}`, i.e. sending
`q` a prime ideal in `A⁰_f` to the homogeneous prime relevant ideal containing only and all the
elements `a : A` such that for every `i`, the degree 0 element formed by dividing the `m`-th power
of the `i`-th projection of `a` by the `i`-th power of the degree-`m` homogeneous element `f`,
lies in `q`.

The set `{a | aᵢᵐ/fⁱ ∈ q}`
* is an ideal, as proved in `carrier.asIdeal`;
* is homogeneous, as proved in `carrier.asHomogeneousIdeal`;
* is prime, as proved in `carrier.asIdeal.prime`;
* is relevant, as proved in `carrier.relevant`.
-/
def carrier (q : Spec.T A⁰_ f) : Set A 
goal: Set A

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.mem_carrier_iff
code: theorem mem_carrier_iff (q : Spec.T A⁰_ f) (a : A) :
    a ∈ carrier f_deg q ↔ ∀ i, (HomogeneousLocalization.mk ⟨m * i, ⟨proj 𝒜 i a ^ m, by mem_tac⟩,
      ⟨f ^ i, by rw [mul_comm]; mem_tac⟩, ⟨_, rfl⟩⟩ : A⁰_ f) ∈ q.1 
goal: a ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q ↔
  ∀ (i : ℕ),
    HomogeneousLocalization.mk
        { deg := m * i, num := ⟨(GradedAlgebra.proj 𝒜 i) a ^ m, ⋯⟩, den := ⟨f ^ i, ⋯⟩, den_mem := ⋯ } ∈
      q.asIdeal

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.mem_carrier_iff'
code: theorem mem_carrier_iff' (q : Spec.T A⁰_ f) (a : A) :
    a ∈ carrier f_deg q ↔
      ∀ i, (Localization.mk (proj 𝒜 i a ^ m) ⟨f ^ i, ⟨i, rfl⟩⟩ : Localization.Away f) ∈
          algebraMap (HomogeneousLocalization.Away 𝒜 f) (Localization.Away f) '' { s | s ∈ q.1 } 
goal: a ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q ↔
  ∀ (i : ℕ),
    Localization.mk ((GradedAlgebra.proj 𝒜 i) a ^ m) ⟨f ^ i, ⋯⟩ ∈
      ⇑(algebraMap (HomogeneousLocalization.Away 𝒜 f) (Localization.Away f)) '' {s | s ∈ q.asIdeal}

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.mem_carrier_iff_of_mem
code: theorem mem_carrier_iff_of_mem (hm : 0 < m) (q : Spec.T A⁰_ f) (a : A) {n} (hn : a ∈ 𝒜 n) :
    a ∈ carrier f_deg q ↔
      (HomogeneousLocalization.mk ⟨m * n, ⟨a ^ m, pow_mem_graded m hn⟩,
        ⟨f ^ n, by rw [mul_comm]; mem_tac⟩, ⟨_, rfl⟩⟩ : A⁰_ f) ∈ q.asIdeal 
goal: a ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q ↔
  HomogeneousLocalization.mk { deg := m * n, num := ⟨a ^ m, ⋯⟩, den := ⟨f ^ n, ⋯⟩, den_mem := ⋯ } ∈ q.asIdeal

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.mem_carrier_iff_of_mem_mul
code: theorem mem_carrier_iff_of_mem_mul (hm : 0 < m)
    (q : Spec.T A⁰_ f) (a : A) {n} (hn : a ∈ 𝒜 (n * m)) :
    a ∈ carrier f_deg q ↔ (HomogeneousLocalization.mk ⟨m * n, ⟨a, mul_comm n m ▸ hn⟩,
        ⟨f ^ n, by rw [mul_comm]; mem_tac⟩, ⟨_, rfl⟩⟩ : A⁰_ f) ∈ q.asIdeal 
goal: a ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q ↔
  HomogeneousLocalization.mk { deg := m * n, num := ⟨a, ⋯⟩, den := ⟨f ^ n, ⋯⟩, den_mem := ⋯ } ∈ q.asIdeal

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.num_mem_carrier_iff
code: theorem num_mem_carrier_iff (hm : 0 < m) (q : Spec.T A⁰_ f)
    (z : HomogeneousLocalization.NumDenSameDeg 𝒜 (.powers f)) :
    z.num.1 ∈ carrier f_deg q ↔ HomogeneousLocalization.mk z ∈ q.asIdeal 
goal: ↑z.num ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q ↔ HomogeneousLocalization.mk z ∈ q.asIdeal

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.add_mem
code: theorem carrier.add_mem (q : Spec.T A⁰_ f) {a b : A} (ha : a ∈ carrier f_deg q)
    (hb : b ∈ carrier f_deg q) : a + b ∈ carrier f_deg q 
goal: a + b ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.zero_mem
code: theorem carrier.zero_mem : (0 : A) ∈ carrier f_deg q 
goal: 0 ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.smul_mem
code: theorem carrier.smul_mem (c x : A) (hx : x ∈ carrier f_deg q) : c • x ∈ carrier f_deg q 
goal: c • x ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal
code: /-- For a prime ideal `q` in `A⁰_f`, the set `{a | aᵢᵐ/fⁱ ∈ q}` as an ideal.
-/
def carrier.asIdeal : Ideal A 
goal: Ideal A

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal.homogeneous
code: theorem carrier.asIdeal.homogeneous : (carrier.asIdeal f_deg hm q).IsHomogeneous 𝒜 
goal: Ideal.IsHomogeneous 𝒜 (AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal f_deg hm q)

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asHomogeneousIdeal
code: /-- For a prime ideal `q` in `A⁰_f`, the set `{a | aᵢᵐ/fⁱ ∈ q}` as a homogeneous ideal.
-/
def carrier.asHomogeneousIdeal : HomogeneousIdeal 𝒜 
goal: HomogeneousIdeal 𝒜

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.denom_not_mem
code: theorem carrier.denom_not_mem : f ∉ carrier.asIdeal f_deg hm q 
goal: f ∉ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal f_deg hm q

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.relevant
code: theorem carrier.relevant : ¬HomogeneousIdeal.irrelevant 𝒜 ≤ carrier.asHomogeneousIdeal f_deg hm q 
goal: ¬HomogeneousIdeal.irrelevant 𝒜 ≤
    AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asHomogeneousIdeal f_deg hm q

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal.ne_top
code: theorem carrier.asIdeal.ne_top : carrier.asIdeal f_deg hm q ≠ ⊤ 
goal: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal f_deg hm q ≠ ⊤

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal.prime
code: theorem carrier.asIdeal.prime : (carrier.asIdeal f_deg hm q).IsPrime 
goal: (AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier.asIdeal f_deg hm q).IsPrime

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.toFun
code: /-- The function `Spec A⁰_f → Proj|D(f)` sending `q` to `{a | aᵢᵐ/fⁱ ∈ q}`. -/
def toFun : (Spec.T A⁰_ f) → Proj.T| pbo f 
goal: ↑↑(AlgebraicGeometry.Spec.locallyRingedSpaceObj (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))).toPresheafedSpace →
  ↑↑((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).toPresheafedSpace

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec_fromSpec
code: lemma toSpec_fromSpec {f : A} {m : ℕ} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) (x : Spec.T (A⁰_ f)) :
    toSpec 𝒜 f (FromSpec.toFun f_deg hm x) = x 
goal: (AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f)
    (AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.toFun f_deg hm x) =
  x

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.fromSpec_toSpec
code: lemma fromSpec_toSpec {f : A} {m : ℕ} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) (x : Proj.T| pbo f) :
    FromSpec.toFun f_deg hm (toSpec 𝒜 f x) = x 
goal: AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.toFun f_deg hm
    ((AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f) x) =
  x

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec_injective
code: lemma toSpec_injective {f : A} {m : ℕ} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    Function.Injective (toSpec 𝒜 f) 
goal: Function.Injective ⇑(AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f)

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec_surjective
code: lemma toSpec_surjective {f : A} {m : ℕ} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    Function.Surjective (toSpec 𝒜 f) 
goal: Function.Surjective ⇑(AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f)

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec_bijective
code: lemma toSpec_bijective {f : A} {m : ℕ} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    Function.Bijective (toSpec (𝒜 := 𝒜) (f := f)) 
goal: Function.Bijective ⇑(AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f)

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec.image_basicOpen_eq_basicOpen
code: lemma image_basicOpen_eq_basicOpen (a : A) (i : ℕ) :
    toSpec 𝒜 f '' (Subtype.val ⁻¹' (pbo (decompose 𝒜 a i) : Set (ProjectiveSpectrum 𝒜))) =
    (PrimeSpectrum.basicOpen (R := A⁰_ f) <|
      HomogeneousLocalization.mk
        ⟨m * i, ⟨decompose 𝒜 a i ^ m, SetLike.pow_mem_graded _ (Submodule.coe_mem _)⟩,
          ⟨f^i, by rw [mul_comm]; exact SetLike.pow_mem_graded _ f_deg⟩, ⟨i, rfl⟩⟩).1 
goal: ⇑(AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f) ''
    (Subtype.val ⁻¹' ↑(ProjectiveSpectrum.basicOpen 𝒜 ↑(((DirectSum.decompose 𝒜) a) i))) =
  (PrimeSpectrum.basicOpen
      (HomogeneousLocalization.mk
        { deg := m * i, num := ⟨↑(((DirectSum.decompose 𝒜) a) i) ^ m, ⋯⟩, den := ⟨f ^ i, ⋯⟩, den_mem := ⋯ })).carrier

full_name: AlgebraicGeometry.ProjIsoSpecTopComponent.fromSpec
code: /-- The continuous function `Spec A⁰_f → Proj|D(f)` sending `q` to `{a | aᵢᵐ/fⁱ ∈ q}` where
`m` is the degree of `f` -/
def fromSpec {f : A} {m : ℕ} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    (Spec.T (A⁰_ f)) ⟶ (Proj.T| (pbo f)) 
goal: ↑(AlgebraicGeometry.Spec.locallyRingedSpaceObj (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))).toPresheafedSpace ⟶
  ↑((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).toPresheafedSpace

full_name: AlgebraicGeometry.projIsoSpecTopComponent
code: /--
The homeomorphism `Proj|D(f) ≅ Spec A⁰_f` defined by
- `φ : Proj|D(f) ⟶ Spec A⁰_f` by sending `x` to `A⁰_f ∩ span {g / 1 | g ∈ x}`
- `ψ : Spec A⁰_f ⟶ Proj|D(f)` by sending `q` to `{a | aᵢᵐ/fⁱ ∈ q}`.
-/
def projIsoSpecTopComponent {f : A} {m : ℕ} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    (Proj.T| (pbo f)) ≅ (Spec.T (A⁰_ f))  
goal: ↑((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).toPresheafedSpace ≅
  ↑(AlgebraicGeometry.Spec.locallyRingedSpaceObj (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))).toPresheafedSpace

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToSection
code: /--
The ring map from `A⁰_ f` to the local sections of the structure sheaf of the projective spectrum of
`A` on the basic open set `D(f)` defined by sending `s ∈ A⁰_f` to the section `x ↦ s` on `D(f)`.
-/
def awayToSection (f) : CommRingCat.of (A⁰_ f) ⟶ (structureSheaf 𝒜).1.obj (op (pbo f)) 
goal: CommRingCat.of (HomogeneousLocalization.Away 𝒜 f) ⟶
  (AlgebraicGeometry.ProjectiveSpectrum.Proj.structureSheaf 𝒜).val.obj (Opposite.op (ProjectiveSpectrum.basicOpen 𝒜 f))

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToSection_germ
code: lemma awayToSection_germ (f x) :
    awayToSection 𝒜 f ≫ (structureSheaf 𝒜).presheaf.germ x =
      (HomogeneousLocalization.mapId 𝒜 (Submonoid.powers_le.mpr x.2)) ≫
        (Proj.stalkIso' 𝒜 x).toCommRingCatIso.inv 
goal: CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToSection 𝒜 f)
    ((AlgebraicGeometry.ProjectiveSpectrum.Proj.structureSheaf 𝒜).presheaf.germ x) =
  CategoryTheory.CategoryStruct.comp (HomogeneousLocalization.mapId 𝒜 ⋯)
    (AlgebraicGeometry.Proj.stalkIso' 𝒜 ↑x).toCommRingCatIso.inv

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToΓ
code: /--
The ring map from `A⁰_ f` to the global sections of the structure sheaf of the projective spectrum
of `A` restricted to the basic open set `D(f)`.

Mathematically, the map is the same as `awayToSection`.
-/
def awayToΓ (f) : CommRingCat.of (A⁰_ f) ⟶ LocallyRingedSpace.Γ.obj (op <| Proj| pbo f) 
goal: CommRingCat.of (HomogeneousLocalization.Away 𝒜 f) ⟶
  AlgebraicGeometry.LocallyRingedSpace.Γ.obj (Opposite.op ((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯))

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToΓ_ΓToStalk
code: lemma awayToΓ_ΓToStalk (f) (x) :
    awayToΓ 𝒜 f ≫ (Proj| pbo f).presheaf.Γgerm x =
      HomogeneousLocalization.mapId 𝒜 (Submonoid.powers_le.mpr x.2) ≫
      (Proj.stalkIso' 𝒜 x.1).toCommRingCatIso.inv ≫
      ((Proj.toLocallyRingedSpace 𝒜).restrictStalkIso (Opens.openEmbedding _) x).inv 
goal: CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToΓ 𝒜 f)
    (((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).presheaf.Γgerm x) =
  CategoryTheory.CategoryStruct.comp (HomogeneousLocalization.mapId 𝒜 ⋯)
    (CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.Proj.stalkIso' 𝒜 ↑x).toCommRingCatIso.inv
      ((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrictStalkIso ⋯ x).inv)

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec
code: /--
The morphism of locally ringed space from `Proj|D(f)` to `Spec A⁰_f` induced by the ring map
`A⁰_ f → Γ(Proj, D(f))` under the gamma spec adjunction.
-/
def toSpec (f) : (Proj| pbo f) ⟶ Spec (A⁰_ f) 
goal: (AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯ ⟶
  AlgebraicGeometry.Spec.locallyRingedSpaceObj (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec_base_apply_eq_comap
code: lemma toSpec_base_apply_eq_comap {f} (x : Proj| pbo f) :
    (toSpec 𝒜 f).1.base x = PrimeSpectrum.comap (mapId 𝒜 (Submonoid.powers_le.mpr x.2))
      (closedPoint (AtPrime 𝒜 x.1.asHomogeneousIdeal.toIdeal)) 
goal: (AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base x =
  (PrimeSpectrum.comap (HomogeneousLocalization.mapId 𝒜 ⋯))
    (LocalRing.closedPoint (HomogeneousLocalization.AtPrime 𝒜 (↑x).asHomogeneousIdeal.toIdeal))

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec_base_apply_eq
code: lemma toSpec_base_apply_eq {f} (x : Proj| pbo f) :
    (toSpec 𝒜 f).1.base x = ProjIsoSpecTopComponent.toSpec 𝒜 f x 
goal: (AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base x =
  (AlgebraicGeometry.ProjIsoSpecTopComponent.toSpec 𝒜 f) x

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec_base_isIso
code: lemma toSpec_base_isIso {f} {m} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    IsIso (toSpec 𝒜 f).1.base 
goal: CategoryTheory.IsIso (AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.mk_mem_toSpec_base_apply
code: lemma mk_mem_toSpec_base_apply {f} (x : Proj| pbo f)
    (z : NumDenSameDeg 𝒜 (.powers f)) :
    HomogeneousLocalization.mk z ∈ ((toSpec 𝒜 f).1.base x).asIdeal ↔
      z.num.1 ∈ x.1.asHomogeneousIdeal 
goal: HomogeneousLocalization.mk z ∈ ((AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base x).asIdeal ↔
  ↑z.num ∈ (↑x).asHomogeneousIdeal

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec_preimage_basicOpen
code: lemma toSpec_preimage_basicOpen {f}
    (t : NumDenSameDeg 𝒜 (.powers f)) :
    (Opens.map (toSpec 𝒜 f).1.base).obj (sbo (.mk t)) =
      Opens.comap ⟨_, continuous_subtype_val⟩ (pbo t.num.1) 
goal: (TopologicalSpace.Opens.map (AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base).obj
    (PrimeSpectrum.basicOpen (HomogeneousLocalization.mk t)) =
  (TopologicalSpace.Opens.comap { toFun := Subtype.val, continuous_toFun := ⋯ }) (ProjectiveSpectrum.basicOpen 𝒜 ↑t.num)

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toOpen_toSpec_val_c_app
code: @[reassoc]
lemma toOpen_toSpec_val_c_app (f) (U) :
    StructureSheaf.toOpen (A⁰_ f) U.unop ≫ (toSpec 𝒜 f).val.c.app U =
      awayToΓ 𝒜 f ≫ (Proj| pbo f).presheaf.map (homOfLE le_top).op 
goal: CategoryTheory.CategoryStruct.comp
    (AlgebraicGeometry.StructureSheaf.toOpen (HomogeneousLocalization.Away 𝒜 f) (Opposite.unop U))
    ((AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.c.app U) =
  CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToΓ 𝒜 f)
    (((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).presheaf.map (CategoryTheory.homOfLE ⋯).op)

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toStalk_stalkMap_toSpec
code: @[reassoc]
lemma toStalk_stalkMap_toSpec (f) (x) :
    StructureSheaf.toStalk _ _ ≫ (toSpec 𝒜 f).stalkMap x =
      awayToΓ 𝒜 f ≫ (Proj| pbo f).presheaf.Γgerm x 
goal: CategoryTheory.CategoryStruct.comp
    (AlgebraicGeometry.StructureSheaf.toStalk (↑(CommRingCat.of (HomogeneousLocalization.Away 𝒜 f)))
      ((AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base x))
    (AlgebraicGeometry.LocallyRingedSpace.Hom.stalkMap (AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f) x) =
  CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToΓ 𝒜 f)
    (((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).presheaf.Γgerm x)

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.isLocalization_atPrime
code: /--
If `x` is a point in the basic open set `D(f)` where `f` is a homogeneous element of positive
degree, then the homogeneously localized ring `A⁰ₓ` has the universal property of the localization
of `A⁰_f` at `φ(x)` where `φ : Proj|D(f) ⟶ Spec A⁰_f` is the morphism of locally ringed space
constructed as above.
-/
lemma isLocalization_atPrime (f) (x : pbo f) {m} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    @IsLocalization (Away 𝒜 f) _ ((toSpec 𝒜 f).1.base x).asIdeal.primeCompl
      (AtPrime 𝒜 x.1.asHomogeneousIdeal.toIdeal) _
      (mapId 𝒜 (Submonoid.powers_le.mpr x.2)).toAlgebra 
goal: IsLocalization ((AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base x).asIdeal.primeCompl
  (HomogeneousLocalization.AtPrime 𝒜 (↑x).asHomogeneousIdeal.toIdeal)

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.specStalkEquiv
code: /--
For an element `f ∈ A` with positive degree and a homogeneous ideal in `D(f)`, we have that the
stalk of `Spec A⁰_ f` at `y` is isomorphic to `A⁰ₓ` where `y` is the point in `Proj` corresponding
to `x`.
-/
def specStalkEquiv (f) (x : pbo f) {m} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    (Spec.structureSheaf (A⁰_ f)).presheaf.stalk ((toSpec 𝒜 f).1.base x) ≅
      CommRingCat.of (AtPrime 𝒜 x.1.asHomogeneousIdeal.toIdeal) 
goal: (AlgebraicGeometry.Spec.structureSheaf (HomogeneousLocalization.Away 𝒜 f)).presheaf.stalk
    ((AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base x) ≅
  CommRingCat.of (HomogeneousLocalization.AtPrime 𝒜 (↑x).asHomogeneousIdeal.toIdeal)

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.toStalk_specStalkEquiv
code: lemma toStalk_specStalkEquiv (f) (x : pbo f) {m} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    StructureSheaf.toStalk (A⁰_ f) ((toSpec 𝒜 f).1.base x) ≫ (specStalkEquiv 𝒜 f x f_deg hm).hom =
      (mapId _ <| Submonoid.powers_le.mpr x.2 : (A⁰_ f) →+* AtPrime 𝒜 x.1.1.toIdeal) 
goal: CategoryTheory.CategoryStruct.comp
    (AlgebraicGeometry.StructureSheaf.toStalk (HomogeneousLocalization.Away 𝒜 f)
      ((AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f).val.base x))
    (AlgebraicGeometry.ProjectiveSpectrum.Proj.specStalkEquiv 𝒜 f x f_deg hm).hom =
  HomogeneousLocalization.mapId 𝒜 ⋯

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.stalkMap_toSpec
code: lemma stalkMap_toSpec (f) (x : pbo f) {m} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    (toSpec 𝒜 f).stalkMap x =
      (specStalkEquiv 𝒜 f x f_deg hm).hom ≫ (Proj.stalkIso' 𝒜 x.1).toCommRingCatIso.inv ≫
      ((Proj.toLocallyRingedSpace 𝒜).restrictStalkIso (Opens.openEmbedding _) x).inv 
goal: AlgebraicGeometry.LocallyRingedSpace.Hom.stalkMap (AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f) x =
  CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.ProjectiveSpectrum.Proj.specStalkEquiv 𝒜 f x f_deg hm).hom
    (CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.Proj.stalkIso' 𝒜 ↑x).toCommRingCatIso.inv
      ((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrictStalkIso ⋯ x).inv)

full_name: AlgebraicGeometry.ProjectiveSpectrum.Proj.isIso_toSpec
code: lemma isIso_toSpec (f) {m} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    IsIso (toSpec 𝒜 f) 
goal: CategoryTheory.IsIso (AlgebraicGeometry.ProjectiveSpectrum.Proj.toSpec 𝒜 f)

full_name: AlgebraicGeometry.projIsoSpec
code: /--
If `f ∈ A` is a homogeneous element of positive degree, then the projective spectrum restricted to
`D(f)` as a locally ringed space is isomorphic to `Spec A⁰_f`.
-/
def projIsoSpec (f) {m} (f_deg : f ∈ 𝒜 m) (hm : 0 < m) :
    (Proj| pbo f) ≅ (Spec (A⁰_ f)) 
goal: (AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯ ≅
  AlgebraicGeometry.Spec.locallyRingedSpaceObj (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))

full_name: AlgebraicGeometry.Proj
code: /--
This is the scheme `Proj(A)` for any `ℕ`-graded ring `A`.
-/
def «Proj» : Scheme 
goal: AlgebraicGeometry.Scheme