l3lab/ntp-mathlib huggingface dataset:
theorem wbtw_iff_sameRay_vsub {x y z : P} : Wbtw R x y z ↔ SameRay R (y -ᵥ x) (z -ᵥ y) := by
  refine' ⟨Wbtw.sameRay_vsub, fun h => _⟩
  rcases h with (h | h | ⟨r₁, r₂, hr₁, hr₂, h⟩)
  · rw [vsub_eq_zero_iff_eq] at h
    simp [h]
  · rw [vsub_eq_zero_iff_eq] at h
    simp [h]
  · refine'
      ⟨r₂ / (r₁ + r₂),
        ⟨div_nonneg hr₂.le (add_nonneg hr₁.le hr₂.le),
          div_le_one_of_le (le_add_of_nonneg_left hr₁.le) (add_nonneg hr₁.le hr₂.le)⟩,
        _⟩
    have h' : z = r₂⁻¹ • r₁ • (y -ᵥ x) +ᵥ y := by simp [h, hr₂.ne']
    rw [eq_comm]
    simp only [lineMap_apply, h', vadd_vsub_assoc, smul_smul, ← add_smul, eq_vadd_iff_vsub_eq,
      smul_add]
    convert (one_smul R (y -ᵥ x)).symm
    

Proof state:
case h.e'_3.h.e'_5
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y z : P
r₁ r₂ : R
hr₁ : 0 < r₁
hr₂ : 0 < r₂
h : r₁ • (y -ᵥ x) = r₂ • (z -ᵥ y)
h' : z = r₂⁻¹ • r₁ • (y -ᵥ x) +ᵥ y
⊢ r₂ / (r₁ + r₂) * (r₂⁻¹ * r₁) + r₂ / (r₁ + r₂) = 1

Next tactic:
field_simp [(add_pos hr₁ hr₂).ne', hr₂.ne']
theorem wbtw_iff_sameRay_vsub {x y z : P} : Wbtw R x y z ↔ SameRay R (y -ᵥ x) (z -ᵥ y) := by
  refine' ⟨Wbtw.sameRay_vsub, fun h => _⟩
  rcases h with (h | h | ⟨r₁, r₂, hr₁, hr₂, h⟩)
  · rw [vsub_eq_zero_iff_eq] at h
    simp [h]
  · rw [vsub_eq_zero_iff_eq] at h
    simp [h]
  · refine'
      ⟨r₂ / (r₁ + r₂),
        ⟨div_nonneg hr₂.le (add_nonneg hr₁.le hr₂.le),
          div_le_one_of_le (le_add_of_nonneg_left hr₁.le) (add_nonneg hr₁.le hr₂.le)⟩,
        _⟩
    have h' : z = r₂⁻¹ • r₁ • (y -ᵥ x) +ᵥ y := by simp [h, hr₂.ne']
    rw [eq_comm]
    simp only [lineMap_apply, h', vadd_vsub_assoc, smul_smul, ← add_smul, eq_vadd_iff_vsub_eq,
      smul_add]
    convert (one_smul R (y -ᵥ x)).symm
    field_simp [(add_pos hr₁ hr₂).ne', hr₂.ne']
    

Proof state:
case h.e'_3.h.e'_5
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y z : P
r₁ r₂ : R
hr₁ : 0 < r₁
hr₂ : 0 < r₂
h : r₁ • (y -ᵥ x) = r₂ • (z -ᵥ y)
h' : z = r₂⁻¹ • r₁ • (y -ᵥ x) +ᵥ y
⊢ r₂ * r₁ * (r₁ + r₂) + r₂ * ((r₁ + r₂) * r₂) = (r₁ + r₂) * r₂ * (r₁ + r₂)

Next tactic:
ring
theorem wbtw_pointReflection (x y : P) : Wbtw R y x (pointReflection R x y) := by
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
⊢ Wbtw R y x ((pointReflection R x) y)

Next tactic:
refine' ⟨2⁻¹, ⟨by norm_num, by norm_num⟩, _⟩
theorem wbtw_pointReflection (x y : P) : Wbtw R y x (pointReflection R x y) := by
  refine' ⟨2⁻¹, ⟨by 

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
⊢ 0 ≤ 2⁻¹

Next tactic:
norm_num
theorem wbtw_pointReflection (x y : P) : Wbtw R y x (pointReflection R x y) := by
  refine' ⟨2⁻¹, ⟨by norm_num, by 

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
⊢ 2⁻¹ ≤ 1

