l3lab/ntp-mathlib huggingface dataset:
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    

Proof state:
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
⊢ typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F) = F

Next tactic:
apply Functor.ext
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    apply Functor.ext
    · 

Proof state:
case h_map
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
⊢ autoParam
    (∀ (X_1 Y_1 : ↑(typeToCat.obj X)) (f : X_1 ⟶ Y_1),
      (typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F)).map f =
        eqToHom (_ : ?F.obj X_1 = ?G.obj X_1) ≫
          F.map f ≫
            eqToHom (_ : F.obj Y_1 = (typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F)).obj Y_1))
    _auto✝

Next tactic:
intro x y f
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    apply Functor.ext
    · intro x y f
      

Proof state:
case h_map
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
x y : ↑(typeToCat.obj X)
f : x ⟶ y
⊢ (typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F)).map f =
    eqToHom (_ : ?F.obj x = ?G.obj x) ≫
      F.map f ≫ eqToHom (_ : F.obj y = (typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F)).obj y)

Next tactic:
dsimp
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    apply Functor.ext
    · intro x y f
      dsimp
      

Proof state:
case h_map
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
x y : ↑(typeToCat.obj X)
f : x ⟶ y
⊢ (Discrete.functor (Discrete.mk ∘ Discrete.as ∘ F.obj ∘ Discrete.mk)).map f =
    𝟙 ((Discrete.functor (Discrete.mk ∘ Discrete.as ∘ F.obj ∘ Discrete.mk)).obj x) ≫ F.map f ≫ 𝟙 (F.obj y)

Next tactic:
apply ULift.ext
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    apply Functor.ext
    · intro x y f
      dsimp
      apply ULift.ext
      

Proof state:
case h_map.h
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
x y : ↑(typeToCat.obj X)
f : x ⟶ y
⊢ ((Discrete.functor (Discrete.mk ∘ Discrete.as ∘ F.obj ∘ Discrete.mk)).map f).down =
    (𝟙 ((Discrete.functor (Discrete.mk ∘ Discrete.as ∘ F.obj ∘ Discrete.mk)).obj x) ≫ F.map f ≫ 𝟙 (F.obj y)).down

Next tactic:
aesop_cat
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    apply Functor.ext
    · intro x y f
      dsimp
      apply ULift.ext
      aesop_cat
    · 

Proof state:
case h_obj
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
⊢ ∀ (X_1 : ↑(typeToCat.obj X)),
    (typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F)).obj X_1 = F.obj X_1

Next tactic:
rintro ⟨x⟩
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    apply Functor.ext
    · intro x y f
      dsimp
      apply ULift.ext
      aesop_cat
    · rintro ⟨x⟩
      

Proof state:
case h_obj.mk
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
x : X
⊢ (typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F)).obj { as := x } = F.obj { as := x }

Next tactic:
apply Discrete.ext
instance : Full typeToCat.{u} where
  preimage F := Discrete.as ∘ F.obj ∘ Discrete.mk
  witness := by
    intro X Y F
    apply Functor.ext
    · intro x y f
      dsimp
      apply ULift.ext
      aesop_cat
    · rintro ⟨x⟩
      apply Discrete.ext
      

Proof state:
case h_obj.mk.as
X Y : Type u
F : typeToCat.obj X ⟶ typeToCat.obj Y
x : X
⊢ ((typeToCat.map ((fun {X Y} F => Discrete.as ∘ F.obj ∘ Discrete.mk) F)).obj { as := x }).as = (F.obj { as := x }).as

Next tactic:
rfl
instance : MvQPF (Comp F G) where
  P := MvPFunctor.comp (P F) fun i ↦ P <| G i
  abs := Comp.mk ∘ (map fun i ↦ abs) ∘ abs ∘ MvPFunctor.comp.get
  repr {α} := MvPFunctor.comp.mk ∘ repr ∘
              (map fun i ↦ (repr : G i α → (fun i : Fin2 n ↦ Obj (P (G i)) α) i)) ∘ Comp.get
  abs_repr := by
    

