Theorem: AlgebraicGeometry.RingedSpace.isUnit_res_of_isUnit_germ
File: Mathlib/AlgebraicGeometry/RingedSpace.lean

tactic: obtain ⟨g', heq⟩ := h.exists_right_inv
state_before: X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: obtain ⟨V, hxV, g, rfl⟩ := X.presheaf.germ_exist x.1 g'
state_before: case intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
g' : ↑(stalk X.presheaf ↑x)
heq : ↑(germ X.presheaf x) f * g' = 1
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: let W := U ⊓ V
state_before: case intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
heq :
  ↑(germ X.presheaf x) f * (CategoryTheory.forget CommRingCat).map (germ X.presheaf { val := ↑x, property := hxV }) g =
    1
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: have hxW : x.1 ∈ W := ⟨x.2, hxV⟩
state_before: case intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
heq :
  ↑(germ X.presheaf x) f * (CategoryTheory.forget CommRingCat).map (germ X.presheaf { val := ↑x, property := hxV }) g =
    1
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: replace heq : (X.presheaf.germ ⟨x.val, hxW⟩) ((X.presheaf.map (U.infLELeft V).op) f *
  (X.presheaf.map (U.infLERight V).op) g) = (X.presheaf.germ ⟨x.val, hxW⟩) 1
state_before: case intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
heq :
  ↑(germ X.presheaf x) f * (CategoryTheory.forget CommRingCat).map (germ X.presheaf { val := ↑x, property := hxV }) g =
    1
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: . dsimp [germ]
  erw [map_mul, map_one, show X.presheaf.germ ⟨x, hxW⟩ ((X.presheaf.map (U.infLELeft V).op) f) =
    X.presheaf.germ x f from X.presheaf.germ_res_apply (Opens.infLELeft U V) ⟨x.1, hxW⟩ f,
    show X.presheaf.germ ⟨x, hxW⟩ (X.presheaf.map (U.infLERight V).op g) =
    X.presheaf.germ ⟨x, hxV⟩ g from X.presheaf.germ_res_apply (Opens.infLERight U V) ⟨x.1, hxW⟩ g]
  exact heq
state_before: case heq
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
heq :
  ↑(germ X.presheaf x) f * (CategoryTheory.forget CommRingCat).map (germ X.presheaf { val := ↑x, property := hxV }) g =
    1
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
⊢ ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1

case intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: obtain ⟨W', hxW', i₁, i₂, heq'⟩ := X.presheaf.germ_eq x.1 hxW hxW _ _ heq
state_before: case intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: use W', i₁ ≫ Opens.infLELeft U V, hxW'
state_before: case intro.intro.intro.intro.intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
W' : Opens ↑↑X.toPresheafedSpace
hxW' : ↑x ∈ W'
i₁ i₂ : W' ⟶ W
heq' :
  (CategoryTheory.forget CommRingCat).map (X.presheaf.map i₁.op)
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    (CategoryTheory.forget CommRingCat).map (X.presheaf.map i₂.op) 1
⊢ ∃ V i x, IsUnit (↑(X.presheaf.map i.op) f)

tactic: change X.presheaf.map _ _ = X.presheaf.map _ _ at heq'
state_before: case intro.intro.intro.intro.intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
W' : Opens ↑↑X.toPresheafedSpace
hxW' : ↑x ∈ W'
i₁ i₂ : W' ⟶ W
heq' :
  (CategoryTheory.forget CommRingCat).map (X.presheaf.map i₁.op)
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    (CategoryTheory.forget CommRingCat).map (X.presheaf.map i₂.op) 1
⊢ IsUnit (↑(X.presheaf.map (i₁ ≫ Opens.infLELeft U V).op) f)

tactic: rw [map_one, map_mul] at heq'
state_before: case intro.intro.intro.intro.intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
W' : Opens ↑↑X.toPresheafedSpace
hxW' : ↑x ∈ W'
i₁ i₂ : W' ⟶ W
heq' :
  ↑(X.presheaf.map i₁.op)
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(X.presheaf.map i₂.op) 1
⊢ IsUnit (↑(X.presheaf.map (i₁ ≫ Opens.infLELeft U V).op) f)