Next tactic:
norm_num
theorem wbtw_pointReflection (x y : P) : Wbtw R y x (pointReflection R x y) := by
  refine' ⟨2⁻¹, ⟨by norm_num, by norm_num⟩, _⟩
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
⊢ (lineMap y ((pointReflection R x) y)) 2⁻¹ = x

Next tactic:
rw [lineMap_apply, pointReflection_apply, vadd_vsub_assoc, ← two_smul R (x -ᵥ y)]
theorem wbtw_pointReflection (x y : P) : Wbtw R y x (pointReflection R x y) := by
  refine' ⟨2⁻¹, ⟨by norm_num, by norm_num⟩, _⟩
  rw [lineMap_apply, pointReflection_apply, vadd_vsub_assoc, ← two_smul R (x -ᵥ y)]
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
⊢ 2⁻¹ • 2 • (x -ᵥ y) +ᵥ y = x

Next tactic:
simp
theorem sbtw_pointReflection_of_ne {x y : P} (h : x ≠ y) : Sbtw R y x (pointReflection R x y) := by
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
h : x ≠ y
⊢ Sbtw R y x ((pointReflection R x) y)

Next tactic:
refine' ⟨wbtw_pointReflection _ _ _, h, _⟩
theorem sbtw_pointReflection_of_ne {x y : P} (h : x ≠ y) : Sbtw R y x (pointReflection R x y) := by
  refine' ⟨wbtw_pointReflection _ _ _, h, _⟩
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
h : x ≠ y
⊢ x ≠ (pointReflection R x) y

Next tactic:
nth_rw 1 [← pointReflection_self R x]
theorem sbtw_pointReflection_of_ne {x y : P} (h : x ≠ y) : Sbtw R y x (pointReflection R x y) := by
  refine' ⟨wbtw_pointReflection _ _ _, h, _⟩
  nth_rw 1 [← pointReflection_self R x]
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
h : x ≠ y
⊢ (pointReflection R x) x ≠ (pointReflection R x) y

Next tactic:
exact (pointReflection_involutive R x).injective.ne h
theorem wbtw_midpoint (x y : P) : Wbtw R x (midpoint R x y) y := by
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
⊢ Wbtw R x (midpoint R x y) y

Next tactic:
convert wbtw_pointReflection R (midpoint R x y) x
theorem wbtw_midpoint (x y : P) : Wbtw R x (midpoint R x y) y := by
  convert wbtw_pointReflection R (midpoint R x y) x
  

Proof state:
case h.e'_10
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
⊢ y = (pointReflection R (midpoint R x y)) x

Next tactic:
rw [pointReflection_midpoint_left]
theorem sbtw_midpoint_of_ne {x y : P} (h : x ≠ y) : Sbtw R x (midpoint R x y) y := by
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
h : x ≠ y
⊢ Sbtw R x (midpoint R x y) y

Next tactic:
have h : midpoint R x y ≠ x := by simp [h]
theorem sbtw_midpoint_of_ne {x y : P} (h : x ≠ y) : Sbtw R x (midpoint R x y) y := by
  have h : midpoint R x y ≠ x := by 

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
h : x ≠ y
⊢ midpoint R x y ≠ x

Next tactic:
simp [h]
theorem sbtw_midpoint_of_ne {x y : P} (h : x ≠ y) : Sbtw R x (midpoint R x y) y := by
  have h : midpoint R x y ≠ x := by simp [h]
  

Proof state:
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
h✝ : x ≠ y
h : midpoint R x y ≠ x
⊢ Sbtw R x (midpoint R x y) y

Next tactic:
convert sbtw_pointReflection_of_ne R h
theorem sbtw_midpoint_of_ne {x y : P} (h : x ≠ y) : Sbtw R x (midpoint R x y) y := by
  have h : midpoint R x y ≠ x := by simp [h]
  convert sbtw_pointReflection_of_ne R h
  

Proof state:
case h.e'_10
R : Type u_1
V : Type u_2
V' : Type u_3
P : Type u_4
P' : Type u_5
inst✝³ : LinearOrderedField R
inst✝² : AddCommGroup V
inst✝¹ : Module R V
inst✝ : AddTorsor V P
x y : P
h✝ : x ≠ y
h : midpoint R x y ≠ x
⊢ y = (pointReflection R (midpoint R x y)) x