Proof state:
n m : ℕ
F : TypeVec.{u} n → Type u_1
fF : MvFunctor F
q : MvQPF F
G : Fin2 n → TypeVec.{u} m → Type u
fG : (i : Fin2 n) → MvFunctor (G i)
q' : (i : Fin2 n) → MvQPF (G i)
α β : TypeVec.{u} m
f : α ⟹ β
⊢ ∀ {α : TypeVec.{u} m} (x : Comp F G α),
    (fun {α} => Comp.mk ∘ (MvFunctor.map fun i => abs) ∘ abs ∘ comp.get)
        ((fun {α} => comp.mk ∘ repr ∘ (MvFunctor.map fun i => repr) ∘ Comp.get) x) =
      x

Next tactic:
intros
instance : MvQPF (Comp F G) where
  P := MvPFunctor.comp (P F) fun i ↦ P <| G i
  abs := Comp.mk ∘ (map fun i ↦ abs) ∘ abs ∘ MvPFunctor.comp.get
  repr {α} := MvPFunctor.comp.mk ∘ repr ∘
              (map fun i ↦ (repr : G i α → (fun i : Fin2 n ↦ Obj (P (G i)) α) i)) ∘ Comp.get
  abs_repr := by
    intros
    

Proof state:
n m : ℕ
F : TypeVec.{u} n → Type u_1
fF : MvFunctor F
q : MvQPF F
G : Fin2 n → TypeVec.{u} m → Type u
fG : (i : Fin2 n) → MvFunctor (G i)
q' : (i : Fin2 n) → MvQPF (G i)
α β : TypeVec.{u} m
f : α ⟹ β
α✝ : TypeVec.{u} m
x✝ : Comp F G α✝
⊢ (fun {α} => Comp.mk ∘ (MvFunctor.map fun i => abs) ∘ abs ∘ comp.get)
      ((fun {α} => comp.mk ∘ repr ∘ (MvFunctor.map fun i => repr) ∘ Comp.get) x✝) =
    x✝

