l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem stereographic_neg_apply (v : sphere (0 : E) 1) :
    stereographic (norm_eq_of_mem_sphere (-v)) v = 0 := by
  convert stereographic_apply_neg (-v)
  ext1
  

Proof state:
case h.e'_2.h.e'_6.a
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
v✝ : E
v : ↑(sphere 0 1)
⊢ ↑v = ↑(- -v)

Next tactic:
simp
@[simp]
theorem stereographic'_source {n : ℕ} [Fact (finrank ℝ E = n + 1)] (v : sphere (0 : E) 1) :
    (stereographic' n v).source = {v}ᶜ := by 

Proof state:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v : ↑(sphere 0 1)
⊢ (stereographic' n v).toPartialEquiv.source = {v}ᶜ

Next tactic:
simp [stereographic']
@[simp]
theorem stereographic'_target {n : ℕ} [Fact (finrank ℝ E = n + 1)] (v : sphere (0 : E) 1) :
    (stereographic' n v).target = Set.univ := by 

Proof state:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v : ↑(sphere 0 1)
⊢ (stereographic' n v).toPartialEquiv.target = Set.univ

Next tactic:
simp [stereographic']
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a charted space
modelled on the Euclidean space of dimension `n`. -/
instance chartedSpace {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    ChartedSpace (EuclideanSpace ℝ (Fin n)) (sphere (0 : E) 1) where
  atlas := {f | ∃ v : sphere (0 : E) 1, f = stereographic' n v}
  chartAt v := stereographic' n (-v)
  mem_chart_source v := by 

Proof state:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v : ↑(sphere 0 1)
⊢ v ∈ ((fun v => stereographic' n (-v)) v).source

Next tactic:
simpa using ne_neg_of_mem_unit_sphere ℝ v
theorem sphere_ext_iff (u v : sphere (0 : E) 1) : u = v ↔ ⟪(u : E), v⟫_ℝ = 1 := by
  

Proof state:
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace ℝ E
u v : ↑(sphere 0 1)
⊢ u = v ↔ inner ↑u ↑v = 1

Next tactic:
simp [Subtype.ext_iff, inner_eq_one_iff_of_norm_one]
theorem stereographic'_symm_apply {n : ℕ} [Fact (finrank ℝ E = n + 1)] (v : sphere (0 : E) 1)
    (x : EuclideanSpace ℝ (Fin n)) :
    ((stereographic' n v).symm x : E) =
      let U : (ℝ ∙ (v : E))ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
        (OrthonormalBasis.fromOrthogonalSpanSingleton n (ne_zero_of_mem_unit_sphere v)).repr
      (‖(U.symm x : E)‖ ^ 2 + 4)⁻¹ • (4 : ℝ) • (U.symm x : E) +
        (‖(U.symm x : E)‖ ^ 2 + 4)⁻¹ • (‖(U.symm x : E)‖ ^ 2 - 4) • v.val :=
  by 

Proof state:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v : ↑(sphere 0 1)
x : EuclideanSpace ℝ (Fin n)
⊢ ↑(↑(PartialHomeomorph.symm (stereographic' n v)) x) =
    let U := (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr;
    (‖↑((LinearIsometryEquiv.symm U) x)‖ ^ 2 + 4)⁻¹ • 4 • ↑((LinearIsometryEquiv.symm U) x) +
      (‖↑((LinearIsometryEquiv.symm U) x)‖ ^ 2 + 4)⁻¹ • (‖↑((LinearIsometryEquiv.symm U) x)‖ ^ 2 - 4) • ↑v

Next tactic:
simp [real_inner_comm, stereographic, stereographic', ← Submodule.coe_norm]
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      

Proof state:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
⊢ ∀ (e e' : PartialHomeomorph (↑(sphere 0 1)) (EuclideanSpace ℝ (Fin n))),
    e ∈ atlas (EuclideanSpace ℝ (Fin n)) ↑(sphere 0 1) →
      e' ∈ atlas (EuclideanSpace ℝ (Fin n)) ↑(sphere 0 1) →
        ContDiffOn ℝ ⊤
          (↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) ∘
            ↑(PartialHomeomorph.symm e ≫ₕ e') ∘ ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))))
          (↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
              (PartialHomeomorph.symm e ≫ₕ e').toPartialEquiv.source ∩
            Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)))

Next tactic:
rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      

Proof state:
case intro.intro
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
⊢ ContDiffOn ℝ ⊤
    (↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) ∘
      ↑(PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v') ∘
        ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))))
    (↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
        (PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v').toPartialEquiv.source ∩
      Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)))

Next tactic:
let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      

Proof state:
case intro.intro
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
⊢ ContDiffOn ℝ ⊤
    (↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) ∘
      ↑(PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v') ∘
        ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))))
    (↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
        (PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v').toPartialEquiv.source ∩
      Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)))

Next tactic:
let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
      

Proof state:
case intro.intro
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
U' : ↥(Submodule.span ℝ {↑v'})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v' ≠ 0)).repr
⊢ ContDiffOn ℝ ⊤
    (↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) ∘
      ↑(PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v') ∘
        ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))))
    (↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
        (PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v').toPartialEquiv.source ∩
      Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)))

Next tactic:
have H₁ := U'.contDiff.comp_contDiffOn contDiffOn_stereoToFun
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
      have H₁ := U'.contDiff.comp_contDiffOn contDiffOn_stereoToFun
      -- Porting note: need to help with implicit variables again
      

Proof state:
case intro.intro
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
U' : ↥(Submodule.span ℝ {↑v'})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v' ≠ 0)).repr
H₁ : ContDiffOn ℝ ⊤ (⇑U' ∘ stereoToFun ↑v') {x | ((innerSL ℝ) ↑v') x ≠ 1}
⊢ ContDiffOn ℝ ⊤
    (↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) ∘
      ↑(PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v') ∘
        ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))))
    (↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
        (PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v').toPartialEquiv.source ∩
      Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)))

