AFTD Auto-Formalizing Theoretical Domains

two_point_network_length_ge

theoremverified

If finitely many segments together with two points P, Q form a connected set, their total length is at least dist(P, Q).

Statement

theorem two_point_network_length_ge (P Q : EuclideanSpace ℝ (Fin 2))
    (T : Finset (EuclideanSpace ℝ (Fin 2) × EuclideanSpace ℝ (Fin 2)))
    (h : IsConnected (({P, Q} : Set (EuclideanSpace ℝ (Fin 2))) ∪ ⋃ t ∈ T, segment ℝ t.1 t.2)) :
    dist P Q ≤ ∑ t ∈ T, dist t.1 t.2
Source
Helper for cable_steiner_opt_two_points (sanity check of cable_steiner_opt).
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
Used by 1
  • cable_steiner_opt_two_pointsFor two one-point cables p and q (degenerate segments), the cable Steiner optimum is the Euclidean distance between p and q.

The proof, explained

The theorem is trivial when P = Q. When P ≠ Q, the proof projects the entire network onto the line spanned by v = Q - P using the continuous linear functional φ(x) = ⟨v, x⟩. Since the network is connected, its image in ℝ is an interval that contains [φ(P), φ(Q)], whose 1-dimensional Lebesgue measure is ‖v‖². By the Cauchy-Schwarz inequality, the projection of each segment in the network has length at most dist(t.1, t.2) * ‖v‖, so by subadditivity of measure, ‖v‖² ≤ (∑ dist(t.1, t.2)) * ‖v‖. Dividing both sides by ‖v‖ > 0 yields dist(P, Q) ≤ ∑ dist(t.1, t.2).

  1. The inequality holds trivially when P = Q.

    We split into cases: either P = Q or P ≠ Q. When P = Q, the distance dist(P, Q) is zero. Since the distance between any two points is non-negative, the finite sum of segment lengths is non-negative, so dist(P, P) ≤ ∑ t ∈ T, dist(t.1, t.2) holds immediately.

    lines 5–6

    uses eq_or_ne, Finset.sum_nonneg, dist_nonneg

      rcases eq_or_ne P Q with rfl | hPQ
      · simpa using Finset.sum_nonneg fun t _ => (dist_nonneg : 0 ≤ dist t.1 t.2)
  2. When P ≠ Q, the vector v = Q - P has strictly positive norm and induces a continuous linear projection φ onto ℝ.

    Because P ≠ Q, the displacement vector v = Q - P is non-zero, hence its norm ‖v‖ is strictly positive. We then define the linear functional φ(x) = ⟨v, x⟩ using the continuous linear map innerSL ℝ v.

    lines 7–9

    uses norm_pos_iff.mpr, sub_ne_zero.mpr

      set v := Q - P with hv
      have hvpos : 0 < ‖v‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hPQ.symm)
      let φ : EuclideanSpace ℝ (Fin 2) →L[ℝ] ℝ := innerSL ℝ v
  3. The closed interval [φ(P), φ(Q)] is contained in the projected network φ(X).

    Let X denote the network {P, Q} ∪ ⋃_{t ∈ T} [t.1, t.2]. Since X is connected and φ is continuous, the image φ(X) ⊆ ℝ is connected, hence an interval. Because P and Q belong to X, their images φ(P) and φ(Q) lie in φ(X), which implies that the entire closed interval [φ(P), φ(Q)] is a subset of φ(X).

    lines 10–14

    uses Icc_subset

      set X := (({P, Q} : Set (EuclideanSpace ℝ (Fin 2))) ∪ ⋃ t ∈ T, segment ℝ t.1 t.2) with hX
      have hφP : φ P ∈ φ '' X := ⟨P, by simp [hX], rfl⟩
      have hφQ : φ Q ∈ φ '' X := ⟨Q, by simp [hX], rfl⟩
      have hIcc : Set.Icc (φ P) (φ Q) ⊆ φ '' X :=
        (h.isPreconnected.image _ φ.continuous.continuousOn).Icc_subset hφP hφQ
  4. The image φ(X) is covered by the two points {φ(P), φ(Q)} together with the projected segments [φ(t.1), φ(t.2)] for t ∈ T.

    Any point x ∈ X belongs either to {P, Q} or to a segment [t.1, t.2] for some t ∈ T. Since the continuous linear map φ acts as an affine map, it maps the segment [t.1, t.2] to the segment [φ(t.1), φ(t.2)]. Therefore, φ(x) must lie in {φ(P), φ(Q)} ∪ ⋃_{t ∈ T} [φ(t.1), φ(t.2)].

    lines 15–27

    uses Set.mem_iUnion, image_segment, LinearMap.coe_toAffineMap, ContinuousLinearMap.coe_coe

      have himg : φ '' X ⊆ {φ P, φ Q} ∪ ⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2) := by
        rintro _ ⟨x, hx, rfl⟩
        rcases hx with hx | hx
        · rcases hx with rfl | rfl <;> simp
        · simp only [Set.mem_iUnion] at hx
          obtain ⟨t, ht, hxt⟩ := hx
          right
          simp only [Set.mem_iUnion]
          refine ⟨t, ht, ?_⟩
          have hs := image_segment ℝ ((φ : EuclideanSpace ℝ (Fin 2) →ₗ[ℝ] ℝ).toAffineMap) t.1 t.2
          simp only [LinearMap.coe_toAffineMap, ContinuousLinearMap.coe_coe] at hs
          rw [← hs]
          exact ⟨x, hxt, rfl⟩
  5. The length of the projected interval is φ(Q) - φ(P) = ‖v‖².

    By linearity of the inner product in its second argument, φ(Q) - φ(P) = ⟨v, Q⟩ - ⟨v, P⟩ = ⟨v, Q - P⟩ = ⟨v, v⟩. In a real inner product space, ⟨v, v⟩ equals ‖v‖².

    lines 28–29

    uses innerSL_apply_apply, inner_sub_right, real_inner_self_eq_norm_sq

      have hdiff : φ Q - φ P = ‖v‖ ^ 2 := by
        simp only [φ, innerSL_apply_apply, ← inner_sub_right, ← hv, real_inner_self_eq_norm_sq]
  6. The 1-dimensional Lebesgue measure of each projected segment [φ(t.1), φ(t.2)] is at most dist(t.1, t.2) * ‖v‖.

    The Lebesgue measure of the interval [φ(t.1), φ(t.2)] is |φ(t.2) - φ(t.1)| = |⟨v, t.2 - t.1⟩|. By the Cauchy-Schwarz inequality, this is bounded above by ‖v‖ * ‖t.2 - t.1‖ = dist(t.1, t.2) * ‖v‖.

    lines 30–38

    uses segment_eq_uIcc, Real.volume_interval, ENNReal.ofReal_le_ofReal, inner_sub_right, dist_comm, dist_eq_norm, mul_comm, abs_real_inner_le_norm

      have hseg : ∀ t ∈ T, MeasureTheory.volume (segment ℝ (φ t.1) (φ t.2)) ≤
          ENNReal.ofReal (dist t.1 t.2 * ‖v‖) := by
        intro t _
        rw [segment_eq_uIcc, Real.volume_interval]
        apply ENNReal.ofReal_le_ofReal
        have : φ t.2 - φ t.1 = inner ℝ v (t.2 - t.1) := by
          simp [φ, inner_sub_right]
        rw [this, dist_comm, dist_eq_norm, mul_comm]
        exact (abs_real_inner_le_norm v _).trans (by rw [mul_comm])
  7. The square norm ‖v‖² is bounded above by ∑_{t ∈ T} dist(t.1, t.2) * ‖v‖.

    The 1-dimensional volume of [φ(P), φ(Q)] is φ(Q) - φ(P) = ‖v‖². Since [φ(P), φ(Q)] is contained in {φ(P), φ(Q)} ∪ ⋃_{t ∈ T} [φ(t.1), φ(t.2)], monotonicity and subadditivity of Lebesgue measure bound this volume by the volume of {φ(P), φ(Q)} plus the sum of volumes of the projected segments. The two-point set has measure zero, and each segment volume is at most dist(t.1, t.2) * ‖v‖, yielding the bound.

    lines 39–51

    uses Real.volume_Icc, MeasureTheory.measure_mono, MeasureTheory.measure_union_le, Set.toFinite, measure_zero, zero_add, MeasureTheory.measure_biUnion_finset_le, Finset.sum_le_sum, ENNReal.ofReal_sum_of_nonneg

      have key : ENNReal.ofReal (‖v‖ ^ 2) ≤ ENNReal.ofReal (∑ t ∈ T, dist t.1 t.2 * ‖v‖) := by
        calc ENNReal.ofReal (‖v‖ ^ 2) = MeasureTheory.volume (Set.Icc (φ P) (φ Q)) := by
              rw [Real.volume_Icc, hdiff]
          _ ≤ MeasureTheory.volume ({φ P, φ Q} ∪ ⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2)) :=
              MeasureTheory.measure_mono (hIcc.trans himg)
          _ ≤ MeasureTheory.volume ({φ P, φ Q} : Set ℝ) + MeasureTheory.volume (⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2)) :=
              MeasureTheory.measure_union_le _ _
          _ = MeasureTheory.volume (⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2)) := by
              rw [(Set.toFinite _).measure_zero, zero_add]
          _ ≤ ∑ t ∈ T, MeasureTheory.volume (segment ℝ (φ t.1) (φ t.2)) := MeasureTheory.measure_biUnion_finset_le _ _
          _ ≤ ∑ t ∈ T, ENNReal.ofReal (dist t.1 t.2 * ‖v‖) := Finset.sum_le_sum hseg
          _ = ENNReal.ofReal (∑ t ∈ T, dist t.1 t.2 * ‖v‖) :=
              (ENNReal.ofReal_sum_of_nonneg fun t _ => by positivity).symm
  8. Dividing by ‖v‖ yields dist(P, Q) ≤ ∑_{t ∈ T} dist(t.1, t.2).

    Converting the inequality from ENNReal back to real numbers gives ‖v‖ * ‖v‖ ≤ (∑_{t ∈ T} dist(t.1, t.2)) * ‖v‖. Because ‖v‖ > 0, we can cancel ‖v‖ from both sides to conclude ‖v‖ ≤ ∑_{t ∈ T} dist(t.1, t.2). Since ‖v‖ = ‖Q - P‖ = dist(P, Q), this completes the proof.

    lines 52–55

    uses ENNReal.ofReal_le_ofReal_iff, Finset.sum_nonneg, Finset.sum_mul, le_of_mul_le_mul_right, dist_comm, dist_eq_norm

      rw [ENNReal.ofReal_le_ofReal_iff (Finset.sum_nonneg fun t _ => by positivity),
        ← Finset.sum_mul, sq] at key
      have h1 := le_of_mul_le_mul_right key hvpos
      rwa [dist_comm, dist_eq_norm]