Next tactic:
simp (config := { unfoldPartialApp := true }) only [Function.comp_def, comp.get_mk, abs_repr,
      map_map, TypeVec.comp, MvFunctor.id_map', Comp.mk_get]
instance : MvQPF (Comp F G) where
  P := MvPFunctor.comp (P F) fun i ↦ P <| G i
  abs := Comp.mk ∘ (map fun i ↦ abs) ∘ abs ∘ MvPFunctor.comp.get
  repr {α} := MvPFunctor.comp.mk ∘ repr ∘
              (map fun i ↦ (repr : G i α → (fun i : Fin2 n ↦ Obj (P (G i)) α) i)) ∘ Comp.get
  abs_repr := by
    intros
    simp (config := { unfoldPartialApp := true }) only [Function.comp_def, comp.get_mk, abs_repr,
      map_map, TypeVec.comp, MvFunctor.id_map', Comp.mk_get]
  abs_map := by
    

Proof state:
n m : ℕ
F : TypeVec.{u} n → Type u_1
fF : MvFunctor F
q : MvQPF F
G : Fin2 n → TypeVec.{u} m → Type u
fG : (i : Fin2 n) → MvFunctor (G i)
q' : (i : Fin2 n) → MvQPF (G i)
α β : TypeVec.{u} m
f : α ⟹ β
⊢ ∀ {α β : TypeVec.{u} m} (f : α ⟹ β) (p : ↑(comp (P F) fun i => P (G i)) α),
    (fun {α} => Comp.mk ∘ (MvFunctor.map fun i => abs) ∘ abs ∘ comp.get) (f <$$> p) =
      f <$$> (fun {α} => Comp.mk ∘ (MvFunctor.map fun i => abs) ∘ abs ∘ comp.get) p

Next tactic:
intros
instance : MvQPF (Comp F G) where
  P := MvPFunctor.comp (P F) fun i ↦ P <| G i
  abs := Comp.mk ∘ (map fun i ↦ abs) ∘ abs ∘ MvPFunctor.comp.get
  repr {α} := MvPFunctor.comp.mk ∘ repr ∘
              (map fun i ↦ (repr : G i α → (fun i : Fin2 n ↦ Obj (P (G i)) α) i)) ∘ Comp.get
  abs_repr := by
    intros
    simp (config := { unfoldPartialApp := true }) only [Function.comp_def, comp.get_mk, abs_repr,
      map_map, TypeVec.comp, MvFunctor.id_map', Comp.mk_get]
  abs_map := by
    intros
    

Proof state:
n m : ℕ
F : TypeVec.{u} n → Type u_1
fF : MvFunctor F
q : MvQPF F
G : Fin2 n → TypeVec.{u} m → Type u
fG : (i : Fin2 n) → MvFunctor (G i)
q' : (i : Fin2 n) → MvQPF (G i)
α β : TypeVec.{u} m
f : α ⟹ β
α✝ β✝ : TypeVec.{u} m
f✝ : α✝ ⟹ β✝
p✝ : ↑(comp (P F) fun i => P (G i)) α✝
⊢ (fun {α} => Comp.mk ∘ (MvFunctor.map fun i => abs) ∘ abs ∘ comp.get) (f✝ <$$> p✝) =
    f✝ <$$> (fun {α} => Comp.mk ∘ (MvFunctor.map fun i => abs) ∘ abs ∘ comp.get) p✝

Next tactic:
simp only [(· ∘ ·)]
instance : MvQPF (Comp F G) where
  P := MvPFunctor.comp (P F) fun i ↦ P <| G i
  abs := Comp.mk ∘ (map fun i ↦ abs) ∘ abs ∘ MvPFunctor.comp.get
  repr {α} := MvPFunctor.comp.mk ∘ repr ∘
              (map fun i ↦ (repr : G i α → (fun i : Fin2 n ↦ Obj (P (G i)) α) i)) ∘ Comp.get
  abs_repr := by
    intros
    simp (config := { unfoldPartialApp := true }) only [Function.comp_def, comp.get_mk, abs_repr,
      map_map, TypeVec.comp, MvFunctor.id_map', Comp.mk_get]
  abs_map := by
    intros
    simp only [(· ∘ ·)]
    

Proof state:
n m : ℕ
F : TypeVec.{u} n → Type u_1
fF : MvFunctor F
q : MvQPF F
G : Fin2 n → TypeVec.{u} m → Type u
fG : (i : Fin2 n) → MvFunctor (G i)
q' : (i : Fin2 n) → MvQPF (G i)
α β : TypeVec.{u} m
f : α ⟹ β
α✝ β✝ : TypeVec.{u} m
f✝ : α✝ ⟹ β✝
p✝ : ↑(comp (P F) fun i => P (G i)) α✝
⊢ Comp.mk ((fun i => abs) <$$> abs (comp.get (f✝ <$$> p✝))) = f✝ <$$> Comp.mk ((fun i => abs) <$$> abs (comp.get p✝))

Next tactic:
rw [← abs_map]
instance : MvQPF (Comp F G) where
  P := MvPFunctor.comp (P F) fun i ↦ P <| G i
  abs := Comp.mk ∘ (map fun i ↦ abs) ∘ abs ∘ MvPFunctor.comp.get
  repr {α} := MvPFunctor.comp.mk ∘ repr ∘
              (map fun i ↦ (repr : G i α → (fun i : Fin2 n ↦ Obj (P (G i)) α) i)) ∘ Comp.get
  abs_repr := by
    intros
    simp (config := { unfoldPartialApp := true }) only [Function.comp_def, comp.get_mk, abs_repr,
      map_map, TypeVec.comp, MvFunctor.id_map', Comp.mk_get]
  abs_map := by
    intros
    simp only [(· ∘ ·)]
    rw [← abs_map]
    

Proof state:
n m : ℕ
F : TypeVec.{u} n → Type u_1
fF : MvFunctor F
q : MvQPF F
G : Fin2 n → TypeVec.{u} m → Type u
fG : (i : Fin2 n) → MvFunctor (G i)
q' : (i : Fin2 n) → MvQPF (G i)
α β : TypeVec.{u} m
f : α ⟹ β
α✝ β✝ : TypeVec.{u} m
f✝ : α✝ ⟹ β✝
p✝ : ↑(comp (P F) fun i => P (G i)) α✝
⊢ Comp.mk (abs ((fun i => abs) <$$> comp.get (f✝ <$$> p✝))) = f✝ <$$> Comp.mk ((fun i => abs) <$$> abs (comp.get p✝))

Next tactic:
simp (config := { unfoldPartialApp := true }) only [comp.get_map, map_map, TypeVec.comp,
      abs_map, map_mk]
/-- The identity morphism on a locally ringed space. -/
@[simps]
def id (X : LocallyRingedSpace) : Hom X X :=
  ⟨𝟙 _, fun x => by 

Proof state:
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (𝟙 X.toSheafedSpace) x)

Next tactic:
erw [PresheafedSpace.stalkMap.id]
/-- The identity morphism on a locally ringed space. -/
@[simps]
def id (X : LocallyRingedSpace) : Hom X X :=
  ⟨𝟙 _, fun x => by erw [PresheafedSpace.stalkMap.id]; 

Proof state:
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (𝟙 (PresheafedSpace.stalk X.toPresheafedSpace x))

Next tactic:
apply isLocalRingHom_id
/-- Composition of morphisms of locally ringed spaces. -/
def comp {X Y Z : LocallyRingedSpace} (f : Hom X Y) (g : Hom Y Z) : Hom X Z :=
  ⟨f.val ≫ g.val, fun x => by
    

Proof state:
X✝ : LocallyRingedSpace
X Y Z : LocallyRingedSpace
f : Hom X Y
g : Hom Y Z
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (f.val ≫ g.val) x)

Next tactic:
erw [PresheafedSpace.stalkMap.comp]
/-- Composition of morphisms of locally ringed spaces. -/
def comp {X Y Z : LocallyRingedSpace} (f : Hom X Y) (g : Hom Y Z) : Hom X Z :=
  ⟨f.val ≫ g.val, fun x => by
    erw [PresheafedSpace.stalkMap.comp]
    

Proof state:
X✝ : LocallyRingedSpace
X Y Z : LocallyRingedSpace
f : Hom X Y
g : Hom Y Z
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap g.val (f.val.base x) ≫ PresheafedSpace.stalkMap f.val x)

Next tactic:
exact @isLocalRingHom_comp _ _ _ _ _ _ _ _ (f.2 _) (g.2 _)
/-- The category of locally ringed spaces. -/
instance : Category LocallyRingedSpace where
  Hom := Hom
  id := id
  comp {X Y Z} f g := comp f g
  comp_id {X Y} f := Hom.ext _ _ <| by simp [comp]
  id_comp {X Y} f := Hom.ext _ _ <| by 

Proof state:
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ (𝟙 X ≫ f).val = f.val

Next tactic:
simp [comp]
/-- The category of locally ringed spaces. -/
instance : Category LocallyRingedSpace where
  Hom := Hom
  id := id
  comp {X Y Z} f g := comp f g
  comp_id {X Y} f := Hom.ext _ _ <| by 

Proof state:
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
⊢ (f ≫ 𝟙 Y).val = f.val

Next tactic:
simp [comp]
/-- The category of locally ringed spaces. -/
instance : Category LocallyRingedSpace where
  Hom := Hom
  id := id
  comp {X Y Z} f g := comp f g
  comp_id {X Y} f := Hom.ext _ _ <| by simp [comp]
  id_comp {X Y} f := Hom.ext _ _ <| by simp [comp]
  assoc {_ _ _ _} f g h := Hom.ext _ _ <| by 

Proof state:
X : LocallyRingedSpace
x✝³ x✝² x✝¹ x✝ : LocallyRingedSpace
f : x✝³ ⟶ x✝²
g : x✝² ⟶ x✝¹
h : x✝¹ ⟶ x✝
⊢ ((f ≫ g) ≫ h).val = (f ≫ g ≫ h).val

Next tactic:
simp [comp]
/-- Given two locally ringed spaces `X` and `Y`, an isomorphism between `X` and `Y` as _sheafed_
spaces can be lifted to a morphism `X ⟶ Y` as locally ringed spaces.

See also `iso_of_SheafedSpace_iso`.
-/
@[simps]
def homOfSheafedSpaceHomOfIsIso {X Y : LocallyRingedSpace} (f : X.toSheafedSpace ⟶ Y.toSheafedSpace)
    [IsIso f] : X ⟶ Y :=
  Hom.mk f fun x =>
    -- Here we need to see that the stalk maps are really local ring homomorphisms.
    -- This can be solved by type class inference, because stalk maps of isomorphisms
    -- are isomorphisms and isomorphisms are local ring homomorphisms.
    show IsLocalRingHom (PresheafedSpace.stalkMap (SheafedSpace.forgetToPresheafedSpace.map f) x) by
      

Proof state:
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X.toSheafedSpace ⟶ Y.toSheafedSpace
inst✝ : IsIso f
x : ↑↑X.toPresheafedSpace
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (SheafedSpace.forgetToPresheafedSpace.map f) x)

Next tactic:
infer_instance
/-- The restriction of a locally ringed space along an open embedding.
-/
@[simps!]
def restrict {U : TopCat} (X : LocallyRingedSpace) {f : U ⟶ X.toTopCat} (h : OpenEmbedding f) :
    LocallyRingedSpace where
  localRing := by
    

Proof state:
X✝ : LocallyRingedSpace
U : TopCat
X : LocallyRingedSpace
f : U ⟶ toTopCat X
h : OpenEmbedding ⇑f
⊢ ∀ (x : ↑↑(SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace),
    LocalRing ↑(Presheaf.stalk (SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace.presheaf x)

Next tactic:
intro x
/-- The restriction of a locally ringed space along an open embedding.
-/
@[simps!]
def restrict {U : TopCat} (X : LocallyRingedSpace) {f : U ⟶ X.toTopCat} (h : OpenEmbedding f) :
    LocallyRingedSpace where
  localRing := by
    intro x
    -- We show that the stalk of the restriction is isomorphic to the original stalk,
    

Proof state:
X✝ : LocallyRingedSpace
U : TopCat
X : LocallyRingedSpace
f : U ⟶ toTopCat X
h : OpenEmbedding ⇑f
x : ↑↑(SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace
⊢ LocalRing ↑(Presheaf.stalk (SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace.presheaf x)

Next tactic:
apply @RingEquiv.localRing _ _ _ (X.localRing (f x))
/-- The restriction of a locally ringed space along an open embedding.
-/
@[simps!]
def restrict {U : TopCat} (X : LocallyRingedSpace) {f : U ⟶ X.toTopCat} (h : OpenEmbedding f) :
    LocallyRingedSpace where
  localRing := by
    intro x
    -- We show that the stalk of the restriction is isomorphic to the original stalk,
    apply @RingEquiv.localRing _ _ _ (X.localRing (f x))
    

Proof state:
case e
X✝ : LocallyRingedSpace
U : TopCat
X : LocallyRingedSpace
f : U ⟶ toTopCat X
h : OpenEmbedding ⇑f
x : ↑↑(SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace
⊢ ↑(Presheaf.stalk X.presheaf (f x)) ≃+*
    ↑(Presheaf.stalk (SheafedSpace.restrict X.toSheafedSpace h).toPresheafedSpace.presheaf x)

Next tactic:
exact (X.restrictStalkIso h x).symm.commRingCatIsoToRingEquiv
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  

Proof state:
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
⊢ (Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s) =
    RingedSpace.basicOpen (toRingedSpace X) ((f.val.c.app { unop := U }) s)

Next tactic:
ext x
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  

Proof state:
case h.h
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s)) ↔
    x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) ((f.val.c.app { unop := U }) s))

Next tactic:
constructor
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  constructor
  · 

Proof state:
case h.h.mp
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s)) →
    x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) ((f.val.c.app { unop := U }) s))