Next tactic:
have H₂ := (contDiff_stereoInvFunAux (v := v.val)|>.comp
        (ℝ ∙ (v : E))ᗮ.subtypeL.contDiff).comp U.symm.contDiff
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
      have H₁ := U'.contDiff.comp_contDiffOn contDiffOn_stereoToFun
      -- Porting note: need to help with implicit variables again
      have H₂ := (contDiff_stereoInvFunAux (v := v.val)|>.comp
        (ℝ ∙ (v : E))ᗮ.subtypeL.contDiff).comp U.symm.contDiff
      

Proof state:
case intro.intro
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
U' : ↥(Submodule.span ℝ {↑v'})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v' ≠ 0)).repr
H₁ : ContDiffOn ℝ ⊤ (⇑U' ∘ stereoToFun ↑v') {x | ((innerSL ℝ) ↑v') x ≠ 1}
H₂ :
  ContDiff ℝ ⊤ ((stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘ ⇑(LinearIsometryEquiv.symm U))
⊢ ContDiffOn ℝ ⊤
    (↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) ∘
      ↑(PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v') ∘
        ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))))
    (↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
        (PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v').toPartialEquiv.source ∩
      Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)))

Next tactic:
convert H₁.comp' (H₂.contDiffOn : ContDiffOn ℝ ⊤ _ Set.univ) using 1
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
      have H₁ := U'.contDiff.comp_contDiffOn contDiffOn_stereoToFun
      -- Porting note: need to help with implicit variables again
      have H₂ := (contDiff_stereoInvFunAux (v := v.val)|>.comp
        (ℝ ∙ (v : E))ᗮ.subtypeL.contDiff).comp U.symm.contDiff
      convert H₁.comp' (H₂.contDiffOn : ContDiffOn ℝ ⊤ _ Set.univ) using 1
      -- -- squeezed from `ext, simp [sphere_ext_iff, stereographic'_symm_apply, real_inner_comm]`
      

