[GOAL]
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✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
p1 p2 p3 : P
hp1 : p1 ∈ s
hp2 : p2 ∈ s
⊢ dist p1 p3 = dist p2 p3 ↔ dist p1 ↑(↑(orthogonalProjection s) p3) = dist p2 ↑(↑(orthogonalProjection s) p3)
[PROOFSTEP]
rw [← mul_self_inj_of_nonneg dist_nonneg dist_nonneg, ← mul_self_inj_of_nonneg dist_nonneg dist_nonneg,
  dist_sq_eq_dist_orthogonalProjection_sq_add_dist_orthogonalProjection_sq p3 hp1,
  dist_sq_eq_dist_orthogonalProjection_sq_add_dist_orthogonalProjection_sq p3 hp2]
[GOAL]
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✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
p1 p2 p3 : P
hp1 : p1 ∈ s
hp2 : p2 ∈ s
⊢ dist p1 ↑(↑(orthogonalProjection s) p3) * dist p1 ↑(↑(orthogonalProjection s) p3) +
        dist p3 ↑(↑(orthogonalProjection s) p3) * dist p3 ↑(↑(orthogonalProjection s) p3) =
      dist p2 ↑(↑(orthogonalProjection s) p3) * dist p2 ↑(↑(orthogonalProjection s) p3) +
        dist p3 ↑(↑(orthogonalProjection s) p3) * dist p3 ↑(↑(orthogonalProjection s) p3) ↔
    dist p1 ↑(↑(orthogonalProjection s) p3) * dist p1 ↑(↑(orthogonalProjection s) p3) =
      dist p2 ↑(↑(orthogonalProjection s) p3) * dist p2 ↑(↑(orthogonalProjection s) p3)
[PROOFSTEP]
simp
[GOAL]
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✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
ps : Set P
hps : ps ⊆ ↑s
p : P
⊢ (∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 p = r) ↔ ∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 ↑(↑(orthogonalProjection s) p) = r
[PROOFSTEP]
have h := dist_set_eq_iff_dist_orthogonalProjection_eq hps p
[GOAL]
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✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
ps : Set P
hps : ps ⊆ ↑s
p : P
h :
  (Set.Pairwise ps fun p1 p2 => dist p1 p = dist p2 p) ↔
    Set.Pairwise ps fun p1 p2 => dist p1 ↑(↑(orthogonalProjection s) p) = dist p2 ↑(↑(orthogonalProjection s) p)
⊢ (∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 p = r) ↔ ∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 ↑(↑(orthogonalProjection s) p) = r
[PROOFSTEP]
simp_rw [Set.pairwise_eq_iff_exists_eq] at h 
[GOAL]
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✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
ps : Set P
hps : ps ⊆ ↑s
p : P
h : (∃ z, ∀ (x : P), x ∈ ps → dist x p = z) ↔ ∃ z, ∀ (x : P), x ∈ ps → dist x ↑(↑(orthogonalProjection s) p) = z
⊢ (∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 p = r) ↔ ∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 ↑(↑(orthogonalProjection s) p) = r
[PROOFSTEP]
exact h
[GOAL]
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
hu : ∃! cs, cs.center ∈ s ∧ ps ⊆ Metric.sphere cs.center cs.radius
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
haveI : Nonempty s := Set.Nonempty.to_subtype (hnps.mono hps)
[GOAL]
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
hu : ∃! cs, cs.center ∈ s ∧ ps ⊆ Metric.sphere cs.center cs.radius
this : Nonempty { x // x ∈ s }
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
rcases hu with ⟨⟨cc, cr⟩, ⟨hcc, hcr⟩, hcccru⟩
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ s }
cc : P
cr : ℝ
hcccru :
  ∀ (y : Sphere P),
    (fun cs => cs.center ∈ s ∧ ps ⊆ Metric.sphere cs.center cs.radius) y → y = { center := cc, radius := cr }