Next tactic:
rw [pointReflection_midpoint_left]
instance : MvQPF (Sigma F) where
  P := Sigma.P F
  abs {α} := @Sigma.abs _ _ F _ _ α
  repr {α} := @Sigma.repr _ _ F _ _ α
  abs_repr := by 

Proof state:
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
⊢ ∀ {α : TypeVec.{u} n} (x : Sigma F α), (fun {α} => Sigma.abs F) ((fun {α} => Sigma.repr F) x) = x

Next tactic:
rintro α ⟨x, f⟩
instance : MvQPF (Sigma F) where
  P := Sigma.P F
  abs {α} := @Sigma.abs _ _ F _ _ α
  repr {α} := @Sigma.repr _ _ F _ _ α
  abs_repr := by rintro α ⟨x, f⟩; 

Proof state:
case mk
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
α : TypeVec.{u} n
x : A
f : F x α
⊢ (fun {α} => Sigma.abs F) ((fun {α} => Sigma.repr F) { fst := x, snd := f }) = { fst := x, snd := f }

Next tactic:
simp only [Sigma.abs, Sigma.repr, Sigma.eta, abs_repr]
instance : MvQPF (Sigma F) where
  P := Sigma.P F
  abs {α} := @Sigma.abs _ _ F _ _ α
  repr {α} := @Sigma.repr _ _ F _ _ α
  abs_repr := by rintro α ⟨x, f⟩; simp only [Sigma.abs, Sigma.repr, Sigma.eta, abs_repr]
  abs_map := by 

Proof state:
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
⊢ ∀ {α β : TypeVec.{u} n} (f : α ⟹ β) (p : ↑(Sigma.P F) α),
    (fun {α} => Sigma.abs F) (f <$$> p) = f <$$> (fun {α} => Sigma.abs F) p

Next tactic:
rintro α β f ⟨x, g⟩
instance : MvQPF (Sigma F) where
  P := Sigma.P F
  abs {α} := @Sigma.abs _ _ F _ _ α
  repr {α} := @Sigma.repr _ _ F _ _ α
  abs_repr := by rintro α ⟨x, f⟩; simp only [Sigma.abs, Sigma.repr, Sigma.eta, abs_repr]
  abs_map := by rintro α β f ⟨x, g⟩; 

Proof state:
case mk
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
α β : TypeVec.{u} n
f : α ⟹ β
x : (Sigma.P F).A
g : MvPFunctor.B (Sigma.P F) x ⟹ α
⊢ (fun {α} => Sigma.abs F) (f <$$> { fst := x, snd := g }) = f <$$> (fun {α} => Sigma.abs F) { fst := x, snd := g }

Next tactic:
simp only [Sigma.abs, MvPFunctor.map_eq]
instance : MvQPF (Sigma F) where
  P := Sigma.P F
  abs {α} := @Sigma.abs _ _ F _ _ α
  repr {α} := @Sigma.repr _ _ F _ _ α
  abs_repr := by rintro α ⟨x, f⟩; simp only [Sigma.abs, Sigma.repr, Sigma.eta, abs_repr]
  abs_map := by rintro α β f ⟨x, g⟩; simp only [Sigma.abs, MvPFunctor.map_eq]
                

Proof state:
case mk
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
α β : TypeVec.{u} n
f : α ⟹ β
x : (Sigma.P F).A
g : MvPFunctor.B (Sigma.P F) x ⟹ α
⊢ { fst := x.fst, snd := abs { fst := x.snd, snd := f ⊚ g } } =
    f <$$> { fst := x.fst, snd := abs { fst := x.snd, snd := g } }

Next tactic:
simp only [(· <$$> ·), ← abs_map, ← MvPFunctor.map_eq]
instance : MvQPF (Pi F) where
  P := Pi.P F
  abs := @Pi.abs _ _ F _ _
  repr := @Pi.repr _ _ F _ _
  abs_repr := by 

Proof state:
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
⊢ ∀ {α : TypeVec.{u} n} (x : Pi F α), Pi.abs F (Pi.repr F x) = x

Next tactic:
rintro α f
instance : MvQPF (Pi F) where
  P := Pi.P F
  abs := @Pi.abs _ _ F _ _
  repr := @Pi.repr _ _ F _ _
  abs_repr := by rintro α f; 

Proof state:
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
α : TypeVec.{u} n
f : Pi F α
⊢ Pi.abs F (Pi.repr F f) = f