Next tactic:
rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  constructor
  · rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
    

Proof state:
case h.h.mp.intro.mk.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
hyU : f.val.base x ∈ U
hy : IsUnit ((Presheaf.germ (toRingedSpace Y).toPresheafedSpace.presheaf { val := f.val.base x, property := hyU }) s)
⊢ x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) ((f.val.c.app { unop := U }) s))

Next tactic:
erw [RingedSpace.mem_basicOpen _ _ ⟨x, show x ∈ (Opens.map f.1.base).obj U from hyU⟩,
      ← PresheafedSpace.stalkMap_germ_apply]
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  constructor
  · rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
    erw [RingedSpace.mem_basicOpen _ _ ⟨x, show x ∈ (Opens.map f.1.base).obj U from hyU⟩,
      ← PresheafedSpace.stalkMap_germ_apply]
    

Proof state:
case h.h.mp.intro.mk.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
hyU : f.val.base x ∈ U
hy : IsUnit ((Presheaf.germ (toRingedSpace Y).toPresheafedSpace.presheaf { val := f.val.base x, property := hyU }) s)
⊢ IsUnit
    ((PresheafedSpace.stalkMap f.val ↑{ val := x, property := (_ : x ∈ (Opens.map f.val.base).obj U) })
      ((Presheaf.germ Y.presheaf
          { val := f.val.base ↑{ val := x, property := (_ : x ∈ (Opens.map f.val.base).obj U) },
            property :=
              (_ : ↑{ val := x, property := (_ : x ∈ (Opens.map f.val.base).obj U) } ∈ (Opens.map f.val.base).obj U) })
        s))