hcc : { center := cc, radius := cr }.center ∈ s
hcr : ps ⊆ Metric.sphere { center := cc, radius := cr }.center { center := cc, radius := cr }.radius
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
simp only at hcc hcr hcccru 
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ 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
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
let x := dist cc (orthogonalProjection s p)
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ 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)
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
let y := dist p (orthogonalProjection s p)
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ 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)
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
have hy0 : y ≠ 0 := dist_orthogonalProjection_ne_zero_of_not_mem hp
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ 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
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
let ycc₂ := (x * x + y * y - cr * cr) / (2 * y)
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ 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)
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
let cc₂ := (ycc₂ / y) • (p -ᵥ orthogonalProjection s p : V) +ᵥ cc
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ 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
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
let cr₂ := Real.sqrt (cr * cr + ycc₂ * ycc₂)
[GOAL]
case intro.mk.intro.intro
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 { x // x ∈ 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₂)
⊢ ∃! cs₂, cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius
[PROOFSTEP]
use⟨cc₂, cr₂⟩
[GOAL]
case h
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 { x // x ∈ 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₂)
⊢ (fun cs₂ => cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius)
      { center := cc₂, radius := cr₂ } ∧
    ∀ (y : Sphere P),
      (fun cs₂ => cs₂.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere cs₂.center cs₂.radius) y →
        y = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
simp (config := { zeta := false, proj := false }) only
[GOAL]
case h
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 { x // x ∈ 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₂)
⊢ ({ center := cc₂, radius := cr₂ }.center ∈ affineSpan ℝ (insert p ↑s) ∧
      insert p ps ⊆ Metric.sphere { center := cc₂, radius := cr₂ }.center { center := cc₂, radius := cr₂ }.radius) ∧
    ∀ (y : Sphere P),
      y.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere y.center y.radius →
        y = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
have hpo : p = (1 : ℝ) • (p -ᵥ orthogonalProjection s p : V) +ᵥ (orthogonalProjection s p : P) := by simp
[GOAL]
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 { x // x ∈ 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₂)
⊢ p = 1 • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ ↑(↑(orthogonalProjection s) p)
[PROOFSTEP]
simp
[GOAL]
case h
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 { x // x ∈ 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)
⊢ ({ center := cc₂, radius := cr₂ }.center ∈ affineSpan ℝ (insert p ↑s) ∧
      insert p ps ⊆ Metric.sphere { center := cc₂, radius := cr₂ }.center { center := cc₂, radius := cr₂ }.radius) ∧
    ∀ (y : Sphere P),
      y.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere y.center y.radius →
        y = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
constructor
[GOAL]
case h.left
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 { x // x ∈ 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)
⊢ { center := cc₂, radius := cr₂ }.center ∈ affineSpan ℝ (insert p ↑s) ∧
    insert p ps ⊆ Metric.sphere { center := cc₂, radius := cr₂ }.center { center := cc₂, radius := cr₂ }.radius
[PROOFSTEP]
constructor
[GOAL]
case h.left.left
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 { x // x ∈ 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)
⊢ { center := cc₂, radius := cr₂ }.center ∈ affineSpan ℝ (insert p ↑s)
[PROOFSTEP]
refine' vadd_mem_of_mem_direction _ (mem_affineSpan ℝ (Set.mem_insert_of_mem _ hcc))
[GOAL]
case h.left.left
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 { x // x ∈ 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)
⊢ (ycc₂ / y) • (p -ᵥ ↑(↑(orthogonalProjection s) p)) ∈ direction (affineSpan ℝ (insert p ↑s))
[PROOFSTEP]
rw [direction_affineSpan]
[GOAL]
case h.left.left
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 { x // x ∈ 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)
⊢ (ycc₂ / y) • (p -ᵥ ↑(↑(orthogonalProjection s) p)) ∈ vectorSpan ℝ (insert p ↑s)
[PROOFSTEP]
exact
  Submodule.smul_mem _ _
    (vsub_mem_vectorSpan ℝ (Set.mem_insert _ _) (Set.mem_insert_of_mem _ (orthogonalProjection_mem _)))
[GOAL]
case h.left.right
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 { x // x ∈ 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)
⊢ insert p ps ⊆ Metric.sphere { center := cc₂, radius := cr₂ }.center { center := cc₂, radius := cr₂ }.radius
[PROOFSTEP]
intro p1 hp1
[GOAL]
case h.left.right
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 { x // x ∈ 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 ∈ insert p ps
⊢ p1 ∈ Metric.sphere { center := cc₂, radius := cr₂ }.center { center := cc₂, radius := cr₂ }.radius
[PROOFSTEP]
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 _))]
[GOAL]
case h.left.right
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 { x // x ∈ 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 ∈ insert p ps
⊢ dist p1 { center := cc₂, radius := cr₂ }.center * dist p1 { center := cc₂, radius := cr₂ }.center =
    cr * cr + ycc₂ * ycc₂
[PROOFSTEP]
cases' hp1 with hp1 hp1
[GOAL]
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 { x // x ∈ 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 p1 { center := cc₂, radius := cr₂ }.center * dist p1 { center := cc₂, radius := cr₂ }.center =
    cr * cr + ycc₂ * ycc₂
[PROOFSTEP]
rw [hp1]
[GOAL]
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 { x // x ∈ 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 p { center := cc₂, radius := cr₂ }.center * dist p { center := cc₂, radius := cr₂ }.center =
    cr * cr + ycc₂ * ycc₂
[PROOFSTEP]
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]
[GOAL]
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 { x // x ∈ 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) +
      (1 - ycc₂ / y) * (1 - ycc₂ / y) *
        (dist p ↑(↑(orthogonalProjection s) p) * dist p ↑(↑(orthogonalProjection s) p)) =
    cr * cr + ycc₂ * ycc₂
[PROOFSTEP]
field_simp [hy0]
[GOAL]
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 { x // x ∈ 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)))
[PROOFSTEP]
ring
[GOAL]
case h.left.right.inr
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 { x // x ∈ 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 ∈ ps
⊢ dist p1 { center := cc₂, radius := cr₂ }.center * dist p1 { center := cc₂, radius := cr₂ }.center =
    cr * cr + ycc₂ * ycc₂
[PROOFSTEP]
rw [dist_sq_eq_dist_orthogonalProjection_sq_add_dist_orthogonalProjection_sq _ (hps hp1),
  orthogonalProjection_vadd_smul_vsub_orthogonalProjection _ _ hcc, Subtype.coe_mk,
  dist_of_mem_subset_mk_sphere hp1 hcr, dist_eq_norm_vsub V cc₂ cc, vadd_vsub, norm_smul, ← dist_eq_norm_vsub V,
  Real.norm_eq_abs, abs_div, abs_of_nonneg dist_nonneg, div_mul_cancel _ hy0, abs_mul_abs_self]
[GOAL]
case h.right
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 { x // x ∈ 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)
⊢ ∀ (y : Sphere P),
    y.center ∈ affineSpan ℝ (insert p ↑s) ∧ insert p ps ⊆ Metric.sphere y.center y.radius →
      y = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
rintro ⟨cc₃, cr₃⟩ ⟨hcc₃, hcr₃⟩
[GOAL]
case h.right.mk.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : { center := cc₃, radius := cr₃ }.center ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere { center := cc₃, radius := cr₃ }.center { center := cc₃, radius := cr₃ }.radius
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
simp only at hcc₃ hcr₃ 
[GOAL]
case h.right.mk.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
obtain ⟨t₃, cc₃', hcc₃', hcc₃''⟩ :
  ∃ (r : ℝ) (p0 : P) (_ : p0 ∈ s), cc₃ = r • (p -ᵥ ↑((orthogonalProjection s) p)) +ᵥ p0 := by
  rwa [mem_affineSpan_insert_iff (orthogonalProjection_mem p)] at hcc₃ 
[GOAL]
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
⊢ ∃ r p0 x, cc₃ = r • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ p0
[PROOFSTEP]
rwa [mem_affineSpan_insert_iff (orthogonalProjection_mem p)] at hcc₃ 
[GOAL]
case h.right.mk.intro.intro.intro.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
cc₃' : P
hcc₃' : cc₃' ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc₃'
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
have hcr₃' : ∃ r, ∀ p1 ∈ ps, dist p1 cc₃ = r :=
  ⟨cr₃, fun p1 hp1 => dist_of_mem_subset_mk_sphere (Set.mem_insert_of_mem _ hp1) hcr₃⟩
[GOAL]
case h.right.mk.intro.intro.intro.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
cc₃' : P
hcc₃' : cc₃' ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc₃'
hcr₃' : ∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 cc₃ = r
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
rw [exists_dist_eq_iff_exists_dist_orthogonalProjection_eq hps cc₃, hcc₃'',
  orthogonalProjection_vadd_smul_vsub_orthogonalProjection _ _ hcc₃'] at hcr₃' 
[GOAL]
case h.right.mk.intro.intro.intro.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
cc₃' : P
hcc₃' : cc₃' ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc₃'
hcr₃' : ∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc₃', property := hcc₃' } = r
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
cases' hcr₃' with cr₃' hcr₃'
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
cc₃' : P
hcc₃' : cc₃' ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc₃'
cr₃' : ℝ
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc₃', property := hcc₃' } = cr₃'
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
have hu := hcccru ⟨cc₃', cr₃'⟩
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
cc₃' : P
hcc₃' : cc₃' ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc₃'
cr₃' : ℝ
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc₃', property := hcc₃' } = cr₃'
hu :
  { center := cc₃', radius := cr₃' }.center ∈ s ∧
      ps ⊆ Metric.sphere { center := cc₃', radius := cr₃' }.center { center := cc₃', radius := cr₃' }.radius →
    { center := cc₃', radius := cr₃' } = { center := cc, radius := cr }
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
simp only at hu 
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
cc₃' : P
hcc₃' : cc₃' ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc₃'
cr₃' : ℝ
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc₃', property := hcc₃' } = cr₃'
hu : cc₃' ∈ s ∧ ps ⊆ Metric.sphere cc₃' cr₃' → { center := cc₃', radius := cr₃' } = { center := cc, radius := cr }
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
replace hu :=
  hu
    ⟨hcc₃', hcr₃'⟩
      -- Porting note: was
          -- cases' hu with hucc hucr
          -- substs hucc hucr
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
cc₃' : P
hcc₃' : cc₃' ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc₃'
cr₃' : ℝ
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc₃', property := hcc₃' } = cr₃'
hu : { center := cc₃', radius := cr₃' } = { center := cc, radius := cr }
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
cases' hu
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
have hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y)) :=
  by
  cases' hnps with p0 hp0
  have h' : ↑(⟨cc, hcc₃'⟩ : s) = cc := rfl
  rw [← dist_of_mem_subset_mk_sphere (Set.mem_insert_of_mem _ hp0) hcr₃, hcc₃'', ←
    mul_self_inj_of_nonneg dist_nonneg (Real.sqrt_nonneg _),
    Real.mul_self_sqrt (add_nonneg (mul_self_nonneg _) (mul_self_nonneg _)),
    dist_sq_eq_dist_orthogonalProjection_sq_add_dist_orthogonalProjection_sq _ (hps hp0),
    orthogonalProjection_vadd_smul_vsub_orthogonalProjection _ _ hcc₃', h', dist_of_mem_subset_mk_sphere hp0 hcr,
    dist_eq_norm_vsub V _ cc, vadd_vsub, norm_smul, ← dist_eq_norm_vsub V p, Real.norm_eq_abs, ← mul_assoc,
    mul_comm _ |t₃|, ← mul_assoc, abs_mul_abs_self]
  ring
[GOAL]
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
⊢ cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
[PROOFSTEP]
cases' hnps with p0 hp0
[GOAL]
case intro
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
p : P
hps : ps ⊆ ↑s
hp : ¬p ∈ s
this : Nonempty { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
p0 : P
hp0 : p0 ∈ ps
⊢ cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
[PROOFSTEP]
have h' : ↑(⟨cc, hcc₃'⟩ : s) = cc := rfl
[GOAL]
case intro
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
p : P
hps : ps ⊆ ↑s
hp : ¬p ∈ s
this : Nonempty { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
p0 : P
hp0 : p0 ∈ ps
h' : ↑{ val := cc, property := hcc₃' } = cc
⊢ cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
[PROOFSTEP]
rw [← dist_of_mem_subset_mk_sphere (Set.mem_insert_of_mem _ hp0) hcr₃, hcc₃'', ←
  mul_self_inj_of_nonneg dist_nonneg (Real.sqrt_nonneg _),
  Real.mul_self_sqrt (add_nonneg (mul_self_nonneg _) (mul_self_nonneg _)),
  dist_sq_eq_dist_orthogonalProjection_sq_add_dist_orthogonalProjection_sq _ (hps hp0),
  orthogonalProjection_vadd_smul_vsub_orthogonalProjection _ _ hcc₃', h', dist_of_mem_subset_mk_sphere hp0 hcr,
  dist_eq_norm_vsub V _ cc, vadd_vsub, norm_smul, ← dist_eq_norm_vsub V p, Real.norm_eq_abs, ← mul_assoc,
  mul_comm _ |t₃|, ← mul_assoc, abs_mul_abs_self]
[GOAL]
case intro
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
p : P
hps : ps ⊆ ↑s
hp : ¬p ∈ s
this : Nonempty { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
p0 : P
hp0 : p0 ∈ ps
h' : ↑{ val := cc, property := hcc₃' } = cc
⊢ cr * cr + t₃ * t₃ * dist p ↑(↑(orthogonalProjection s) p) * dist p ↑(↑(orthogonalProjection s) p) =
    cr * cr + t₃ * y * (t₃ * y)
[PROOFSTEP]
ring
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcr₃ : insert p ps ⊆ Metric.sphere cc₃ cr₃
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
replace hcr₃ := dist_of_mem_subset_mk_sphere (Set.mem_insert _ _) hcr₃
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ : dist p cc₃ = cr₃
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
rw [hpo, hcc₃'', hcr₃val, ← mul_self_inj_of_nonneg dist_nonneg (Real.sqrt_nonneg _),
  dist_sq_smul_orthogonal_vadd_smul_orthogonal_vadd (orthogonalProjection_mem p) hcc₃' _ _
    (vsub_orthogonalProjection_mem_direction_orthogonal s p),
  dist_comm, ← dist_eq_norm_vsub V p, Real.mul_self_sqrt (add_nonneg (mul_self_nonneg _) (mul_self_nonneg _))] at hcr₃ 
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ :
  dist cc ↑(↑(orthogonalProjection s) p) * dist cc ↑(↑(orthogonalProjection s) p) +
      (1 - t₃) * (1 - t₃) * (dist p ↑(↑(orthogonalProjection s) p) * dist p ↑(↑(orthogonalProjection s) p)) =
    cr * cr + t₃ * y * (t₃ * y)
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
change x * x + _ * (y * y) = _ at hcr₃ 
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ : x * x + (1 - t₃) * (1 - t₃) * (y * y) = cr * cr + t₃ * y * (t₃ * y)
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
rw [show x * x + (1 - t₃) * (1 - t₃) * (y * y) = x * x + y * y - 2 * y * (t₃ * y) + t₃ * y * (t₃ * y) by ring,
  add_left_inj] at hcr₃ 
[GOAL]
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ : x * x + (1 - t₃) * (1 - t₃) * (y * y) = cr * cr + t₃ * y * (t₃ * y)
⊢ x * x + (1 - t₃) * (1 - t₃) * (y * y) = x * x + y * y - 2 * y * (t₃ * y) + t₃ * y * (t₃ * y)
[PROOFSTEP]
ring
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ : x * x + y * y - 2 * y * (t₃ * y) = cr * cr
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
have ht₃ : t₃ = ycc₂ / y := by
  field_simp [← hcr₃, hy0]
  ring
[GOAL]
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ : x * x + y * y - 2 * y * (t₃ * y) = cr * cr
⊢ t₃ = ycc₂ / y
[PROOFSTEP]
field_simp [← hcr₃, hy0]
[GOAL]
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ : x * x + y * y - 2 * y * (t₃ * y) = cr * cr
⊢ t₃ * (2 * dist p ↑(↑(orthogonalProjection s) p) * dist p ↑(↑(orthogonalProjection s) p)) =
    2 * dist p ↑(↑(orthogonalProjection s) p) * (t₃ * dist p ↑(↑(orthogonalProjection s) p))
[PROOFSTEP]
ring
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
t₃ : ℝ
hcc₃' : cc ∈ s
hcc₃'' : cc₃ = t₃ • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + t₃ * y * (t₃ * y))
hcr₃ : x * x + y * y - 2 * y * (t₃ * y) = cr * cr
ht₃ : t₃ = ycc₂ / y
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
subst ht₃
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcc₃' : cc ∈ s
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcc₃'' : cc₃ = (ycc₂ / y) • (p -ᵥ ↑(↑(orthogonalProjection s) p)) +ᵥ cc
hcr₃val : cr₃ = Real.sqrt (cr * cr + ycc₂ / y * y * (ycc₂ / y * y))
hcr₃ : x * x + y * y - 2 * y * (ycc₂ / y * y) = cr * cr
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
change cc₃ = cc₂ at hcc₃'' 
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcc₃' : cc ∈ s
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + ycc₂ / y * y * (ycc₂ / y * y))
hcr₃ : x * x + y * y - 2 * y * (ycc₂ / y * y) = cr * cr
hcc₃'' : cc₃ = cc₂
⊢ { center := cc₃, radius := cr₃ } = { center := cc₂, radius := cr₂ }
[PROOFSTEP]
congr
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl.e_radius
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcc₃' : cc ∈ s
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + ycc₂ / y * y * (ycc₂ / y * y))
hcr₃ : x * x + y * y - 2 * y * (ycc₂ / y * y) = cr * cr
hcc₃'' : cc₃ = cc₂
⊢ cr₃ = cr₂
[PROOFSTEP]
rw [hcr₃val]
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl.e_radius
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcc₃' : cc ∈ s
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + ycc₂ / y * y * (ycc₂ / y * y))
hcr₃ : x * x + y * y - 2 * y * (ycc₂ / y * y) = cr * cr
hcc₃'' : cc₃ = cc₂
⊢ Real.sqrt (cr * cr + ycc₂ / y * y * (ycc₂ / y * y)) = cr₂
[PROOFSTEP]
congr 2
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl.e_radius.e_x.e_a
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcc₃' : cc ∈ s
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + ycc₂ / y * y * (ycc₂ / y * y))
hcr₃ : x * x + y * y - 2 * y * (ycc₂ / y * y) = cr * cr
hcc₃'' : cc₃ = cc₂
⊢ ycc₂ / y * y * (ycc₂ / y * y) = ycc₂ * ycc₂
[PROOFSTEP]
field_simp [hy0]
[GOAL]
case h.right.mk.intro.intro.intro.intro.intro.refl.e_radius.e_x.e_a
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 { x // x ∈ 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)
cc₃ : P
cr₃ : ℝ
hcc₃ : cc₃ ∈ affineSpan ℝ (insert p ↑s)
hcc₃' : cc ∈ s
hcr₃' : ∀ (p1 : P), p1 ∈ ps → dist p1 ↑{ val := cc, property := hcc₃' } = cr
hcr₃val : cr₃ = Real.sqrt (cr * cr + ycc₂ / y * y * (ycc₂ / y * y))
hcr₃ : x * x + y * y - 2 * y * (ycc₂ / y * y) = cr * cr
hcc₃'' : cc₃ = cc₂
⊢ (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 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)) *
      (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)))
[PROOFSTEP]
ring
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
cases nonempty_fintype ι
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
induction' hn : Fintype.card ι with m hm generalizing ι
[GOAL]
case intro.zero
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hn : Fintype.card ι = Nat.zero
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
exfalso
[GOAL]
case intro.zero.h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hn : Fintype.card ι = Nat.zero
⊢ False
[PROOFSTEP]
have h := Fintype.card_pos_iff.2 hne
[GOAL]
case intro.zero.h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hn : Fintype.card ι = Nat.zero
h : 0 < Fintype.card ι
⊢ False
[PROOFSTEP]
rw [hn] at h 
[GOAL]
case intro.zero.h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hn : Fintype.card ι = Nat.zero
h : 0 < Nat.zero
⊢ False
[PROOFSTEP]
exact lt_irrefl 0 h
[GOAL]
case intro.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hn : Fintype.card ι = Nat.succ m
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
cases' m with m
[GOAL]
case intro.succ.zero
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ Nat.zero
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
rw [Fintype.card_eq_one_iff] at hn 
[GOAL]
case intro.succ.zero
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : ∃ x, ∀ (y : ι), y = x
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
cases' hn with i hi
[GOAL]
case intro.succ.zero.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
haveI : Unique ι := ⟨⟨i⟩, hi⟩
[GOAL]
case intro.succ.zero.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
use⟨p i, 0⟩
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
⊢ (fun cs => cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius)
      { center := p i, radius := 0 } ∧
    ∀ (y : Sphere P),
      (fun cs => cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius) y →
        y = { center := p i, radius := 0 }