Next tactic:
simp only [Pi.abs, Pi.repr, Sigma.eta, abs_repr]
instance : MvQPF (Pi F) where
  P := Pi.P F
  abs := @Pi.abs _ _ F _ _
  repr := @Pi.repr _ _ F _ _
  abs_repr := by rintro α f; simp only [Pi.abs, Pi.repr, Sigma.eta, abs_repr]
  abs_map := by 

Proof state:
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
⊢ ∀ {α β : TypeVec.{u} n} (f : α ⟹ β) (p : ↑(Pi.P F) α), Pi.abs F (f <$$> p) = f <$$> Pi.abs F p

Next tactic:
rintro α β f ⟨x, g⟩
instance : MvQPF (Pi F) where
  P := Pi.P F
  abs := @Pi.abs _ _ F _ _
  repr := @Pi.repr _ _ F _ _
  abs_repr := by rintro α f; simp only [Pi.abs, Pi.repr, Sigma.eta, abs_repr]
  abs_map := by rintro α β f ⟨x, g⟩; 

Proof state:
case mk
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
α β : TypeVec.{u} n
f : α ⟹ β
x : (Pi.P F).A
g : MvPFunctor.B (Pi.P F) x ⟹ α
⊢ Pi.abs F (f <$$> { fst := x, snd := g }) = f <$$> Pi.abs F { fst := x, snd := g }

Next tactic:
simp only [Pi.abs, (· <$$> ·), ← abs_map]
instance : MvQPF (Pi F) where
  P := Pi.P F
  abs := @Pi.abs _ _ F _ _
  repr := @Pi.repr _ _ F _ _
  abs_repr := by rintro α f; simp only [Pi.abs, Pi.repr, Sigma.eta, abs_repr]
  abs_map := by rintro α β f ⟨x, g⟩; simp only [Pi.abs, (· <$$> ·), ← abs_map]; 

Proof state:
case mk
n : ℕ
A : Type u
F : A → TypeVec.{u} n → Type u
inst✝¹ : (α : A) → MvFunctor (F α)
inst✝ : (α : A) → MvQPF (F α)
α β : TypeVec.{u} n
f : α ⟹ β
x : (Pi.P F).A
g : MvPFunctor.B (Pi.P F) x ⟹ α
⊢ (match MvPFunctor.map (Pi.P F) f { fst := x, snd := g } with
    | { fst := a, snd := f } => fun x => abs { fst := a x, snd := fun i y => f i { fst := x, snd := y } }) =
    fun a => abs (MvPFunctor.map (P (F a)) f { fst := x a, snd := fun i y => g i { fst := a, snd := y } })

Next tactic:
rfl
/-- The spectrum, as a contravariant functor from commutative rings to topological spaces.
-/
@[simps! obj map]
def Spec.toTop : CommRingCatᵒᵖ ⥤ TopCat where
  obj R := Spec.topObj (unop R)
  map {R S} f := Spec.topMap f.unop
  map_id R := by 

Proof state:
R : CommRingCatᵒᵖ
⊢ { obj := fun R => topObj R.unop, map := fun {R S} f => topMap f.unop }.map (𝟙 R) =
    𝟙 ({ obj := fun R => topObj R.unop, map := fun {R S} f => topMap f.unop }.obj R)

Next tactic:
dsimp
/-- The spectrum, as a contravariant functor from commutative rings to topological spaces.
-/
@[simps! obj map]
def Spec.toTop : CommRingCatᵒᵖ ⥤ TopCat where
  obj R := Spec.topObj (unop R)
  map {R S} f := Spec.topMap f.unop
  map_id R := by dsimp; 

Proof state:
R : CommRingCatᵒᵖ
⊢ topMap (𝟙 R.unop) = 𝟙 (topObj R.unop)

Next tactic:
rw [Spec.topMap_id]
/-- The spectrum, as a contravariant functor from commutative rings to topological spaces.
-/
@[simps! obj map]
def Spec.toTop : CommRingCatᵒᵖ ⥤ TopCat where
  obj R := Spec.topObj (unop R)
  map {R S} f := Spec.topMap f.unop
  map_id R := by dsimp; rw [Spec.topMap_id]
  map_comp {R S T} f g := by 

Proof state:
R S T : CommRingCatᵒᵖ
f : R ⟶ S
g : S ⟶ T
⊢ { obj := fun R => topObj R.unop, map := fun {R S} f => topMap f.unop }.map (f ≫ g) =
    { obj := fun R => topObj R.unop, map := fun {R S} f => topMap f.unop }.map f ≫
      { obj := fun R => topObj R.unop, map := fun {R S} f => topMap f.unop }.map g