Proof state:
case h.e'_11
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
U' : ↥(Submodule.span ℝ {↑v'})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v' ≠ 0)).repr
H₁ : ContDiffOn ℝ ⊤ (⇑U' ∘ stereoToFun ↑v') {x | ((innerSL ℝ) ↑v') x ≠ 1}
H₂ :
  ContDiff ℝ ⊤ ((stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘ ⇑(LinearIsometryEquiv.symm U))
⊢ ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
        (PartialHomeomorph.symm (stereographic' n v) ≫ₕ stereographic' n v').toPartialEquiv.source ∩
      Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) =
    Set.univ ∩
      (stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘ ⇑(LinearIsometryEquiv.symm U) ⁻¹'
        {x | ((innerSL ℝ) ↑v') x ≠ 1}

Next tactic:
simp only [PartialHomeomorph.trans_toPartialEquiv, PartialHomeomorph.symm_toPartialEquiv,
        PartialEquiv.trans_source, PartialEquiv.symm_source, stereographic'_target,
        stereographic'_source]
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
      have H₁ := U'.contDiff.comp_contDiffOn contDiffOn_stereoToFun
      -- Porting note: need to help with implicit variables again
      have H₂ := (contDiff_stereoInvFunAux (v := v.val)|>.comp
        (ℝ ∙ (v : E))ᗮ.subtypeL.contDiff).comp U.symm.contDiff
      convert H₁.comp' (H₂.contDiffOn : ContDiffOn ℝ ⊤ _ Set.univ) using 1
      -- -- squeezed from `ext, simp [sphere_ext_iff, stereographic'_symm_apply, real_inner_comm]`
      simp only [PartialHomeomorph.trans_toPartialEquiv, PartialHomeomorph.symm_toPartialEquiv,
        PartialEquiv.trans_source, PartialEquiv.symm_source, stereographic'_target,
        stereographic'_source]
      

Proof state:
case h.e'_11
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
U' : ↥(Submodule.span ℝ {↑v'})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v' ≠ 0)).repr
H₁ : ContDiffOn ℝ ⊤ (⇑U' ∘ stereoToFun ↑v') {x | ((innerSL ℝ) ↑v') x ≠ 1}
H₂ :
  ContDiff ℝ ⊤ ((stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘ ⇑(LinearIsometryEquiv.symm U))
⊢ ↑(ModelWithCorners.symm 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ⁻¹'
        (Set.univ ∩ ↑(PartialEquiv.symm (stereographic' n v).toPartialEquiv) ⁻¹' {v'}ᶜ) ∩
      Set.range ↑𝓘(ℝ, EuclideanSpace ℝ (Fin n)) =
    Set.univ ∩
      (stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘
          ⇑(LinearIsometryEquiv.symm (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr) ⁻¹'
        {x | ((innerSL ℝ) ↑v') x ≠ 1}

Next tactic:
simp only [modelWithCornersSelf_coe, modelWithCornersSelf_coe_symm, Set.preimage_id,
        Set.range_id, Set.inter_univ, Set.univ_inter, Set.compl_singleton_eq, Set.preimage_setOf_eq]
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
      have H₁ := U'.contDiff.comp_contDiffOn contDiffOn_stereoToFun
      -- Porting note: need to help with implicit variables again
      have H₂ := (contDiff_stereoInvFunAux (v := v.val)|>.comp
        (ℝ ∙ (v : E))ᗮ.subtypeL.contDiff).comp U.symm.contDiff
      convert H₁.comp' (H₂.contDiffOn : ContDiffOn ℝ ⊤ _ Set.univ) using 1
      -- -- squeezed from `ext, simp [sphere_ext_iff, stereographic'_symm_apply, real_inner_comm]`
      simp only [PartialHomeomorph.trans_toPartialEquiv, PartialHomeomorph.symm_toPartialEquiv,
        PartialEquiv.trans_source, PartialEquiv.symm_source, stereographic'_target,
        stereographic'_source]
      simp only [modelWithCornersSelf_coe, modelWithCornersSelf_coe_symm, Set.preimage_id,
        Set.range_id, Set.inter_univ, Set.univ_inter, Set.compl_singleton_eq, Set.preimage_setOf_eq]
      

Proof state:
case h.e'_11
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
U' : ↥(Submodule.span ℝ {↑v'})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v' ≠ 0)).repr
H₁ : ContDiffOn ℝ ⊤ (⇑U' ∘ stereoToFun ↑v') {x | ((innerSL ℝ) ↑v') x ≠ 1}
H₂ :
  ContDiff ℝ ⊤ ((stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘ ⇑(LinearIsometryEquiv.symm U))
⊢ {a | ↑(PartialEquiv.symm (stereographic' n v).toPartialEquiv) (id a) ≠ v'} =
    {a |
      ((innerSL ℝ) ↑v')
          (((stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘
              ⇑(LinearIsometryEquiv.symm (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr))
            a) ≠
        1}

Next tactic:
simp only [id.def, comp_apply, Submodule.subtypeL_apply, PartialHomeomorph.coe_coe_symm,
        innerSL_apply, Ne.def, sphere_ext_iff, real_inner_comm (v' : E)]
/-- The unit sphere in an `n + 1`-dimensional inner product space `E` is a smooth manifold,
modelled on the Euclidean space of dimension `n`. -/
instance smoothMfldWithCorners {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    SmoothManifoldWithCorners (𝓡 n) (sphere (0 : E) 1) :=
  smoothManifoldWithCorners_of_contDiffOn (𝓡 n) (sphere (0 : E) 1)
    (by
      rintro _ _ ⟨v, rfl⟩ ⟨v', rfl⟩
      let U :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v)).repr
      let U' :=
        (-- Removed type ascription, and this helped for some reason with timeout issues?
            OrthonormalBasis.fromOrthogonalSpanSingleton (𝕜 := ℝ)
            n (ne_zero_of_mem_unit_sphere v')).repr
      have H₁ := U'.contDiff.comp_contDiffOn contDiffOn_stereoToFun
      -- Porting note: need to help with implicit variables again
      have H₂ := (contDiff_stereoInvFunAux (v := v.val)|>.comp
        (ℝ ∙ (v : E))ᗮ.subtypeL.contDiff).comp U.symm.contDiff
      convert H₁.comp' (H₂.contDiffOn : ContDiffOn ℝ ⊤ _ Set.univ) using 1
      -- -- squeezed from `ext, simp [sphere_ext_iff, stereographic'_symm_apply, real_inner_comm]`
      simp only [PartialHomeomorph.trans_toPartialEquiv, PartialHomeomorph.symm_toPartialEquiv,
        PartialEquiv.trans_source, PartialEquiv.symm_source, stereographic'_target,
        stereographic'_source]
      simp only [modelWithCornersSelf_coe, modelWithCornersSelf_coe_symm, Set.preimage_id,
        Set.range_id, Set.inter_univ, Set.univ_inter, Set.compl_singleton_eq, Set.preimage_setOf_eq]
      simp only [id.def, comp_apply, Submodule.subtypeL_apply, PartialHomeomorph.coe_coe_symm,
        innerSL_apply, Ne.def, sphere_ext_iff, real_inner_comm (v' : E)]
      

Proof state:
case h.e'_11
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
v v' : ↑(sphere 0 1)
U : ↥(Submodule.span ℝ {↑v})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr
U' : ↥(Submodule.span ℝ {↑v'})ᗮ ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n) :=
  (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v' ≠ 0)).repr
H₁ : ContDiffOn ℝ ⊤ (⇑U' ∘ stereoToFun ↑v') {x | ((innerSL ℝ) ↑v') x ≠ 1}
H₂ :
  ContDiff ℝ ⊤ ((stereoInvFunAux ↑v ∘ ⇑(Submodule.subtypeL (Submodule.span ℝ {↑v})ᗮ)) ∘ ⇑(LinearIsometryEquiv.symm U))
⊢ {a | ¬inner ↑v' ↑(↑(PartialHomeomorph.symm (stereographic' n v)) a) = 1} =
    {a |
      ¬inner (↑v')
            (stereoInvFunAux ↑v
              ↑((LinearIsometryEquiv.symm (OrthonormalBasis.fromOrthogonalSpanSingleton n (_ : ↑v ≠ 0)).repr) a)) =
          1}

Next tactic:
rfl
/-- The inclusion map (i.e., `coe`) from the sphere in `E` to `E` is smooth.  -/
theorem contMDiff_coe_sphere {n : ℕ} [Fact (finrank ℝ E = n + 1)] :
    ContMDiff (𝓡 n) 𝓘(ℝ, E) ∞ ((↑) : sphere (0 : E) 1 → E) := by
  -- Porting note: trouble with filling these implicit variables in the instance
  

Proof state:
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace ℝ E
n : ℕ
inst✝ : Fact (finrank ℝ E = n + 1)
⊢ ContMDiff 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) 𝓘(ℝ, E) ⊤ Subtype.val

Next tactic:
have := smoothMfldWithCorners (E := E) (n := n)