[PROOFSTEP]
simp only [Set.range_unique, AffineSubspace.mem_affineSpan_singleton]
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
⊢ (p i = p default ∧ {p default} ⊆ Metric.sphere (p i) 0) ∧
    ∀ (y : Sphere P),
      y.center = p default ∧ {p default} ⊆ Metric.sphere y.center y.radius → y = { center := p i, radius := 0 }
[PROOFSTEP]
constructor
[GOAL]
case h.left
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
⊢ p i = p default ∧ {p default} ⊆ Metric.sphere (p i) 0
[PROOFSTEP]
simp_rw [hi default, Set.singleton_subset_iff]
[GOAL]
case h.left
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
⊢ True ∧ p i ∈ Metric.sphere (p i) 0
[PROOFSTEP]
exact ⟨⟨⟩, by simp only [Metric.sphere_zero, Set.mem_singleton_iff]⟩
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
⊢ p i ∈ Metric.sphere (p i) 0
[PROOFSTEP]
simp only [Metric.sphere_zero, Set.mem_singleton_iff]
[GOAL]
case h.right
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
⊢ ∀ (y : Sphere P),
    y.center = p default ∧ {p default} ⊆ Metric.sphere y.center y.radius → y = { center := p i, radius := 0 }
[PROOFSTEP]
rintro ⟨cc, cr⟩
[GOAL]
case h.right.mk
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
cc : P
cr : ℝ
⊢ { center := cc, radius := cr }.center = p default ∧
      {p default} ⊆ Metric.sphere { center := cc, radius := cr }.center { center := cc, radius := cr }.radius →
    { center := cc, radius := cr } = { center := p i, radius := 0 }