Next tactic:
dsimp
/-- The spectrum, as a contravariant functor from commutative rings to topological spaces.
-/
@[simps! obj map]
def Spec.toTop : CommRingCatᵒᵖ ⥤ TopCat where
  obj R := Spec.topObj (unop R)
  map {R S} f := Spec.topMap f.unop
  map_id R := by dsimp; rw [Spec.topMap_id]
  map_comp {R S T} f g := by dsimp; 

Proof state:
R S T : CommRingCatᵒᵖ
f : R ⟶ S
g : S ⟶ T
⊢ topMap (g.unop ≫ f.unop) = topMap f.unop ≫ topMap g.unop

Next tactic:
rw [Spec.topMap_comp]
@[simp]
theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
    Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
    

Proof state:
R : CommRingCat
⊢ (sheafedSpaceMap (𝟙 R)).c ≫
      whiskerRight
        (eqToHom
          (_ :
            (TopologicalSpace.Opens.map (sheafedSpaceMap (𝟙 R)).base).op =
              (TopologicalSpace.Opens.map (𝟙 (sheafedSpaceObj R)).base).op))
        (sheafedSpaceObj R).toPresheafedSpace.presheaf =
    (𝟙 (sheafedSpaceObj R)).c

Next tactic:
ext U
@[simp]
theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
    Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
    ext U
    

Proof state:
case w.w
R : CommRingCat
U : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U))
⊢ (((sheafedSpaceMap (𝟙 R)).c ≫
            whiskerRight
              (eqToHom
                (_ :
                  (TopologicalSpace.Opens.map (sheafedSpaceMap (𝟙 R)).base).op =
                    (TopologicalSpace.Opens.map (𝟙 (sheafedSpaceObj R)).base).op))
              (sheafedSpaceObj R).toPresheafedSpace.presheaf).app
        (op U))
      x✝ =
    ((𝟙 (sheafedSpaceObj R)).c.app (op U)) x✝

Next tactic:
dsimp
@[simp]
theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
    Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
    ext U
    dsimp
    

Proof state:
case w.w
R : CommRingCat
U : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U))
⊢ (((sheafedSpaceMap (𝟙 R)).c ≫
            whiskerRight (𝟙 (TopologicalSpace.Opens.map (topMap (𝟙 R))).op) (structureSheaf ↑R).val).app
        (op U))
      x✝ =
    ((𝟙 (sheafedSpaceObj R)).c.app (op U)) x✝

Next tactic:
erw [NatTrans.comp_app, sheafedSpaceMap_c_app, PresheafedSpace.id_c_app, comap_id]
@[simp]
theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
    Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
    ext U
    dsimp
    erw [NatTrans.comp_app, sheafedSpaceMap_c_app, PresheafedSpace.id_c_app, comap_id]; 

Proof state:
case w.w
R : CommRingCat
U : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U))
⊢ (eqToHom
          (_ :
            (structureSheaf ↑R).val.obj (op (op U).unop) =
              (structureSheaf ↑R).val.obj (op ((TopologicalSpace.Opens.map (topMap (𝟙 R))).obj (op U).unop))) ≫
        (whiskerRight (𝟙 (TopologicalSpace.Opens.map (topMap (𝟙 R))).op) (structureSheaf ↑R).val).app (op U))
      x✝ =
    ((sheafedSpaceObj R).toPresheafedSpace.presheaf.map (𝟙 (op U))) x✝
case w.w.hUV
R : CommRingCat
U : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U))
⊢ (op U).unop = (TopologicalSpace.Opens.map (topMap (𝟙 R))).obj (op U).unop

Next tactic:
swap
@[simp]
theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
    Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
    ext U
    dsimp
    erw [NatTrans.comp_app, sheafedSpaceMap_c_app, PresheafedSpace.id_c_app, comap_id]; swap
    · 

Proof state:
case w.w.hUV
R : CommRingCat
U : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U))
⊢ (op U).unop = (TopologicalSpace.Opens.map (topMap (𝟙 R))).obj (op U).unop

Next tactic:
rw [Spec.topMap_id, TopologicalSpace.Opens.map_id_obj_unop]
@[simp]
theorem Spec.sheafedSpaceMap_id {R : CommRingCat} :
    Spec.sheafedSpaceMap (𝟙 R) = 𝟙 (Spec.sheafedSpaceObj R) :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_id R) <| by
    ext U
    dsimp
    erw [NatTrans.comp_app, sheafedSpaceMap_c_app, PresheafedSpace.id_c_app, comap_id]; swap
    · rw [Spec.topMap_id, TopologicalSpace.Opens.map_id_obj_unop]
    