eq_or_ne
Any two elements of a type are either equal or not equal.
Finset.sum_nonneg
A finite sum of non-negative terms is non-negative.
dist_nonneg
The distance between any two points in a metric space is non-negative.
norm_pos_iff.mpr
A non-zero vector in a normed space has strictly positive norm.
sub_ne_zero.mpr
If two elements are distinct, their difference is non-zero.
Icc_subset
In an ordered topological space, a connected set containing two points contains the closed interval between them.
Set.mem_iUnion
An element belongs to a union of sets if and only if it belongs to at least one set in the family.
image_segment
The image of a line segment under an affine map is the line segment between the images of the endpoints.
LinearMap.coe_toAffineMap
The function underlying an affine map induced by a linear map is the linear map itself.
ContinuousLinearMap.coe_coe
The function coercion of a continuous linear map coincides with that of its underlying linear map.
innerSL_apply_apply
Evaluating the continuous linear functional induced by inner product with v at w yields ⟨v, w⟩.
inner_sub_right
The inner product is additive in the second argument: ⟨x, y - z⟩ = ⟨x, y⟩ - ⟨x, z⟩.
real_inner_self_eq_norm_sq
The inner product of a real vector with itself equals the square of its norm: ⟨x, x⟩ = ‖x‖².
segment_eq_uIcc
In an ordered field, the line segment between two numbers is the unordered closed interval between them.
Real.volume_interval
The Lebesgue measure of the interval between a and b in ℝ is |b - a|.
ENNReal.ofReal_le_ofReal
The mapping from real numbers to extended non-negative reals preserves non-strict inequality: if p ≤ q, then ofReal(p) ≤ ofReal(q).
dist_comm
The distance function is symmetric: dist(x, y) = dist(y, x).
dist_eq_norm
In a normed space, the distance between two points is the norm of their difference: dist(a, b) = ‖a - b‖.
mul_comm
Multiplication is commutative: a * b = b * a.
abs_real_inner_le_norm
The Cauchy-Schwarz inequality for real inner products: |⟨x, y⟩| ≤ ‖x‖ * ‖y‖.
Real.volume_Icc
The Lebesgue measure of the closed interval [a, b] in ℝ is b - a.
MeasureTheory.measure_mono
Measure is monotonic: if s ⊆ t, then μ(s) ≤ μ(t).
MeasureTheory.measure_union_le
A measure is subadditive on unions: μ(s ∪ t) ≤ μ(s) + μ(t).
Set.toFinite
A set whose underlying subtype is finite is a finite set.
measure_zero
Any finite set in a space where singletons have measure zero has measure zero.
zero_add
Zero is the left identity for addition: 0 + a = a.
MeasureTheory.measure_biUnion_finset_le
A measure is subadditive over finite unions: μ(⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ(s i).
Finset.sum_le_sum
If f(i) ≤ g(i) for all elements i of a finite set, then ∑ f(i) ≤ ∑ g(i).
ENNReal.ofReal_sum_of_nonneg
For non-negative real numbers, conversion to extended non-negative reals commutes with finite summation.
ENNReal.ofReal_le_ofReal_iff
For q ≥ 0, ofReal(p) ≤ ofReal(q) if and only if p ≤ q.
Finset.sum_mul
Multiplication distributes over finite sums from the right: (∑ f(i)) * a = ∑ (f(i) * a).
le_of_mul_le_mul_right
In an ordered structure, if b * a ≤ c * a and a > 0, then b ≤ c.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem two_point_network_length_ge (P Q : EuclideanSpace ℝ (Fin 2))    (T : Finset (EuclideanSpace ℝ (Fin 2) × EuclideanSpace ℝ (Fin 2)))    (h : IsConnected (({P, Q} : Set (EuclideanSpace ℝ (Fin 2))) ∪ ⋃ t ∈ T, segment ℝ t.1 t.2)) :    dist P Q ≤ ∑ t ∈ T, dist t.1 t.2 := by  rcases eq_or_ne P Q with rfl | hPQ  · simpa using Finset.sum_nonneg fun t _ => (dist_nonneg : 0 ≤ dist t.1 t.2)  set v := Q - P with hv  have hvpos : 0 < ‖v‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hPQ.symm)  let φ : EuclideanSpace ℝ (Fin 2) →L[ℝ] ℝ := innerSL ℝ v  set X := (({P, Q} : Set (EuclideanSpace ℝ (Fin 2))) ∪ ⋃ t ∈ T, segment ℝ t.1 t.2) with hX  have hφP : φ P ∈ φ '' X := ⟨P, by simp [hX], rfl⟩  have hφQ : φ Q ∈ φ '' X := ⟨Q, by simp [hX], rfl⟩  have hIcc : Set.Icc (φ P) (φ Q) ⊆ φ '' X :=    (h.isPreconnected.image _ φ.continuous.continuousOn).Icc_subset hφP hφQ  have himg : φ '' X ⊆ {φ P, φ Q} ∪ ⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2) := by    rintro _ ⟨x, hx, rfl⟩    rcases hx with hx | hx    · rcases hx with rfl | rfl <;> simp    · simp only [Set.mem_iUnion] at hx      obtain ⟨t, ht, hxt⟩ := hx      right      simp only [Set.mem_iUnion]      refine ⟨t, ht, ?_⟩      have hs := image_segment ℝ ((φ : EuclideanSpace ℝ (Fin 2) →ₗ[ℝ] ℝ).toAffineMap) t.1 t.2      simp only [LinearMap.coe_toAffineMap, ContinuousLinearMap.coe_coe] at hs      rw [← hs]      exact ⟨x, hxt, rfl⟩  have hdiff : φ Q - φ P = ‖v‖ ^ 2 := by    simp only [φ, innerSL_apply_apply, ← inner_sub_right, ← hv, real_inner_self_eq_norm_sq]  have hseg : ∀ t ∈ T, MeasureTheory.volume (segment ℝ (φ t.1) (φ t.2)) ≤      ENNReal.ofReal (dist t.1 t.2 * ‖v‖) := by    intro t _    rw [segment_eq_uIcc, Real.volume_interval]    apply ENNReal.ofReal_le_ofReal    have : φ t.2 - φ t.1 = inner ℝ v (t.2 - t.1) := by      simp [φ, inner_sub_right]    rw [this, dist_comm, dist_eq_norm, mul_comm]    exact (abs_real_inner_le_norm v _).trans (by rw [mul_comm])  have key : ENNReal.ofReal (‖v‖ ^ 2) ≤ ENNReal.ofReal (∑ t ∈ T, dist t.1 t.2 * ‖v‖) := by    calc ENNReal.ofReal (‖v‖ ^ 2) = MeasureTheory.volume (Set.Icc (φ P) (φ Q)) := by          rw [Real.volume_Icc, hdiff]      _ ≤ MeasureTheory.volume ({φ P, φ Q} ∪ ⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2)) :=          MeasureTheory.measure_mono (hIcc.trans himg)      _ ≤ MeasureTheory.volume ({φ P, φ Q} : Set ℝ) + MeasureTheory.volume (⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2)) :=          MeasureTheory.measure_union_le _ _      _ = MeasureTheory.volume (⋃ t ∈ T, segment ℝ (φ t.1) (φ t.2)) := by          rw [(Set.toFinite _).measure_zero, zero_add]      _ ≤ ∑ t ∈ T, MeasureTheory.volume (segment ℝ (φ t.1) (φ t.2)) := MeasureTheory.measure_biUnion_finset_le _ _      _ ≤ ∑ t ∈ T, ENNReal.ofReal (dist t.1 t.2 * ‖v‖) := Finset.sum_le_sum hseg      _ = ENNReal.ofReal (∑ t ∈ T, dist t.1 t.2 * ‖v‖) :=          (ENNReal.ofReal_sum_of_nonneg fun t _ => by positivity).symm  rw [ENNReal.ofReal_le_ofReal_iff (Finset.sum_nonneg fun t _ => by positivity),    ← Finset.sum_mul, sq] at key  have h1 := le_of_mul_le_mul_right key hvpos  rwa [dist_comm, dist_eq_norm]
See it in the graphDiscuss this resultChallenge it