/-- The induction step for the existence and uniqueness of the
circumcenter.  Given a nonempty set of points in a nonempty affine
subspace whose direction is complete, such that there is a unique
(circumcenter, circumradius) pair for those points in that subspace,
and a point `p` not in that subspace, there is a unique (circumcenter,
circumradius) pair for the set with `p` added, in the span of the
subspace with `p` added. -/
theorem existsUnique_dist_eq_of_insert {s : AffineSubspace ℝ P}
    [HasOrthogonalProjection s.direction] {ps : Set P} (hnps : ps.Nonempty) {p : P} (hps : ps ⊆ s)
    (hp : p ∉ s) (hu : ∃! cs : Sphere P, cs.center ∈ s ∧ ps ⊆ (cs : Set P)) :
    ∃! cs₂ : Sphere P,
      cs₂.center ∈ affineSpan ℝ (insert p (s : Set P)) ∧ insert p ps ⊆ (cs₂ : Set P) := by
  haveI : Nonempty s := Set.Nonempty.to_subtype (hnps.mono hps)
  rcases hu with ⟨⟨cc, cr⟩, ⟨hcc, hcr⟩, hcccru⟩
  simp only at hcc hcr hcccru
  let x := dist cc (orthogonalProjection s p)
  let y := dist p (orthogonalProjection s p)
  have hy0 : y ≠ 0 := dist_orthogonalProjection_ne_zero_of_not_mem hp
  let ycc₂ := (x * x + y * y - cr * cr) / (2 * y)
  let cc₂ := (ycc₂ / y) • (p -ᵥ orthogonalProjection s p : V) +ᵥ cc
  let cr₂ := Real.sqrt (cr * cr + ycc₂ * ycc₂)
  use ⟨cc₂, cr₂⟩
  simp (config := { zeta := false, proj := false }) only
  have hpo : p = (1 : ℝ) • (p -ᵥ orthogonalProjection s p : V) +ᵥ (orthogonalProjection s p : P) :=
    by simp
  constructor
  · constructor
    · refine' vadd_mem_of_mem_direction _ (mem_affineSpan ℝ (Set.mem_insert_of_mem _ hcc))
      rw [direction_affineSpan]
      exact
        Submodule.smul_mem _ _
          (vsub_mem_vectorSpan ℝ (Set.mem_insert _ _)
            (Set.mem_insert_of_mem _ (orthogonalProjection_mem _)))
    · intro p1 hp1
      rw [Sphere.mem_coe, mem_sphere, ← mul_self_inj_of_nonneg dist_nonneg (Real.sqrt_nonneg _),
        Real.mul_self_sqrt (add_nonneg (mul_self_nonneg _) (mul_self_nonneg _))]
      cases' hp1 with hp1 hp1
      · rw [hp1]
        rw [hpo,
          dist_sq_smul_orthogonal_vadd_smul_orthogonal_vadd (orthogonalProjection_mem p) hcc _ _
            (vsub_orthogonalProjection_mem_direction_orthogonal s p),
          ← dist_eq_norm_vsub V p, dist_comm _ cc]
        field_simp [hy0]
        

Proof state:
case h.left.right.inl
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
s : AffineSubspace ℝ P
inst✝ : HasOrthogonalProjection (direction s)
ps : Set P
hnps : Set.Nonempty ps
p : P
hps : ps ⊆ ↑s
hp : p ∉ s
this : Nonempty ↥s
cc : P
cr : ℝ
hcccru : ∀ (y : Sphere P), y.center ∈ s ∧ ps ⊆ Metric.sphere y.center y.radius → y = { center := cc, radius := cr }
hcc : cc ∈ s
hcr : ps ⊆ Metric.sphere cc cr
x : ℝ := dist cc ↑((orthogonalProjection s) p)
y : ℝ := dist p ↑((orthogonalProjection s) p)
hy0 : y ≠ 0
ycc₂ : ℝ := (x * x + y * y - cr * cr) / (2 * y)
cc₂ : P := (ycc₂ / y) • (p -ᵥ ↑((orthogonalProjection s) p)) +ᵥ cc
cr₂ : ℝ := Real.sqrt (cr * cr + ycc₂ * ycc₂)
hpo : p = 1 • (p -ᵥ ↑((orthogonalProjection s) p)) +ᵥ ↑((orthogonalProjection s) p)
p1 : P
hp1 : p1 = p
⊢ (dist cc ↑((orthogonalProjection s) p) * dist cc ↑((orthogonalProjection s) p) *
          (2 * dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) *
            (2 * dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p))) +
        (2 * dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) -
              (dist cc ↑((orthogonalProjection s) p) * dist cc ↑((orthogonalProjection s) p) +
                  dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) -
                cr * cr)) *
            (2 * dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) -
              (dist cc ↑((orthogonalProjection s) p) * dist cc ↑((orthogonalProjection s) p) +
                  dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) -
                cr * cr)) *
          (dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p))) *
      (2 * dist p ↑((orthogonalProjection s) p) * (2 * dist p ↑((orthogonalProjection s) p))) =
    (cr * cr * (2 * dist p ↑((orthogonalProjection s) p) * (2 * dist p ↑((orthogonalProjection s) p))) +
        (dist cc ↑((orthogonalProjection s) p) * dist cc ↑((orthogonalProjection s) p) +
              dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) -
            cr * cr) *
          (dist cc ↑((orthogonalProjection s) p) * dist cc ↑((orthogonalProjection s) p) +
              dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) -
            cr * cr)) *
      (2 * dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p) *
        (2 * dist p ↑((orthogonalProjection s) p) * dist p ↑((orthogonalProjection s) p)))

Next tactic:
ring