Proof state:
case w.w
R : CommRingCat
U : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U))
⊢ (eqToHom
          (_ :
            (structureSheaf ↑R).val.obj (op (op U).unop) =
              (structureSheaf ↑R).val.obj (op ((TopologicalSpace.Opens.map (topMap (𝟙 R))).obj (op U).unop))) ≫
        (whiskerRight (𝟙 (TopologicalSpace.Opens.map (topMap (𝟙 R))).op) (structureSheaf ↑R).val).app (op U))
      x✝ =
    ((sheafedSpaceObj R).toPresheafedSpace.presheaf.map (𝟙 (op U))) x✝

Next tactic:
simp [eqToHom_map]
theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
    Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <| by
    

Proof state:
R S T : CommRingCat
f : R ⟶ S
g : S ⟶ T
⊢ (sheafedSpaceMap (f ≫ g)).c ≫
      whiskerRight
        (eqToHom
          (_ :
            (TopologicalSpace.Opens.map (sheafedSpaceMap (f ≫ g)).base).op =
              (TopologicalSpace.Opens.map (sheafedSpaceMap g ≫ sheafedSpaceMap f).base).op))
        (sheafedSpaceObj T).toPresheafedSpace.presheaf =
    (sheafedSpaceMap g ≫ sheafedSpaceMap f).c

Next tactic:
ext
theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
    Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <| by
    ext
    -- Porting note : was one liner
    -- `dsimp, rw category_theory.functor.map_id, rw category.comp_id, erw comap_comp f g, refl`
    

Proof state:
case w.w
R S T : CommRingCat
f : R ⟶ S
g : S ⟶ T
U✝ : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U✝))
⊢ (((sheafedSpaceMap (f ≫ g)).c ≫
            whiskerRight
              (eqToHom
                (_ :
                  (TopologicalSpace.Opens.map (sheafedSpaceMap (f ≫ g)).base).op =
                    (TopologicalSpace.Opens.map (sheafedSpaceMap g ≫ sheafedSpaceMap f).base).op))
              (sheafedSpaceObj T).toPresheafedSpace.presheaf).app
        (op U✝))
      x✝ =
    ((sheafedSpaceMap g ≫ sheafedSpaceMap f).c.app (op U✝)) x✝

Next tactic:
rw [NatTrans.comp_app, sheafedSpaceMap_c_app, whiskerRight_app, eqToHom_refl]
theorem Spec.sheafedSpaceMap_comp {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) :
    Spec.sheafedSpaceMap (f ≫ g) = Spec.sheafedSpaceMap g ≫ Spec.sheafedSpaceMap f :=
  AlgebraicGeometry.PresheafedSpace.Hom.ext _ _ (Spec.topMap_comp f g) <| by
    ext
    -- Porting note : was one liner
    -- `dsimp, rw category_theory.functor.map_id, rw category.comp_id, erw comap_comp f g, refl`
    rw [NatTrans.comp_app, sheafedSpaceMap_c_app, whiskerRight_app, eqToHom_refl]
    

Proof state:
case w.w
R S T : CommRingCat
f : R ⟶ S
g : S ⟶ T
U✝ : TopologicalSpace.Opens ↑↑(sheafedSpaceObj R).toPresheafedSpace
x✝ : (forget CommRingCat).obj ((sheafedSpaceObj R).toPresheafedSpace.presheaf.obj (op U✝))
⊢ (comap (f ≫ g) (op U✝).unop ((TopologicalSpace.Opens.map (topMap (f ≫ g))).obj (op U✝).unop)
          (_ :
            ∀ x ∈ ((TopologicalSpace.Opens.map (topMap (f ≫ g))).obj (op U✝).unop).carrier,
              x ∈ ((TopologicalSpace.Opens.map (topMap (f ≫ g))).obj (op U✝).unop).carrier) ≫
        (sheafedSpaceObj T).toPresheafedSpace.presheaf.map
          ((𝟙 (TopologicalSpace.Opens.map (sheafedSpaceMap (f ≫ g)).base).op).app (op U✝)))
      x✝ =
    ((sheafedSpaceMap g ≫ sheafedSpaceMap f).c.app (op U✝)) x✝

Next tactic:
erw [(sheafedSpaceObj T).presheaf.map_id, Category.comp_id, comap_comp]