Next tactic:
exact (PresheafedSpace.stalkMap f.1 _).isUnit_map hy
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  constructor
  · rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
    erw [RingedSpace.mem_basicOpen _ _ ⟨x, show x ∈ (Opens.map f.1.base).obj U from hyU⟩,
      ← PresheafedSpace.stalkMap_germ_apply]
    exact (PresheafedSpace.stalkMap f.1 _).isUnit_map hy
  · 

Proof state:
case h.h.mpr
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
x : ↑↑X.toPresheafedSpace
⊢ x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) ((f.val.c.app { unop := U }) s)) →
    x ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s))

Next tactic:
rintro ⟨y, hy : IsUnit _, rfl⟩
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  constructor
  · rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
    erw [RingedSpace.mem_basicOpen _ _ ⟨x, show x ∈ (Opens.map f.1.base).obj U from hyU⟩,
      ← PresheafedSpace.stalkMap_germ_apply]
    exact (PresheafedSpace.stalkMap f.1 _).isUnit_map hy
  · rintro ⟨y, hy : IsUnit _, rfl⟩
    

Proof state:
case h.h.mpr.intro.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
y : ↥((Opens.map f.val.base).obj U)
hy : IsUnit ((Presheaf.germ (toRingedSpace X).toPresheafedSpace.presheaf y) ((f.val.c.app { unop := U }) s))
⊢ ↑y ∈ ↑((Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) s))