[PROOFSTEP]
simp only
[GOAL]
case h.right.mk
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
cc : P
cr : ℝ
⊢ cc = p default ∧ {p default} ⊆ Metric.sphere cc cr → { center := cc, radius := cr } = { center := p i, radius := 0 }
[PROOFSTEP]
rintro ⟨rfl, hdist⟩
[GOAL]
case h.right.mk.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
cr : ℝ
hdist : {p default} ⊆ Metric.sphere (p default) cr
⊢ { center := p default, radius := cr } = { center := p i, radius := 0 }
[PROOFSTEP]
simp [Set.singleton_subset_iff] at hdist 
[GOAL]
case h.right.mk.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.zero →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
i : ι
hi : ∀ (y : ι), y = i
this : Unique ι
cr : ℝ
hdist : 0 = cr
⊢ { center := p default, radius := cr } = { center := p i, radius := 0 }
[PROOFSTEP]
rw [hi default, hdist]
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
have i := hne.some
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
let ι2 := { x // x ≠ i }
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
have hc : Fintype.card ι2 = m + 1 :=
  by
  rw [Fintype.card_of_subtype (Finset.univ.filter fun x => x ≠ i)]
  · rw [Finset.filter_not]
      -- Porting note: removed `simp_rw [eq_comm]` and used `filter_eq'` instead of `filter_eq`
    rw [Finset.filter_eq' _ i, if_pos (Finset.mem_univ _), Finset.card_sdiff (Finset.subset_univ _),
      Finset.card_singleton, Finset.card_univ, hn]
    simp
  · simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
⊢ Fintype.card ι2 = m + 1
[PROOFSTEP]
rw [Fintype.card_of_subtype (Finset.univ.filter fun x => x ≠ i)]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
⊢ Finset.card (Finset.filter (fun x => x ≠ i) Finset.univ) = m + 1
[PROOFSTEP]
rw [Finset.filter_not]
  -- Porting note: removed `simp_rw [eq_comm]` and used `filter_eq'` instead of `filter_eq`
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
⊢ Finset.card (Finset.univ \ Finset.filter (fun x => x = i) Finset.univ) = m + 1
[PROOFSTEP]
rw [Finset.filter_eq' _ i, if_pos (Finset.mem_univ _), Finset.card_sdiff (Finset.subset_univ _), Finset.card_singleton,
  Finset.card_univ, hn]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
⊢ Nat.succ (Nat.succ m) - 1 = m + 1
[PROOFSTEP]
simp
[GOAL]
case H
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
⊢ ∀ (x : ι), x ∈ Finset.filter (fun x => x ≠ i) Finset.univ ↔ x ≠ i
[PROOFSTEP]
simp
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
haveI : Nonempty ι2 := Fintype.card_pos_iff.1 (hc.symm ▸ Nat.zero_lt_succ _)
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
have ha2 : AffineIndependent ℝ fun i2 : ι2 => p i2 := ha.subtype _
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hm :
  ∀ {ι : Type u_3} [hne : Nonempty ι] [inst : Finite ι] {p : ι → P},
    AffineIndependent ℝ p →
      ∀ (val : Fintype ι),
        Fintype.card ι = Nat.succ m →
          ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
replace hm := hm ha2 _ hc
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
have hr : Set.range p = insert (p i) (Set.range fun i2 : ι2 => p i2) :=
  by
  change _ = insert _ (Set.range fun i2 : {x | x ≠ i} => p i2)
  rw [← Set.image_eq_range, ← Set.image_univ, ← Set.image_insert_eq]
  congr with j
  simp [Classical.em]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
⊢ Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
[PROOFSTEP]
change _ = insert _ (Set.range fun i2 : {x | x ≠ i} => p i2)
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
⊢ Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
[PROOFSTEP]
rw [← Set.image_eq_range, ← Set.image_univ, ← Set.image_insert_eq]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
⊢ p '' Set.univ = p '' insert i {x | x ≠ i}
[PROOFSTEP]
congr with j
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
j : P
⊢ j ∈ p '' Set.univ ↔ j ∈ p '' insert i {x | x ≠ i}
[PROOFSTEP]
simp [Classical.em]
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
hr : Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
⊢ ∃! cs, cs.center ∈ affineSpan ℝ (Set.range p) ∧ Set.range p ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
rw [hr, ← affineSpan_insert_affineSpan]
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
hr : Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
⊢ ∃! cs,
    cs.center ∈ affineSpan ℝ (insert (p i) ↑(affineSpan ℝ (Set.range fun i2 => p ↑i2))) ∧
      insert (p i) (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
[PROOFSTEP]
refine' existsUnique_dist_eq_of_insert (Set.range_nonempty _) (subset_spanPoints ℝ _) _ hm
[GOAL]
case intro.succ.succ
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
hr : Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
⊢ ¬p i ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2)
[PROOFSTEP]
convert ha.not_mem_affineSpan_diff i Set.univ
[GOAL]
case h.e'_1.h.e'_5.h.e'_8
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
hr : Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
⊢ (Set.range fun i2 => p ↑i2) = p '' (Set.univ \ {i})
[PROOFSTEP]
change (Set.range fun i2 : {x | x ≠ i} => p i2) = _
[GOAL]
case h.e'_1.h.e'_5.h.e'_8
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
hr : Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
⊢ (Set.range fun i2 => p ↑i2) = p '' (Set.univ \ {i})
[PROOFSTEP]
rw [← Set.image_eq_range]
[GOAL]
case h.e'_1.h.e'_5.h.e'_8
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
hr : Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
⊢ p '' {x | x ≠ i} = p '' (Set.univ \ {i})
[PROOFSTEP]
congr with j
[GOAL]
case h.e'_1.h.e'_5.h.e'_8.h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
ι✝ : Type u_3
hne✝ : Nonempty ι✝
inst✝¹ : Finite ι✝
p✝ : ι✝ → P
ha✝ : AffineIndependent ℝ p✝
val✝¹ : Fintype ι✝
x✝ : ℕ
hn✝ : Fintype.card ι✝ = x✝
ι : Type u_3
hne : Nonempty ι
inst✝ : Finite ι
p : ι → P
ha : AffineIndependent ℝ p
val✝ : Fintype ι
m : ℕ
hn : Fintype.card ι = Nat.succ (Nat.succ m)
i : ι
ι2 : Type u_3 := { x // x ≠ i }
hc : Fintype.card ι2 = m + 1
this : Nonempty ι2
ha2 : AffineIndependent ℝ fun i2 => p ↑i2
hm :
  ∃! cs,
    cs.center ∈ affineSpan ℝ (Set.range fun i2 => p ↑i2) ∧
      (Set.range fun i2 => p ↑i2) ⊆ Metric.sphere cs.center cs.radius
hr : Set.range p = insert (p i) (Set.range fun i2 => p ↑i2)
j : P
⊢ j ∈ p '' {x | x ≠ i} ↔ j ∈ p '' (Set.univ \ {i})
[PROOFSTEP]
simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
⊢ ∀ (i : Fin (n + 1)), dist (circumcenter s) (points s i) = circumradius s
[PROOFSTEP]
intro i
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
⊢ dist (circumcenter s) (points s i) = circumradius s
[PROOFSTEP]
rw [dist_comm]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
⊢ dist (points s i) (circumcenter s) = circumradius s
[PROOFSTEP]
exact dist_circumcenter_eq_circumradius _ _
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
⊢ p = circumcenter s
[PROOFSTEP]
have h := s.circumsphere_unique_dist_eq.2 ⟨p, r⟩
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h :
  { center := p, radius := r }.center ∈ affineSpan ℝ (Set.range s.points) ∧
      Set.range s.points ⊆ Metric.sphere { center := p, radius := r }.center { center := p, radius := r }.radius →
    { center := p, radius := r } = circumsphere s
⊢ p = circumcenter s
[PROOFSTEP]
simp only [hp, hr, forall_const, eq_self_iff_true, subset_sphere, Sphere.ext_iff, Set.forall_range_iff, mem_sphere,
  true_and] at h 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h : Set.range s.points ⊆ Metric.sphere p r → p = (circumsphere s).center ∧ r = (circumsphere s).radius
⊢ p = circumcenter s
[PROOFSTEP]
rw [subset_sphere (s := ⟨p, r⟩)] at h 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h :
  (∀ (p_1 : P), p_1 ∈ Set.range s.points → p_1 ∈ { center := p, radius := r }) →
    p = (circumsphere s).center ∧ r = (circumsphere s).radius
⊢ p = circumcenter s
[PROOFSTEP]
simp only [hp, hr, forall_const, eq_self_iff_true, subset_sphere, Sphere.ext_iff, Set.forall_range_iff, mem_sphere,
  true_and] at h 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h : p = (circumsphere s).center ∧ r = (circumsphere s).radius
⊢ p = circumcenter s
[PROOFSTEP]
exact h.1
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
⊢ r = circumradius s
[PROOFSTEP]
have h := s.circumsphere_unique_dist_eq.2 ⟨p, r⟩
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h :
  { center := p, radius := r }.center ∈ affineSpan ℝ (Set.range s.points) ∧
      Set.range s.points ⊆ Metric.sphere { center := p, radius := r }.center { center := p, radius := r }.radius →
    { center := p, radius := r } = circumsphere s
⊢ r = circumradius s
[PROOFSTEP]
simp only [hp, hr, forall_const, eq_self_iff_true, subset_sphere, Sphere.ext_iff, Set.forall_range_iff, mem_sphere,
  true_and_iff] at h 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h : Set.range s.points ⊆ Metric.sphere p r → p = (circumsphere s).center ∧ r = (circumsphere s).radius
⊢ r = circumradius s
[PROOFSTEP]
rw [subset_sphere (s := ⟨p, r⟩)] at h 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h :
  (∀ (p_1 : P), p_1 ∈ Set.range s.points → p_1 ∈ { center := p, radius := r }) →
    p = (circumsphere s).center ∧ r = (circumsphere s).radius
⊢ r = circumradius s
[PROOFSTEP]
simp only [hp, hr, forall_const, eq_self_iff_true, subset_sphere, Sphere.ext_iff, Set.forall_range_iff, mem_sphere,
  true_and_iff] at h 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hp : p ∈ affineSpan ℝ (Set.range s.points)
r : ℝ
hr : ∀ (i : Fin (n + 1)), dist (points s i) p = r
h : p = (circumsphere s).center ∧ r = (circumsphere s).radius
⊢ r = circumradius s
[PROOFSTEP]
exact h.2
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P (n + 1)
⊢ 0 < circumradius s
[PROOFSTEP]
refine' lt_of_le_of_ne s.circumradius_nonneg _
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P (n + 1)
⊢ 0 ≠ circumradius s
[PROOFSTEP]
intro h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P (n + 1)
h : 0 = circumradius s
⊢ False
[PROOFSTEP]
have hr := s.dist_circumcenter_eq_circumradius
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P (n + 1)
h : 0 = circumradius s
hr : ∀ (i : Fin (n + 1 + 1)), dist (points s i) (circumcenter s) = circumradius s
⊢ False
[PROOFSTEP]
simp_rw [← h, dist_eq_zero] at hr 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P (n + 1)
h : 0 = circumradius s
hr : ∀ (i : Fin (n + 1 + 1)), points s i = circumcenter s
⊢ False
[PROOFSTEP]
have h01 := s.Independent.injective.ne (by simp : (0 : Fin (n + 2)) ≠ 1)
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P (n + 1)
h : 0 = circumradius s
hr : ∀ (i : Fin (n + 1 + 1)), points s i = circumcenter s
⊢ 0 ≠ 1
[PROOFSTEP]
simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P (n + 1)
h : 0 = circumradius s
hr : ∀ (i : Fin (n + 1 + 1)), points s i = circumcenter s
h01 : points s 0 ≠ points s 1
⊢ False
[PROOFSTEP]
simp [hr] at h01 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
⊢ circumcenter s = points s i
[PROOFSTEP]
have h := s.circumcenter_mem_affineSpan
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
h : circumcenter s ∈ affineSpan ℝ (Set.range s.points)
⊢ circumcenter s = points s i
[PROOFSTEP]
have : Unique (Fin 1) := ⟨⟨0, by decide⟩, fun a => by simp only [Fin.eq_zero]⟩
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
h : circumcenter s ∈ affineSpan ℝ (Set.range s.points)
⊢ 0 < 1
[PROOFSTEP]
decide
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
h : circumcenter s ∈ affineSpan ℝ (Set.range s.points)
a : Fin 1
⊢ a = default
[PROOFSTEP]
simp only [Fin.eq_zero]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
h : circumcenter s ∈ affineSpan ℝ (Set.range s.points)
this : Unique (Fin 1)
⊢ circumcenter s = points s i
[PROOFSTEP]
simp only [Set.range_unique, AffineSubspace.mem_affineSpan_singleton] at h 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
this : Unique (Fin 1)
h : circumcenter s = points s default
⊢ circumcenter s = points s i
[PROOFSTEP]
rw [h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
this : Unique (Fin 1)
h : circumcenter s = points s default
⊢ points s default = points s i
[PROOFSTEP]
congr
[GOAL]
case e_a
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 0
i : Fin 1
this : Unique (Fin 1)
h : circumcenter s = points s default
⊢ default = i
[PROOFSTEP]
simp only [eq_iff_true_of_subsingleton]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
⊢ circumcenter s = centroid ℝ univ s.points
[PROOFSTEP]
have hr :
  Set.Pairwise Set.univ fun i j : Fin 2 =>
    dist (s.points i) (Finset.univ.centroid ℝ s.points) = dist (s.points j) (Finset.univ.centroid ℝ s.points) :=
  by
  intro i hi j hj hij
  rw [Finset.centroid_pair_fin, dist_eq_norm_vsub V (s.points i), dist_eq_norm_vsub V (s.points j),
    vsub_vadd_eq_vsub_sub, vsub_vadd_eq_vsub_sub, ← one_smul ℝ (s.points i -ᵥ s.points 0), ←
    one_smul ℝ (s.points j -ᵥ s.points 0)]
  fin_cases i <;> fin_cases j <;> simp [-one_smul, ← sub_smul] <;> norm_num
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
⊢ Set.Pairwise Set.univ fun i j =>
    dist (points s i) (centroid ℝ univ s.points) = dist (points s j) (centroid ℝ univ s.points)
[PROOFSTEP]
intro i hi j hj hij
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
i : Fin 2
hi : i ∈ Set.univ
j : Fin 2
hj : j ∈ Set.univ
hij : i ≠ j
⊢ dist (points s i) (centroid ℝ univ s.points) = dist (points s j) (centroid ℝ univ s.points)
[PROOFSTEP]
rw [Finset.centroid_pair_fin, dist_eq_norm_vsub V (s.points i), dist_eq_norm_vsub V (s.points j), vsub_vadd_eq_vsub_sub,
  vsub_vadd_eq_vsub_sub, ← one_smul ℝ (s.points i -ᵥ s.points 0), ← one_smul ℝ (s.points j -ᵥ s.points 0)]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
i : Fin 2
hi : i ∈ Set.univ
j : Fin 2
hj : j ∈ Set.univ
hij : i ≠ j
⊢ ‖1 • (points s i -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖ =
    ‖1 • (points s j -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
fin_cases i
[GOAL]
case head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
j : Fin 2
hj : j ∈ Set.univ
hi : { val := 0, isLt := (_ : 0 < 2) } ∈ Set.univ
hij : { val := 0, isLt := (_ : 0 < 2) } ≠ j
⊢ ‖1 • (points s { val := 0, isLt := (_ : 0 < 2) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖ =
    ‖1 • (points s j -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
fin_cases j
[GOAL]
case tail.head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
j : Fin 2
hj : j ∈ Set.univ
hi : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ∈ Set.univ
hij : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ≠ j
⊢ ‖1 • (points s { val := 1, isLt := (_ : (fun a => a < 2) 1) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖ =
    ‖1 • (points s j -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
fin_cases j
[GOAL]
case head.head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hi hj : { val := 0, isLt := (_ : 0 < 2) } ∈ Set.univ
hij : { val := 0, isLt := (_ : 0 < 2) } ≠ { val := 0, isLt := (_ : 0 < 2) }
⊢ ‖1 • (points s { val := 0, isLt := (_ : 0 < 2) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖ =
    ‖1 • (points s { val := 0, isLt := (_ : 0 < 2) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
simp [-one_smul, ← sub_smul]
[GOAL]
case head.tail.head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hi : { val := 0, isLt := (_ : 0 < 2) } ∈ Set.univ
hj : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ∈ Set.univ
hij : { val := 0, isLt := (_ : 0 < 2) } ≠ { val := 1, isLt := (_ : (fun a => a < 2) 1) }
⊢ ‖1 • (points s { val := 0, isLt := (_ : 0 < 2) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖ =
    ‖1 • (points s { val := 1, isLt := (_ : (fun a => a < 2) 1) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
simp [-one_smul, ← sub_smul]
[GOAL]
case tail.head.head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hi : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ∈ Set.univ
hj : { val := 0, isLt := (_ : 0 < 2) } ∈ Set.univ
hij : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ≠ { val := 0, isLt := (_ : 0 < 2) }
⊢ ‖1 • (points s { val := 1, isLt := (_ : (fun a => a < 2) 1) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖ =
    ‖1 • (points s { val := 0, isLt := (_ : 0 < 2) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
simp [-one_smul, ← sub_smul]
[GOAL]
case tail.head.tail.head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hi hj : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ∈ Set.univ
hij : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ≠ { val := 1, isLt := (_ : (fun a => a < 2) 1) }
⊢ ‖1 • (points s { val := 1, isLt := (_ : (fun a => a < 2) 1) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖ =
    ‖1 • (points s { val := 1, isLt := (_ : (fun a => a < 2) 1) } -ᵥ points s 0) - 2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
simp [-one_smul, ← sub_smul]
[GOAL]
case head.tail.head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hi : { val := 0, isLt := (_ : 0 < 2) } ∈ Set.univ
hj : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ∈ Set.univ
hij : { val := 0, isLt := (_ : 0 < 2) } ≠ { val := 1, isLt := (_ : (fun a => a < 2) 1) }
⊢ ‖2⁻¹ • (points s 1 -ᵥ points s 0)‖ = ‖(1 - 2⁻¹) • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
norm_num
[GOAL]
case tail.head.head
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hi : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ∈ Set.univ
hj : { val := 0, isLt := (_ : 0 < 2) } ∈ Set.univ
hij : { val := 1, isLt := (_ : (fun a => a < 2) 1) } ≠ { val := 0, isLt := (_ : 0 < 2) }
⊢ ‖(1 - 2⁻¹) • (points s 1 -ᵥ points s 0)‖ = ‖2⁻¹ • (points s 1 -ᵥ points s 0)‖
[PROOFSTEP]
norm_num
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hr :
  Set.Pairwise Set.univ fun i j =>
    dist (points s i) (centroid ℝ univ s.points) = dist (points s j) (centroid ℝ univ s.points)
⊢ circumcenter s = centroid ℝ univ s.points
[PROOFSTEP]
rw [Set.pairwise_eq_iff_exists_eq] at hr 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
hr : ∃ z, ∀ (x : Fin 2), x ∈ Set.univ → dist (points s x) (centroid ℝ univ s.points) = z
⊢ circumcenter s = centroid ℝ univ s.points
[PROOFSTEP]
cases' hr with r hr
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Simplex ℝ P 1
r : ℝ
hr : ∀ (x : Fin 2), x ∈ Set.univ → dist (points s x) (centroid ℝ univ s.points) = r
⊢ circumcenter s = centroid ℝ univ s.points
[PROOFSTEP]
exact
  (s.eq_circumcenter_of_dist_eq (centroid_mem_affineSpan_of_card_eq_add_one ℝ _ (Finset.card_fin 2)) fun i =>
      hr i (Set.mem_univ _)).symm
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
m n : ℕ
s : Simplex ℝ P m
e : Fin (m + 1) ≃ Fin (n + 1)
⊢ circumsphere (reindex s e) = circumsphere s
[PROOFSTEP]
refine' s.circumsphere_unique_dist_eq.2 _ ⟨_, _⟩
[GOAL]
case refine'_1
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
m n : ℕ
s : Simplex ℝ P m
e : Fin (m + 1) ≃ Fin (n + 1)
⊢ (circumsphere (reindex s e)).center ∈ affineSpan ℝ (Set.range s.points)
[PROOFSTEP]
rw [← s.reindex_range_points e]
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
m n : ℕ
s : Simplex ℝ P m
e : Fin (m + 1) ≃ Fin (n + 1)
⊢ Set.range s.points ⊆ Metric.sphere (circumsphere (reindex s e)).center (circumsphere (reindex s e)).radius
[PROOFSTEP]
rw [← s.reindex_range_points e]
[GOAL]
case refine'_1
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
m n : ℕ
s : Simplex ℝ P m
e : Fin (m + 1) ≃ Fin (n + 1)
⊢ (circumsphere (reindex s e)).center ∈ affineSpan ℝ (Set.range (reindex s e).points)
[PROOFSTEP]
exact (s.reindex e).circumsphere_unique_dist_eq.1.1
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
m n : ℕ
s : Simplex ℝ P m
e : Fin (m + 1) ≃ Fin (n + 1)
⊢ Set.range (reindex s e).points ⊆ Metric.sphere (circumsphere (reindex s e)).center (circumsphere (reindex s e)).radius
[PROOFSTEP]
exact (s.reindex e).circumsphere_unique_dist_eq.1.2
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
m n : ℕ
s : Simplex ℝ P m
e : Fin (m + 1) ≃ Fin (n + 1)
⊢ circumcenter (reindex s e) = circumcenter s
[PROOFSTEP]
simp_rw [circumcenter, circumsphere_reindex]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
m n : ℕ
s : Simplex ℝ P m
e : Fin (m + 1) ≃ Fin (n + 1)
⊢ circumradius (reindex s e) = circumradius s
[PROOFSTEP]
simp_rw [circumradius, circumsphere_reindex]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p1 p2 : P
hp1 : p1 ∈ affineSpan ℝ (Set.range s.points)
⊢ dist p1 p2 * dist p1 p2 =
    dist p1 ↑(↑(orthogonalProjectionSpan s) p2) * dist p1 ↑(↑(orthogonalProjectionSpan s) p2) +
      dist p2 ↑(↑(orthogonalProjectionSpan s) p2) * dist p2 ↑(↑(orthogonalProjectionSpan s) p2)
[PROOFSTEP]
rw [PseudoMetricSpace.dist_comm p2 _, dist_eq_norm_vsub V p1 _, dist_eq_norm_vsub V p1 _, dist_eq_norm_vsub V _ p2, ←
  vsub_add_vsub_cancel p1 (s.orthogonalProjectionSpan p2) p2, norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p1 p2 : P
hp1 : p1 ∈ affineSpan ℝ (Set.range s.points)
⊢ inner (p1 -ᵥ ↑(↑(orthogonalProjectionSpan s) p2)) (↑(↑(orthogonalProjectionSpan s) p2) -ᵥ p2) = 0
[PROOFSTEP]
exact
  Submodule.inner_right_of_mem_orthogonal (vsub_orthogonalProjection_mem_direction p2 hp1)
    (orthogonalProjection_vsub_mem_direction_orthogonal _ p2)
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
r : ℝ
s : Simplex ℝ P n
p₁ : P
h₁ : ∀ (i : Fin (n + 1)), dist (points s i) p₁ = r
h₁' : ↑(↑(orthogonalProjectionSpan s) p₁) = circumcenter s
h : points s 0 ∈ affineSpan ℝ (Set.range s.points)
⊢ dist p₁ (circumcenter s) * dist p₁ (circumcenter s) = r * r - circumradius s * circumradius s
[PROOFSTEP]
rw [dist_comm, ← h₁ 0, s.dist_sq_eq_dist_orthogonalProjection_sq_add_dist_orthogonalProjection_sq p₁ h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
r : ℝ
s : Simplex ℝ P n
p₁ : P
h₁ : ∀ (i : Fin (n + 1)), dist (points s i) p₁ = r
h₁' : ↑(↑(orthogonalProjectionSpan s) p₁) = circumcenter s
h : points s 0 ∈ affineSpan ℝ (Set.range s.points)
⊢ dist (circumcenter s) p₁ * dist (circumcenter s) p₁ =
    dist (points s 0) ↑(↑(orthogonalProjectionSpan s) p₁) * dist (points s 0) ↑(↑(orthogonalProjectionSpan s) p₁) +
        dist p₁ ↑(↑(orthogonalProjectionSpan s) p₁) * dist p₁ ↑(↑(orthogonalProjectionSpan s) p₁) -
      circumradius s * circumradius s
[PROOFSTEP]
simp only [h₁', dist_comm p₁, add_sub_cancel', Simplex.dist_circumcenter_eq_circumradius]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hr : ∃ r, ∀ (i : Fin (n + 1)), dist (points s i) p = r
⊢ ↑(↑(orthogonalProjectionSpan s) p) = circumcenter s
[PROOFSTEP]
change ∃ r : ℝ, ∀ i, (fun x => dist x p = r) (s.points i) at hr 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hr : ∃ r, ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
⊢ ↑(↑(orthogonalProjectionSpan s) p) = circumcenter s
[PROOFSTEP]
have hr : ∃ (r : ℝ), ∀ (a : P), a ∈ Set.range (fun (i : Fin (n + 1)) => s.points i) → dist a p = r :=
  by
  cases' hr with r hr
  use r
  refine' Set.forall_range_iff.mpr _
  exact hr
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hr : ∃ r, ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
⊢ ∃ r, ∀ (a : P), (a ∈ Set.range fun i => points s i) → dist a p = r
[PROOFSTEP]
cases' hr with r hr
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
r : ℝ
hr : ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
⊢ ∃ r, ∀ (a : P), (a ∈ Set.range fun i => points s i) → dist a p = r
[PROOFSTEP]
use r
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
r : ℝ
hr : ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
⊢ ∀ (a : P), (a ∈ Set.range fun i => points s i) → dist a p = r
[PROOFSTEP]
refine' Set.forall_range_iff.mpr _
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
r : ℝ
hr : ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
⊢ ∀ (i : Fin (n + 1)), dist (points s i) p = r
[PROOFSTEP]
exact hr
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hr✝ : ∃ r, ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
hr : ∃ r, ∀ (a : P), (a ∈ Set.range fun i => points s i) → dist a p = r
⊢ ↑(↑(orthogonalProjectionSpan s) p) = circumcenter s
[PROOFSTEP]
rw [exists_dist_eq_iff_exists_dist_orthogonalProjection_eq (subset_affineSpan ℝ _) p] at hr 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hr✝¹ : ∃ r, ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
hr✝ : ∃ r, ∀ (a : P), (a ∈ Set.range fun i => points s i) → dist a p = r
hr :
  ∃ r,
    ∀ (p1 : P),
      (p1 ∈ Set.range fun i => points s i) →
        dist p1 ↑(↑(EuclideanGeometry.orthogonalProjection (affineSpan ℝ (Set.range fun i => points s i))) p) = r
⊢ ↑(↑(orthogonalProjectionSpan s) p) = circumcenter s
[PROOFSTEP]
cases' hr with r hr
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p : P
hr✝¹ : ∃ r, ∀ (i : Fin (n + 1)), (fun x => dist x p = r) (points s i)
hr✝ : ∃ r, ∀ (a : P), (a ∈ Set.range fun i => points s i) → dist a p = r
r : ℝ
hr :
  ∀ (p1 : P),
    (p1 ∈ Set.range fun i => points s i) →
      dist p1 ↑(↑(EuclideanGeometry.orthogonalProjection (affineSpan ℝ (Set.range fun i => points s i))) p) = r
⊢ ↑(↑(orthogonalProjectionSpan s) p) = circumcenter s
[PROOFSTEP]
exact s.eq_circumcenter_of_dist_eq (orthogonalProjection_mem p) fun i => hr _ (Set.mem_range_self i)
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
fs : Finset (Fin (n + 1))
m : ℕ
h : card fs = m + 1
⊢ ∃ r, ∀ (i : Fin (m + 1)), dist (points (face s h) i) (circumcenter s) = r
[PROOFSTEP]
use s.circumradius
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
fs : Finset (Fin (n + 1))
m : ℕ
h : card fs = m + 1
⊢ ∀ (i : Fin (m + 1)), dist (points (face s h) i) (circumcenter s) = circumradius s
[PROOFSTEP]
simp [face_points]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
⊢ circumcenter s₁ = circumcenter s₂
[PROOFSTEP]
have hs : s₁.circumcenter ∈ affineSpan ℝ (Set.range s₂.points) := h ▸ s₁.circumcenter_mem_affineSpan
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
hs : circumcenter s₁ ∈ affineSpan ℝ (Set.range s₂.points)
⊢ circumcenter s₁ = circumcenter s₂
[PROOFSTEP]
have hr : ∀ i, dist (s₂.points i) s₁.circumcenter = s₁.circumradius :=
  by
  intro i
  have hi : s₂.points i ∈ Set.range s₂.points := Set.mem_range_self _
  rw [← h, Set.mem_range] at hi 
  rcases hi with ⟨j, hj⟩
  rw [← hj, s₁.dist_circumcenter_eq_circumradius j]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
hs : circumcenter s₁ ∈ affineSpan ℝ (Set.range s₂.points)
⊢ ∀ (i : Fin (n + 1)), dist (points s₂ i) (circumcenter s₁) = circumradius s₁
[PROOFSTEP]
intro i
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
hs : circumcenter s₁ ∈ affineSpan ℝ (Set.range s₂.points)
i : Fin (n + 1)
⊢ dist (points s₂ i) (circumcenter s₁) = circumradius s₁
[PROOFSTEP]
have hi : s₂.points i ∈ Set.range s₂.points := Set.mem_range_self _
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
hs : circumcenter s₁ ∈ affineSpan ℝ (Set.range s₂.points)
i : Fin (n + 1)
hi : points s₂ i ∈ Set.range s₂.points
⊢ dist (points s₂ i) (circumcenter s₁) = circumradius s₁
[PROOFSTEP]
rw [← h, Set.mem_range] at hi 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
hs : circumcenter s₁ ∈ affineSpan ℝ (Set.range s₂.points)
i : Fin (n + 1)
hi : ∃ y, points s₁ y = points s₂ i
⊢ dist (points s₂ i) (circumcenter s₁) = circumradius s₁
[PROOFSTEP]
rcases hi with ⟨j, hj⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
hs : circumcenter s₁ ∈ affineSpan ℝ (Set.range s₂.points)
i j : Fin (n + 1)
hj : points s₁ j = points s₂ i
⊢ dist (points s₂ i) (circumcenter s₁) = circumradius s₁
[PROOFSTEP]
rw [← hj, s₁.dist_circumcenter_eq_circumradius j]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s₁ s₂ : Simplex ℝ P n
h : Set.range s₁.points = Set.range s₂.points
hs : circumcenter s₁ ∈ affineSpan ℝ (Set.range s₂.points)
hr : ∀ (i : Fin (n + 1)), dist (points s₂ i) (circumcenter s₁) = circumradius s₁
⊢ circumcenter s₁ = circumcenter s₂
[PROOFSTEP]
exact s₂.eq_circumcenter_of_dist_eq hs hr
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
x✝¹ x✝ : Fin (n + 1)
h : (fun i => point_index i) x✝¹ = (fun i => point_index i) x✝
⊢ x✝¹ = x✝
[PROOFSTEP]
injection h
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
⊢ ∑ i : PointsWithCircumcenterIndex n, f i = ∑ i : Fin (n + 1), f (point_index i) + f circumcenter_index
[PROOFSTEP]
have h : univ = insert circumcenter_index (univ.map (pointIndexEmbedding n)) :=
  by
  ext x
  refine' ⟨fun h => _, fun _ => mem_univ _⟩
  cases' x with i
  · exact mem_insert_of_mem (mem_map_of_mem _ (mem_univ i))
  · exact mem_insert_self _ _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
⊢ univ = insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
[PROOFSTEP]
ext x
[GOAL]
case a
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
x : PointsWithCircumcenterIndex n
⊢ x ∈ univ ↔ x ∈ insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
[PROOFSTEP]
refine' ⟨fun h => _, fun _ => mem_univ _⟩
[GOAL]
case a
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
x : PointsWithCircumcenterIndex n
h : x ∈ univ
⊢ x ∈ insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
[PROOFSTEP]
cases' x with i
[GOAL]
case a.point_index
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
i : Fin (n + 1)
h : point_index i ∈ univ
⊢ point_index i ∈ insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
[PROOFSTEP]
exact mem_insert_of_mem (mem_map_of_mem _ (mem_univ i))
[GOAL]
case a.circumcenter_index
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
h : circumcenter_index ∈ univ
⊢ circumcenter_index ∈ insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
[PROOFSTEP]
exact mem_insert_self _ _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
h : univ = insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
⊢ ∑ i : PointsWithCircumcenterIndex n, f i = ∑ i : Fin (n + 1), f (point_index i) + f circumcenter_index
[PROOFSTEP]
change _ = (∑ i, f (pointIndexEmbedding n i)) + _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
h : univ = insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
⊢ ∑ i : PointsWithCircumcenterIndex n, f i = ∑ i : Fin (n + 1), f (↑(pointIndexEmbedding n) i) + f circumcenter_index
[PROOFSTEP]
rw [add_comm, h, ← sum_map, sum_insert]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
h : univ = insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
⊢ ¬circumcenter_index ∈ Finset.map (pointIndexEmbedding n) univ
[PROOFSTEP]
simp_rw [Finset.mem_map, not_exists]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
h : univ = insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
⊢ ∀ (x : Fin (n + 1)), ¬(x ∈ univ ∧ ↑(pointIndexEmbedding n) x = circumcenter_index)
[PROOFSTEP]
rintro x ⟨_, h⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : PointsWithCircumcenterIndex n → α
h✝ : univ = insert circumcenter_index (Finset.map (pointIndexEmbedding n) univ)
x : Fin (n + 1)
left✝ : x ∈ univ
h : ↑(pointIndexEmbedding n) x = circumcenter_index
⊢ False
[PROOFSTEP]
injection h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i : Fin (n + 1)
⊢ ∑ j : PointsWithCircumcenterIndex n, pointWeightsWithCircumcenter i j = 1
[PROOFSTEP]
convert sum_ite_eq' univ (point_index i) (Function.const _ (1 : ℝ)) with j
[GOAL]
case h.e'_2.a
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i : Fin (n + 1)
j : PointsWithCircumcenterIndex n
a✝ : j ∈ univ
⊢ pointWeightsWithCircumcenter i j = if j = point_index i then Function.const (PointsWithCircumcenterIndex n) 1 j else 0
[PROOFSTEP]
cases j
[GOAL]
case h.e'_2.a.point_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i a✝¹ : Fin (n + 1)
a✝ : point_index a✝¹ ∈ univ
⊢ pointWeightsWithCircumcenter i (point_index a✝¹) =
    if point_index a✝¹ = point_index i then Function.const (PointsWithCircumcenterIndex n) 1 (point_index a✝¹) else 0
[PROOFSTEP]
simp [pointWeightsWithCircumcenter]
[GOAL]
case h.e'_2.a.circumcenter_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i : Fin (n + 1)
a✝ : circumcenter_index ∈ univ
⊢ pointWeightsWithCircumcenter i circumcenter_index =
    if circumcenter_index = point_index i then Function.const (PointsWithCircumcenterIndex n) 1 circumcenter_index
    else 0
[PROOFSTEP]
simp [pointWeightsWithCircumcenter]
[GOAL]
case h.e'_3
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i : Fin (n + 1)
⊢ 1 = if point_index i ∈ univ then Function.const (PointsWithCircumcenterIndex n) 1 (point_index i) else 0
[PROOFSTEP]
simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
⊢ points s i = ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (pointWeightsWithCircumcenter i)
[PROOFSTEP]
rw [← pointsWithCircumcenter_point]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
⊢ pointsWithCircumcenter s (point_index i) =
    ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (pointWeightsWithCircumcenter i)
[PROOFSTEP]
symm
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
⊢ ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (pointWeightsWithCircumcenter i) =
    pointsWithCircumcenter s (point_index i)
[PROOFSTEP]
refine' affineCombination_of_eq_one_of_eq_zero _ _ _ (mem_univ _) (by simp [pointWeightsWithCircumcenter]) _
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
⊢ pointWeightsWithCircumcenter i (point_index i) = 1
[PROOFSTEP]
simp [pointWeightsWithCircumcenter]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
⊢ ∀ (i2 : PointsWithCircumcenterIndex n), i2 ∈ univ → i2 ≠ point_index i → pointWeightsWithCircumcenter i i2 = 0
[PROOFSTEP]
intro i hi hn
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i✝ : Fin (n + 1)
i : PointsWithCircumcenterIndex n
hi : i ∈ univ
hn : i ≠ point_index i✝
⊢ pointWeightsWithCircumcenter i✝ i = 0
[PROOFSTEP]
cases i
[GOAL]
case point_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i a✝ : Fin (n + 1)
hi : point_index a✝ ∈ univ
hn : point_index a✝ ≠ point_index i
⊢ pointWeightsWithCircumcenter i (point_index a✝) = 0
[PROOFSTEP]
have h : _ ≠ i := fun h => hn (h ▸ rfl)
[GOAL]
case point_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i a✝ : Fin (n + 1)
hi : point_index a✝ ∈ univ
hn : point_index a✝ ≠ point_index i
h : a✝ ≠ i
⊢ pointWeightsWithCircumcenter i (point_index a✝) = 0
[PROOFSTEP]
simp [pointWeightsWithCircumcenter, h]
[GOAL]
case circumcenter_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
hi : circumcenter_index ∈ univ
hn : circumcenter_index ≠ point_index i
⊢ pointWeightsWithCircumcenter i circumcenter_index = 0
[PROOFSTEP]
rfl
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
fs : Finset (Fin (n + 1))
h : Finset.Nonempty fs
⊢ ∑ i : PointsWithCircumcenterIndex n, centroidWeightsWithCircumcenter fs i = 1
[PROOFSTEP]
simp_rw [sum_pointsWithCircumcenter, centroidWeightsWithCircumcenter, add_zero, ←
  fs.sum_centroidWeights_eq_one_of_nonempty ℝ h, Set.sum_indicator_subset _ fs.subset_univ]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
fs : Finset (Fin (n + 1))
h : Finset.Nonempty fs
⊢ (∑ x : Fin (n + 1), if x ∈ fs then (↑(card fs))⁻¹ else 0) =
    ∑ i : Fin (n + 1), Set.indicator (↑fs) (fun i => centroidWeights ℝ fs i) i
[PROOFSTEP]
rcongr
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
fs : Finset (Fin (n + 1))
⊢ centroid ℝ fs s.points = ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (centroidWeightsWithCircumcenter fs)
[PROOFSTEP]
simp_rw [centroid_def, affineCombination_apply, weightedVSubOfPoint_apply, sum_pointsWithCircumcenter,
  centroidWeightsWithCircumcenter, pointsWithCircumcenter_point, zero_smul, add_zero, centroidWeights,
  Set.sum_indicator_subset_of_eq_zero (Function.const (Fin (n + 1)) (card fs : ℝ)⁻¹)
    (fun i wi => wi • (s.points i -ᵥ Classical.choice AddTorsor.Nonempty)) fs.subset_univ fun _ => zero_smul ℝ _,
  Set.indicator_apply]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
fs : Finset (Fin (n + 1))
⊢ ∑ x : Fin (n + 1),
        (if x ∈ ↑fs then Function.const (Fin (n + 1)) (↑(card fs))⁻¹ x else 0) •
          (points s x -ᵥ choice (_ : Nonempty P)) +ᵥ
      choice (_ : Nonempty P) =
    ∑ x : Fin (n + 1), (if x ∈ fs then (↑(card fs))⁻¹ else 0) • (points s x -ᵥ choice (_ : Nonempty P)) +ᵥ
      choice (_ : Nonempty P)
[PROOFSTEP]
congr
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
⊢ ∑ i : PointsWithCircumcenterIndex n, circumcenterWeightsWithCircumcenter n i = 1
[PROOFSTEP]
convert sum_ite_eq' univ circumcenter_index (Function.const _ (1 : ℝ)) with j
[GOAL]
case h.e'_2.a
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
j : PointsWithCircumcenterIndex n
a✝ : j ∈ univ
⊢ circumcenterWeightsWithCircumcenter n j =
    if j = circumcenter_index then Function.const (PointsWithCircumcenterIndex n) 1 j else 0
[PROOFSTEP]
cases j
[GOAL]
case h.e'_2.a.point_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
a✝¹ : Fin (n + 1)
a✝ : point_index a✝¹ ∈ univ
⊢ circumcenterWeightsWithCircumcenter n (point_index a✝¹) =
    if point_index a✝¹ = circumcenter_index then Function.const (PointsWithCircumcenterIndex n) 1 (point_index a✝¹)
    else 0
[PROOFSTEP]
simp [circumcenterWeightsWithCircumcenter]
[GOAL]
case h.e'_2.a.circumcenter_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
a✝ : circumcenter_index ∈ univ
⊢ circumcenterWeightsWithCircumcenter n circumcenter_index =
    if circumcenter_index = circumcenter_index then Function.const (PointsWithCircumcenterIndex n) 1 circumcenter_index
    else 0
[PROOFSTEP]
simp [circumcenterWeightsWithCircumcenter]
[GOAL]
case h.e'_3
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
⊢ 1 = if circumcenter_index ∈ univ then Function.const (PointsWithCircumcenterIndex n) 1 circumcenter_index else 0
[PROOFSTEP]
simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
⊢ circumcenter s = ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (circumcenterWeightsWithCircumcenter n)
[PROOFSTEP]
rw [← pointsWithCircumcenter_eq_circumcenter]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
⊢ pointsWithCircumcenter s circumcenter_index =
    ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (circumcenterWeightsWithCircumcenter n)
[PROOFSTEP]
symm
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
⊢ ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (circumcenterWeightsWithCircumcenter n) =
    pointsWithCircumcenter s circumcenter_index
[PROOFSTEP]
refine' affineCombination_of_eq_one_of_eq_zero _ _ _ (mem_univ _) rfl _
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
⊢ ∀ (i2 : PointsWithCircumcenterIndex n),
    i2 ∈ univ → i2 ≠ circumcenter_index → circumcenterWeightsWithCircumcenter n i2 = 0
[PROOFSTEP]
rintro ⟨i⟩ _ hn
[GOAL]
case point_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i : Fin (n + 1)
a✝ : point_index i ∈ univ
hn : point_index i ≠ circumcenter_index
⊢ circumcenterWeightsWithCircumcenter n (point_index i) = 0
[PROOFSTEP]
tauto
[GOAL]
case circumcenter_index
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
a✝ : circumcenter_index ∈ univ
hn : circumcenter_index ≠ circumcenter_index
⊢ circumcenterWeightsWithCircumcenter n circumcenter_index = 0
[PROOFSTEP]
tauto
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
⊢ ∑ i : PointsWithCircumcenterIndex n, reflectionCircumcenterWeightsWithCircumcenter i₁ i₂ i = 1
[PROOFSTEP]
simp_rw [sum_pointsWithCircumcenter, reflectionCircumcenterWeightsWithCircumcenter, sum_ite, sum_const, filter_or,
  filter_eq']
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
⊢ card ((if i₁ ∈ univ then {i₁} else ∅) ∪ if i₂ ∈ univ then {i₂} else ∅) • 1 +
        card (filter (fun x => ¬(x = i₁ ∨ x = i₂)) univ) • 0 +
      -1 =
    1
[PROOFSTEP]
rw [card_union_eq]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
⊢ (card (if i₁ ∈ univ then {i₁} else ∅) + card (if i₂ ∈ univ then {i₂} else ∅)) • 1 +
        card (filter (fun x => ¬(x = i₁ ∨ x = i₂)) univ) • 0 +
      -1 =
    1
[PROOFSTEP]
simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
⊢ Disjoint (if i₁ ∈ univ then {i₁} else ∅) (if i₂ ∈ univ then {i₂} else ∅)
[PROOFSTEP]
simpa only [if_true, mem_univ, disjoint_singleton] using h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
⊢ ↑(EuclideanGeometry.reflection (affineSpan ℝ (s.points '' {i₁, i₂}))) (circumcenter s) =
    ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (reflectionCircumcenterWeightsWithCircumcenter i₁ i₂)
[PROOFSTEP]
have hc : card ({ i₁, i₂ } : Finset (Fin (n + 1))) = 2 := by
  simp [h]
    -- Making the next line a separate definition helps the elaborator:
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
⊢ card {i₁, i₂} = 2
[PROOFSTEP]
simp [h]
  -- Making the next line a separate definition helps the elaborator:
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
⊢ ↑(EuclideanGeometry.reflection (affineSpan ℝ (s.points '' {i₁, i₂}))) (circumcenter s) =
    ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (reflectionCircumcenterWeightsWithCircumcenter i₁ i₂)
[PROOFSTEP]
set W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' { i₁, i₂ })
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
⊢ ↑(EuclideanGeometry.reflection (affineSpan ℝ (s.points '' {i₁, i₂}))) (circumcenter s) =
    ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (reflectionCircumcenterWeightsWithCircumcenter i₁ i₂)
[PROOFSTEP]
have h_faces : (orthogonalProjection W s.circumcenter : P) = ↑((s.face hc).orthogonalProjectionSpan s.circumcenter) :=
  by
  apply eq_orthogonalProjection_of_eq_subspace
  simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
⊢ ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
[PROOFSTEP]
apply eq_orthogonalProjection_of_eq_subspace
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
⊢ W = affineSpan ℝ (Set.range (face s hc).points)
[PROOFSTEP]
simp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
h_faces :
  ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
⊢ ↑(EuclideanGeometry.reflection (affineSpan ℝ (s.points '' {i₁, i₂}))) (circumcenter s) =
    ↑(affineCombination ℝ univ (pointsWithCircumcenter s)) (reflectionCircumcenterWeightsWithCircumcenter i₁ i₂)
[PROOFSTEP]
rw [EuclideanGeometry.reflection_apply, h_faces, s.orthogonalProjection_circumcenter hc, circumcenter_eq_centroid,
  s.face_centroid_eq_centroid hc, centroid_eq_affineCombination_of_pointsWithCircumcenter,
  circumcenter_eq_affineCombination_of_pointsWithCircumcenter, ← @vsub_eq_zero_iff_eq V, affineCombination_vsub,
  weightedVSub_vadd_affineCombination, affineCombination_vsub, weightedVSub_apply, sum_pointsWithCircumcenter]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
h_faces :
  ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
⊢ ∑ i : Fin (n + 1),
        (centroidWeightsWithCircumcenter {i₁, i₂} - circumcenterWeightsWithCircumcenter n +
                centroidWeightsWithCircumcenter {i₁, i₂} -
              reflectionCircumcenterWeightsWithCircumcenter i₁ i₂)
            (point_index i) •
          (pointsWithCircumcenter s (point_index i) -ᵥ choice (_ : Nonempty P)) +
      (centroidWeightsWithCircumcenter {i₁, i₂} - circumcenterWeightsWithCircumcenter n +
              centroidWeightsWithCircumcenter {i₁, i₂} -
            reflectionCircumcenterWeightsWithCircumcenter i₁ i₂)
          circumcenter_index •
        (pointsWithCircumcenter s circumcenter_index -ᵥ choice (_ : Nonempty P)) =
    0
[PROOFSTEP]
simp_rw [Pi.sub_apply, Pi.add_apply, Pi.sub_apply, sub_smul, add_smul, sub_smul, centroidWeightsWithCircumcenter,
  circumcenterWeightsWithCircumcenter, reflectionCircumcenterWeightsWithCircumcenter, ite_smul, zero_smul, sub_zero,
  apply_ite₂ (· + ·), add_zero, ← add_smul, hc, zero_sub, neg_smul, sub_self, add_zero]
  -- Porting note: was `convert sum_const_zero`
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
h_faces :
  ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
⊢ ∑ x : Fin (n + 1),
      ((if x ∈ {i₁, i₂} then ((↑2)⁻¹ + (↑2)⁻¹) • (pointsWithCircumcenter s (point_index x) -ᵥ choice (_ : Nonempty P))
        else 0) -
        if x = i₁ ∨ x = i₂ then 1 • (pointsWithCircumcenter s (point_index x) -ᵥ choice (_ : Nonempty P)) else 0) =
    0
[PROOFSTEP]
rw [← sum_const_zero]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
h_faces :
  ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
⊢ ∑ x : Fin (n + 1),
      ((if x ∈ {i₁, i₂} then ((↑2)⁻¹ + (↑2)⁻¹) • (pointsWithCircumcenter s (point_index x) -ᵥ choice (_ : Nonempty P))
        else ∑ _x in ?m.873438, 0) -
        if x = i₁ ∨ x = i₂ then 1 • (pointsWithCircumcenter s (point_index x) -ᵥ choice (_ : Nonempty P))
        else ∑ _x in ?m.873438, 0) =
    ∑ _x in ?m.873438, 0
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
h_faces :
  ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
⊢ Type ?u.873434
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
h_faces :
  ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
⊢ Finset ?m.873437
[PROOFSTEP]
congr
[GOAL]
case e_f
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
i₁ i₂ : Fin (n + 1)
h : i₁ ≠ i₂
hc : card {i₁, i₂} = 2
W : AffineSubspace ℝ P := affineSpan ℝ (s.points '' {i₁, i₂})
h_faces :
  ↑(↑(EuclideanGeometry.orthogonalProjection W) (circumcenter s)) =
    ↑(↑(orthogonalProjectionSpan (face s hc)) (circumcenter s))
⊢ (fun x =>
      (if x ∈ {i₁, i₂} then ((↑2)⁻¹ + (↑2)⁻¹) • (pointsWithCircumcenter s (point_index x) -ᵥ choice (_ : Nonempty P))
        else ∑ _x : Fin (n + 1), 0) -
        if x = i₁ ∨ x = i₂ then 1 • (pointsWithCircumcenter s (point_index x) -ᵥ choice (_ : Nonempty P))
        else ∑ _x : Fin (n + 1), 0) =
    fun _x => 0
[PROOFSTEP]
norm_num
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
⊢ Cospherical ps ↔ ∃ center, center ∈ s ∧ ∃ radius, ∀ (p : P), p ∈ ps → dist p center = radius
[PROOFSTEP]
constructor
[GOAL]
case mp
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
⊢ Cospherical ps → ∃ center, center ∈ s ∧ ∃ radius, ∀ (p : P), p ∈ ps → dist p center = radius
[PROOFSTEP]
rintro ⟨c, hcr⟩
[GOAL]
case mp.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
c : P
hcr : ∃ radius, ∀ (p : P), p ∈ ps → dist p c = radius
⊢ ∃ center, center ∈ s ∧ ∃ radius, ∀ (p : P), p ∈ ps → dist p center = radius
[PROOFSTEP]
rw [exists_dist_eq_iff_exists_dist_orthogonalProjection_eq h c] at hcr 
[GOAL]
case mp.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
c : P
hcr : ∃ r, ∀ (p1 : P), p1 ∈ ps → dist p1 ↑(↑(orthogonalProjection s) c) = r
⊢ ∃ center, center ∈ s ∧ ∃ radius, ∀ (p : P), p ∈ ps → dist p center = radius
[PROOFSTEP]
exact ⟨orthogonalProjection s c, orthogonalProjection_mem _, hcr⟩
[GOAL]
case mpr
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
inst✝ : HasOrthogonalProjection (direction s)
⊢ (∃ center, center ∈ s ∧ ∃ radius, ∀ (p : P), p ∈ ps → dist p center = radius) → Cospherical ps
[PROOFSTEP]
exact fun ⟨c, _, hd⟩ => ⟨c, hd⟩
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
⊢ ∃ r, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
[PROOFSTEP]
rw [cospherical_iff_exists_mem_of_finiteDimensional h] at hc 
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : ∃ center, center ∈ s ∧ ∃ radius, ∀ (p : P), p ∈ ps → dist p center = radius
⊢ ∃ r, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
[PROOFSTEP]
rcases hc with ⟨c, hc, r, hcr⟩
[GOAL]
case intro.intro.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
⊢ ∃ r, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
[PROOFSTEP]
use r
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
⊢ ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
[PROOFSTEP]
intro sx hsxps
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
⊢ Simplex.circumradius sx = r
[PROOFSTEP]
have hsx : affineSpan ℝ (Set.range sx.points) = s :=
  by
  refine'
    sx.Independent.affineSpan_eq_of_le_of_card_eq_finrank_add_one (spanPoints_subset_coe_of_subset_coe (hsxps.trans h))
      _
  simp [hd]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
⊢ affineSpan ℝ (Set.range sx.points) = s
[PROOFSTEP]
refine'
  sx.Independent.affineSpan_eq_of_le_of_card_eq_finrank_add_one (spanPoints_subset_coe_of_subset_coe (hsxps.trans h)) _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
⊢ Fintype.card (Fin (n + 1)) = finrank ℝ { x // x ∈ direction s } + 1
[PROOFSTEP]
simp [hd]
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
hsx : affineSpan ℝ (Set.range sx.points) = s
⊢ Simplex.circumradius sx = r
[PROOFSTEP]
have hc : c ∈ affineSpan ℝ (Set.range sx.points) := hsx.symm ▸ hc
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc✝ : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
hsx : affineSpan ℝ (Set.range sx.points) = s
hc : c ∈ affineSpan ℝ (Set.range sx.points)
⊢ Simplex.circumradius sx = r
[PROOFSTEP]
exact (sx.eq_circumradius_of_dist_eq hc fun i => hcr (sx.points i) (hsxps (Set.mem_range_self i))).symm
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
⊢ Simplex.circumradius sx₁ = Simplex.circumradius sx₂
[PROOFSTEP]
rcases exists_circumradius_eq_of_cospherical_subset h hd hc with ⟨r, hr⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
r : ℝ
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
⊢ Simplex.circumradius sx₁ = Simplex.circumradius sx₂
[PROOFSTEP]
rw [hr sx₁ hsx₁, hr sx₂ hsx₂]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
⊢ ∃ r, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
[PROOFSTEP]
haveI : Nonempty (⊤ : AffineSubspace ℝ P) := Set.univ.nonempty
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ∃ r, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
[PROOFSTEP]
rw [← finrank_top, ← direction_top ℝ V P] at hd 
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ { x // x ∈ direction ⊤ } = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ∃ r, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
[PROOFSTEP]
refine' exists_circumradius_eq_of_cospherical_subset _ hd hc
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ { x // x ∈ direction ⊤ } = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ps ⊆ ↑⊤
[PROOFSTEP]
exact Set.subset_univ _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
⊢ Simplex.circumradius sx₁ = Simplex.circumradius sx₂
[PROOFSTEP]
rcases exists_circumradius_eq_of_cospherical hd hc with ⟨r, hr⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
r : ℝ
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
⊢ Simplex.circumradius sx₁ = Simplex.circumradius sx₂
[PROOFSTEP]
rw [hr sx₁ hsx₁, hr sx₂ hsx₂]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
[PROOFSTEP]
rw [cospherical_iff_exists_mem_of_finiteDimensional h] at hc 
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : ∃ center, center ∈ s ∧ ∃ radius, ∀ (p : P), p ∈ ps → dist p center = radius
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
[PROOFSTEP]
rcases hc with ⟨c, hc, r, hcr⟩
[GOAL]
case intro.intro.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
[PROOFSTEP]
use c
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
⊢ ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
[PROOFSTEP]
intro sx hsxps
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
⊢ Simplex.circumcenter sx = c
[PROOFSTEP]
have hsx : affineSpan ℝ (Set.range sx.points) = s :=
  by
  refine'
    sx.Independent.affineSpan_eq_of_le_of_card_eq_finrank_add_one (spanPoints_subset_coe_of_subset_coe (hsxps.trans h))
      _
  simp [hd]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
⊢ affineSpan ℝ (Set.range sx.points) = s
[PROOFSTEP]
refine'
  sx.Independent.affineSpan_eq_of_le_of_card_eq_finrank_add_one (spanPoints_subset_coe_of_subset_coe (hsxps.trans h)) _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
⊢ Fintype.card (Fin (n + 1)) = finrank ℝ { x // x ∈ direction s } + 1
[PROOFSTEP]
simp [hd]
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
hsx : affineSpan ℝ (Set.range sx.points) = s
⊢ Simplex.circumcenter sx = c
[PROOFSTEP]
have hc : c ∈ affineSpan ℝ (Set.range sx.points) := hsx.symm ▸ hc
[GOAL]
case h
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
c : P
hc✝ : c ∈ s
r : ℝ
hcr : ∀ (p : P), p ∈ ps → dist p c = r
sx : Simplex ℝ P n
hsxps : Set.range sx.points ⊆ ps
hsx : affineSpan ℝ (Set.range sx.points) = s
hc : c ∈ affineSpan ℝ (Set.range sx.points)
⊢ Simplex.circumcenter sx = c
[PROOFSTEP]
exact (sx.eq_circumcenter_of_dist_eq hc fun i => hcr (sx.points i) (hsxps (Set.mem_range_self i))).symm
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
⊢ Simplex.circumcenter sx₁ = Simplex.circumcenter sx₂
[PROOFSTEP]
rcases exists_circumcenter_eq_of_cospherical_subset h hd hc with ⟨r, hr⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
r : P
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = r
⊢ Simplex.circumcenter sx₁ = Simplex.circumcenter sx₂
[PROOFSTEP]
rw [hr sx₁ hsx₁, hr sx₂ hsx₂]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
[PROOFSTEP]
haveI : Nonempty (⊤ : AffineSubspace ℝ P) := Set.univ.nonempty
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
[PROOFSTEP]
rw [← finrank_top, ← direction_top ℝ V P] at hd 
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ { x // x ∈ direction ⊤ } = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
[PROOFSTEP]
refine' exists_circumcenter_eq_of_cospherical_subset _ hd hc
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ { x // x ∈ direction ⊤ } = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ps ⊆ ↑⊤
[PROOFSTEP]
exact Set.subset_univ _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
⊢ Simplex.circumcenter sx₁ = Simplex.circumcenter sx₂
[PROOFSTEP]
rcases exists_circumcenter_eq_of_cospherical hd hc with ⟨r, hr⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
r : P
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = r
⊢ Simplex.circumcenter sx₁ = Simplex.circumcenter sx₂
[PROOFSTEP]
rw [hr sx₁ hsx₁, hr sx₂ hsx₂]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = c
[PROOFSTEP]
obtain ⟨r, hr⟩ := exists_circumradius_eq_of_cospherical_subset h hd hc
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
r : ℝ
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = c
[PROOFSTEP]
obtain ⟨c, hc⟩ := exists_circumcenter_eq_of_cospherical_subset h hd hc
[GOAL]
case intro.intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc✝ : Cospherical ps
r : ℝ
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumradius sx = r
c : P
hc : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumcenter sx = c
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = c
[PROOFSTEP]
exact ⟨⟨c, r⟩, fun sx hsx => Sphere.ext _ _ (hc sx hsx) (hr sx hsx)⟩
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
⊢ Simplex.circumsphere sx₁ = Simplex.circumsphere sx₂
[PROOFSTEP]
rcases exists_circumsphere_eq_of_cospherical_subset h hd hc with ⟨r, hr⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁵ : NormedAddCommGroup V
inst✝⁴ : InnerProductSpace ℝ V
inst✝³ : MetricSpace P
inst✝² : NormedAddTorsor V P
s : AffineSubspace ℝ P
ps : Set P
h : ps ⊆ ↑s
inst✝¹ : Nonempty { x // x ∈ s }
n : ℕ
inst✝ : FiniteDimensional ℝ { x // x ∈ direction s }
hd : finrank ℝ { x // x ∈ direction s } = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
r : Sphere P
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = r
⊢ Simplex.circumsphere sx₁ = Simplex.circumsphere sx₂
[PROOFSTEP]
rw [hr sx₁ hsx₁, hr sx₂ hsx₂]
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = c
[PROOFSTEP]
haveI : Nonempty (⊤ : AffineSubspace ℝ P) := Set.univ.nonempty
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = c
[PROOFSTEP]
rw [← finrank_top, ← direction_top ℝ V P] at hd 
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ { x // x ∈ direction ⊤ } = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ∃ c, ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = c
[PROOFSTEP]
refine' exists_circumsphere_eq_of_cospherical_subset _ hd hc
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ { x // x ∈ direction ⊤ } = n
hc : Cospherical ps
this : Nonempty { x // x ∈ ⊤ }
⊢ ps ⊆ ↑⊤
[PROOFSTEP]
exact Set.subset_univ _
[GOAL]
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
⊢ Simplex.circumsphere sx₁ = Simplex.circumsphere sx₂
[PROOFSTEP]
rcases exists_circumsphere_eq_of_cospherical hd hc with ⟨r, hr⟩
[GOAL]
case intro
V : Type u_1
P : Type u_2
inst✝⁴ : NormedAddCommGroup V
inst✝³ : InnerProductSpace ℝ V
inst✝² : MetricSpace P
inst✝¹ : NormedAddTorsor V P
ps : Set P
n : ℕ
inst✝ : FiniteDimensional ℝ V
hd : finrank ℝ V = n
hc : Cospherical ps
sx₁ sx₂ : Simplex ℝ P n
hsx₁ : Set.range sx₁.points ⊆ ps
hsx₂ : Set.range sx₂.points ⊆ ps
r : Sphere P
hr : ∀ (sx : Simplex ℝ P n), Set.range sx.points ⊆ ps → Simplex.circumsphere sx = r
⊢ Simplex.circumsphere sx₁ = Simplex.circumsphere sx₂
[PROOFSTEP]
rw [hr sx₁ hsx₁, hr sx₂ hsx₂]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁ : p₁ ∈ affineSpan ℝ (insert p (Set.range s.points))
hp₂ : p₂ ∈ affineSpan ℝ (insert p (Set.range s.points))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
set span_s := affineSpan ℝ (Set.range s.points)
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁ : p₁ ∈ affineSpan ℝ (insert p (Set.range s.points))
hp₂ : p₂ ∈ affineSpan ℝ (insert p (Set.range s.points))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
have h₁' := s.orthogonalProjection_eq_circumcenter_of_dist_eq h₁
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁ : p₁ ∈ affineSpan ℝ (insert p (Set.range s.points))
hp₂ : p₂ ∈ affineSpan ℝ (insert p (Set.range s.points))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
have h₂' := s.orthogonalProjection_eq_circumcenter_of_dist_eq h₂
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁ : p₁ ∈ affineSpan ℝ (insert p (Set.range s.points))
hp₂ : p₂ ∈ affineSpan ℝ (insert p (Set.range s.points))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [← affineSpan_insert_affineSpan, mem_affineSpan_insert_iff (orthogonalProjection_mem p)] at hp₁ hp₂ 
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₁ : ∃ r p0 _hp0, p₁ = r • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p0
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂ : ∃ r p0 _hp0, p₂ = r • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p0
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
obtain ⟨r₁, p₁o, hp₁o, hp₁⟩ := hp₁
[GOAL]
case intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂ : ∃ r p0 _hp0, p₂ = r • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p0
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ : ℝ
p₁o : P
hp₁o : p₁o ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₁o
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
obtain ⟨r₂, p₂o, hp₂o, hp₂⟩ := hp₂
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ : ℝ
p₁o : P
hp₁o : p₁o ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₁o
r₂ : ℝ
p₂o : P
hp₂o : p₂o ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
obtain rfl : ↑(s.orthogonalProjectionSpan p₁) = p₁o := by
  subst hp₁
  exact s.coe_orthogonalProjection_vadd_smul_vsub_orthogonalProjection hp₁o
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ : ℝ
p₁o : P
hp₁o : p₁o ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₁o
r₂ : ℝ
p₂o : P
hp₂o : p₂o ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o
⊢ ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = p₁o
[PROOFSTEP]
subst hp₁
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₂ : P
r : ℝ
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ : ℝ
p₁o : P
hp₁o : p₁o ∈ affineSpan ℝ (Set.range s.points)
r₂ : ℝ
p₂o : P
hp₂o : p₂o ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o
hp₁ :
  r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₁o ∈
    affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ :
  ∀ (i : Fin (n + 1)),
    dist (Simplex.points s i) (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₁o) = r
h₁' :
  ↑(↑(Simplex.orthogonalProjectionSpan s)
        (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₁o)) =
    Simplex.circumcenter s
⊢ ↑(↑(Simplex.orthogonalProjectionSpan s)
        (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₁o)) =
    p₁o
[PROOFSTEP]
exact s.coe_orthogonalProjection_vadd_smul_vsub_orthogonalProjection hp₁o
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
p₂o : P
hp₂o : p₂o ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ :
  p₁ =
    r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ
      ↑(↑(Simplex.orthogonalProjectionSpan s) p₁)
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [h₁'] at hp₁ 
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
p₂o : P
hp₂o : p₂o ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
obtain rfl : ↑(s.orthogonalProjectionSpan p₂) = p₂o := by
  subst hp₂
  exact s.coe_orthogonalProjection_vadd_smul_vsub_orthogonalProjection hp₂o
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
p₂o : P
hp₂o : p₂o ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
⊢ ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = p₂o
[PROOFSTEP]
subst hp₂
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
r₁ r₂ : ℝ
p₂o : P
hp₂o : p₂o ∈ affineSpan ℝ (Set.range s.points)
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂ :
  r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o ∈
    affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₂ :
  ∀ (i : Fin (n + 1)),
    dist (Simplex.points s i) (r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o) = r
h₂' :
  ↑(↑(Simplex.orthogonalProjectionSpan s)
        (r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o)) =
    Simplex.circumcenter s
⊢ ↑(↑(Simplex.orthogonalProjectionSpan s)
        (r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ p₂o)) =
    p₂o
[PROOFSTEP]
exact s.coe_orthogonalProjection_vadd_smul_vsub_orthogonalProjection hp₂o
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ :
  p₂ =
    r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ
      ↑(↑(Simplex.orthogonalProjectionSpan s) p₂)
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [h₂'] at hp₂ 
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
have h : s.points 0 ∈ span_s := mem_affineSpan ℝ (Set.mem_range_self _)
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
have hd₁ : dist p₁ s.circumcenter * dist p₁ s.circumcenter = r * r - s.circumradius * s.circumradius :=
  s.dist_circumcenter_sq_eq_sq_sub_circumradius h₁ h₁' h
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁ :
  dist p₁ (Simplex.circumcenter s) * dist p₁ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
have hd₂ : dist p₂ s.circumcenter * dist p₂ s.circumcenter = r * r - s.circumradius * s.circumradius :=
  s.dist_circumcenter_sq_eq_sq_sub_circumradius h₂ h₂' h
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁ :
  dist p₁ (Simplex.circumcenter s) * dist p₁ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [← hd₂, hp₁, hp₂, dist_eq_norm_vsub V _ s.circumcenter, dist_eq_norm_vsub V _ s.circumcenter, vadd_vsub, vadd_vsub, ←
  real_inner_self_eq_norm_mul_norm, ← real_inner_self_eq_norm_mul_norm, real_inner_smul_left, real_inner_smul_left,
  real_inner_smul_right, real_inner_smul_right, ← mul_assoc, ← mul_assoc] at hd₁ 
[GOAL]
case intro.intro.intro.intro.intro.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ :
  r₁ * r₁ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) =
    r₂ * r₂ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
by_cases hp : p = s.orthogonalProjectionSpan p
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ :
  r₁ * r₁ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) =
    r₂ * r₂ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [Simplex.orthogonalProjectionSpan] at hp 
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ :
  r₁ * r₁ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) =
    r₂ * r₂ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : p = ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [hp₁, hp₂, ← hp]
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ :
  r₁ * r₁ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) =
    r₂ * r₂ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : p = ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)
⊢ r₁ • (p -ᵥ p) +ᵥ Simplex.circumcenter s = r₂ • (p -ᵥ p) +ᵥ Simplex.circumcenter s ∨
    r₁ • (p -ᵥ p) +ᵥ Simplex.circumcenter s =
      ↑(reflection (affineSpan ℝ (Set.range s.points))) (r₂ • (p -ᵥ p) +ᵥ Simplex.circumcenter s)
[PROOFSTEP]
simp only [true_or_iff, eq_self_iff_true, smul_zero, vsub_self]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ :
  r₁ * r₁ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) =
    r₂ * r₂ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
have hz : ⟪p -ᵥ orthogonalProjection span_s p, p -ᵥ orthogonalProjection span_s p⟫ ≠ 0 := by
  simpa only [Ne.def, vsub_eq_zero_iff_eq, inner_self_eq_zero] using hp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ :
  r₁ * r₁ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) =
    r₂ * r₂ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
⊢ inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
[PROOFSTEP]
simpa only [Ne.def, vsub_eq_zero_iff_eq, inner_self_eq_zero] using hp
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ :
  r₁ * r₁ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) =
    r₂ * r₂ *
      inner (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
        (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
hz : inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [mul_left_inj' hz, mul_self_eq_mul_self_iff] at hd₁ 
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ : r₁ = r₂ ∨ r₁ = -r₂
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
hz : inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
⊢ p₁ = p₂ ∨ p₁ = ↑(reflection (affineSpan ℝ (Set.range s.points))) p₂
[PROOFSTEP]
rw [hp₁, hp₂]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁ : r₁ = r₂ ∨ r₁ = -r₂
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
hz : inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
⊢ r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
      r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s ∨
    r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
      ↑(reflection (affineSpan ℝ (Set.range s.points)))
        (r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s)
[PROOFSTEP]
cases' hd₁ with hd₁ hd₁
[GOAL]
case neg.inl
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
hz : inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
hd₁ : r₁ = r₂
⊢ r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
      r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s ∨
    r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
      ↑(reflection (affineSpan ℝ (Set.range s.points)))
        (r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s)
[PROOFSTEP]
left
[GOAL]
case neg.inl.h
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
hz : inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
hd₁ : r₁ = r₂
⊢ r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
    r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
[PROOFSTEP]
rw [hd₁]
[GOAL]
case neg.inr
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
hz : inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
hd₁ : r₁ = -r₂
⊢ r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
      r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s ∨
    r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
      ↑(reflection (affineSpan ℝ (Set.range s.points)))
        (r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s)
[PROOFSTEP]
right
[GOAL]
case neg.inr.h
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
n : ℕ
s : Simplex ℝ P n
p p₁ p₂ : P
r : ℝ
hp₁✝ : p₁ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
hp₂✝ : p₂ ∈ affineSpan ℝ (insert p ↑(affineSpan ℝ (Set.range s.points)))
h₁ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₁ = r
h₂ : ∀ (i : Fin (n + 1)), dist (Simplex.points s i) p₂ = r
span_s : AffineSubspace ℝ P := affineSpan ℝ (Set.range s.points)
h₁' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) = Simplex.circumcenter s
h₂' : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) = Simplex.circumcenter s
r₁ r₂ : ℝ
hp₁o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₁) ∈ affineSpan ℝ (Set.range s.points)
hp₁ : p₁ = r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
hp₂o : ↑(↑(Simplex.orthogonalProjectionSpan s) p₂) ∈ affineSpan ℝ (Set.range s.points)
hp₂ : p₂ = r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s
h : Simplex.points s 0 ∈ span_s
hd₁✝¹ :
  ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₁✝ :
  inner (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)))
      (r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))) =
    ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖ *
      ‖r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p))‖
hd₂ :
  dist p₂ (Simplex.circumcenter s) * dist p₂ (Simplex.circumcenter s) =
    r * r - Simplex.circumradius s * Simplex.circumradius s
hp : ¬p = ↑(↑(Simplex.orthogonalProjectionSpan s) p)
hz : inner (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) (p -ᵥ ↑(↑(orthogonalProjection span_s) p)) ≠ 0
hd₁ : r₁ = -r₂
⊢ r₁ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s =
    ↑(reflection (affineSpan ℝ (Set.range s.points)))
      (r₂ • (p -ᵥ ↑(↑(orthogonalProjection (affineSpan ℝ (Set.range s.points))) p)) +ᵥ Simplex.circumcenter s)
[PROOFSTEP]
rw [hd₁, reflection_vadd_smul_vsub_orthogonalProjection p r₂ s.circumcenter_mem_affineSpan, neg_smul]