tactic: change (X.presheaf.map _ ≫ X.presheaf.map _) _ * (X.presheaf.map _ ≫ _) _ = _ at heq'
state_before: case intro.intro.intro.intro.intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
W' : Opens ↑↑X.toPresheafedSpace
hxW' : ↑x ∈ W'
i₁ i₂ : W' ⟶ W
heq' :
  ↑(X.presheaf.map i₁.op) (↑(X.presheaf.map (Opens.infLELeft U V).op) f) *
      ↑(X.presheaf.map i₁.op) (↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    1
⊢ IsUnit (↑(X.presheaf.map (i₁ ≫ Opens.infLELeft U V).op) f)

tactic: rw [←X.presheaf.map_comp, ←op_comp] at heq'
state_before: case intro.intro.intro.intro.intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
W' : Opens ↑↑X.toPresheafedSpace
hxW' : ↑x ∈ W'
i₁ i₂ : W' ⟶ W
heq' :
  ↑(X.presheaf.map (Opens.infLELeft U V).op ≫ X.presheaf.map i₁.op) f *
      ↑(X.presheaf.map (Opens.infLERight U V).op ≫ X.presheaf.map i₁.op) g =
    1
⊢ IsUnit (↑(X.presheaf.map (i₁ ≫ Opens.infLELeft U V).op) f)

tactic: exact isUnit_of_mul_eq_one _ _ heq'
state_before: case intro.intro.intro.intro.intro.intro.intro.intro
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
heq :
  ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1
W' : Opens ↑↑X.toPresheafedSpace
hxW' : ↑x ∈ W'
i₁ i₂ : W' ⟶ W
heq' :
  ↑(X.presheaf.map (i₁ ≫ Opens.infLELeft U V).op) f *
      ↑(X.presheaf.map (Opens.infLERight U V).op ≫ X.presheaf.map i₁.op) g =
    1
⊢ IsUnit (↑(X.presheaf.map (i₁ ≫ Opens.infLELeft U V).op) f)

tactic: dsimp [germ]
state_before: case heq
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
heq :
  ↑(germ X.presheaf x) f * (CategoryTheory.forget CommRingCat).map (germ X.presheaf { val := ↑x, property := hxV }) g =
    1
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
⊢ ↑(germ X.presheaf { val := ↑x, property := hxW })
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(germ X.presheaf { val := ↑x, property := hxW }) 1

tactic: erw [map_mul, map_one, show X.presheaf.germ ⟨x, hxW⟩ ((X.presheaf.map (U.infLELeft V).op) f) =
  X.presheaf.germ x f from X.presheaf.germ_res_apply (Opens.infLELeft U V) ⟨x.1, hxW⟩ f,
  show X.presheaf.germ ⟨x, hxW⟩ (X.presheaf.map (U.infLERight V).op g) =
  X.presheaf.germ ⟨x, hxV⟩ g from X.presheaf.germ_res_apply (Opens.infLERight U V) ⟨x.1, hxW⟩ g]
state_before: case heq
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
heq :
  ↑(germ X.presheaf x) f * (CategoryTheory.forget CommRingCat).map (germ X.presheaf { val := ↑x, property := hxV }) g =
    1
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
⊢ ↑(Limits.colimit.ι (Functor.op (OpenNhds.inclusion ↑x) ⋙ X.presheaf)
          { obj := U ⊓ V, property := (_ : ↑{ val := ↑x, property := hxW } ∈ U ⊓ V) }.op)
      (↑(X.presheaf.map (Opens.infLELeft U V).op) f * ↑(X.presheaf.map (Opens.infLERight U V).op) g) =
    ↑(Limits.colimit.ι (Functor.op (OpenNhds.inclusion ↑x) ⋙ X.presheaf)
          { obj := U ⊓ V, property := (_ : ↑{ val := ↑x, property := hxW } ∈ U ⊓ V) }.op)
      1

tactic: exact heq
state_before: case heq
X : RingedSpace
U : Opens ↑↑X.toPresheafedSpace
f : ↑(X.presheaf.obj U.op)
x : { x // x ∈ U }
h : IsUnit (↑(germ X.presheaf x) f)
V : Opens ↑↑X.toPresheafedSpace
hxV : ↑x ∈ V
g : (CategoryTheory.forget CommRingCat).obj (X.presheaf.obj V.op)
heq :
  ↑(germ X.presheaf x) f * (CategoryTheory.forget CommRingCat).map (germ X.presheaf { val := ↑x, property := hxV }) g =
    1
W : Opens ↑↑X.toPresheafedSpace := U ⊓ V
hxW : ↑x ∈ W
⊢ ↑(germ X.presheaf x) f * ↑(germ X.presheaf { val := ↑x, property := hxV }) g = 1