Next tactic:
erw [RingedSpace.mem_basicOpen _ _ ⟨f.1.base y.1, y.2⟩]
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  constructor
  · rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
    erw [RingedSpace.mem_basicOpen _ _ ⟨x, show x ∈ (Opens.map f.1.base).obj U from hyU⟩,
      ← PresheafedSpace.stalkMap_germ_apply]
    exact (PresheafedSpace.stalkMap f.1 _).isUnit_map hy
  · rintro ⟨y, hy : IsUnit _, rfl⟩
    erw [RingedSpace.mem_basicOpen _ _ ⟨f.1.base y.1, y.2⟩]
    

Proof state:
case h.h.mpr.intro.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
y : ↥((Opens.map f.val.base).obj U)
hy : IsUnit ((Presheaf.germ (toRingedSpace X).toPresheafedSpace.presheaf y) ((f.val.c.app { unop := U }) s))
⊢ IsUnit ((Presheaf.germ Y.presheaf { val := f.val.base ↑y, property := (_ : ↑y ∈ (Opens.map f.val.base).obj U) }) s)

Next tactic:
erw [← PresheafedSpace.stalkMap_germ_apply] at hy
theorem preimage_basicOpen {X Y : LocallyRingedSpace} (f : X ⟶ Y) {U : Opens Y}
    (s : Y.presheaf.obj (op U)) :
    (Opens.map f.1.base).obj (Y.toRingedSpace.basicOpen s) =
      @RingedSpace.basicOpen X.toRingedSpace ((Opens.map f.1.base).obj U) (f.1.c.app _ s) := by
  ext x
  constructor
  · rintro ⟨⟨y, hyU⟩, hy : IsUnit _, rfl : y = _⟩
    erw [RingedSpace.mem_basicOpen _ _ ⟨x, show x ∈ (Opens.map f.1.base).obj U from hyU⟩,
      ← PresheafedSpace.stalkMap_germ_apply]
    exact (PresheafedSpace.stalkMap f.1 _).isUnit_map hy
  · rintro ⟨y, hy : IsUnit _, rfl⟩
    erw [RingedSpace.mem_basicOpen _ _ ⟨f.1.base y.1, y.2⟩]
    erw [← PresheafedSpace.stalkMap_germ_apply] at hy
    

Proof state:
case h.h.mpr.intro.intro
X✝ : LocallyRingedSpace
X Y : LocallyRingedSpace
f : X ⟶ Y
U : Opens ↑(toTopCat Y)
s : ↑(Y.presheaf.obj (op U))
y : ↥((Opens.map f.val.base).obj U)
hy :
  IsUnit
    ((PresheafedSpace.stalkMap f.val ↑y)
      ((Presheaf.germ Y.presheaf { val := f.val.base ↑y, property := (_ : ↑y ∈ (Opens.map f.val.base).obj U) }) s))
⊢ IsUnit ((Presheaf.germ Y.presheaf { val := f.val.base ↑y, property := (_ : ↑y ∈ (Opens.map f.val.base).obj U) }) s)

Next tactic:
exact (isUnit_map_iff (PresheafedSpace.stalkMap f.1 _) _).mp hy
@[simp]
theorem basicOpen_zero (X : LocallyRingedSpace) (U : Opens X.carrier) :
    X.toRingedSpace.basicOpen (0 : X.presheaf.obj <| op U) = ⊥ := by
  

Proof state:
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
⊢ RingedSpace.basicOpen (toRingedSpace X) 0 = ⊥

Next tactic:
ext x
@[simp]
theorem basicOpen_zero (X : LocallyRingedSpace) (U : Opens X.carrier) :
    X.toRingedSpace.basicOpen (0 : X.presheaf.obj <| op U) = ⊥ := by
  ext x
  

Proof state:
case h.h
X✝ : LocallyRingedSpace
X : LocallyRingedSpace
U : Opens ↑↑X.toPresheafedSpace
x : ↑↑(toRingedSpace X).toPresheafedSpace
⊢ x ∈ ↑(RingedSpace.basicOpen (toRingedSpace X) 0) ↔ x ∈ ↑⊥

Next tactic:
simp only [RingedSpace.basicOpen, Opens.coe_mk, Set.mem_image, Set.mem_setOf_eq, Subtype.exists,
    exists_and_right, exists_eq_right, Opens.coe_bot, Set.mem_empty_iff_false,
    iff_false, not_exists]