ose_spherical_small_scale_aux
For two spherical metric layers satisfying the displayed scalar inequalities and the two-scale norm identity, if the first-layer metric is the original inner-product metric, the cross-layer squared distances are r² plus its square, and the second-layer distances are s times its square, then both layers admit a noncontracting Hilbert-product embedding with Lipschitz constant q.
Statement
theorem ose_spherical_small_scale_aux (A H : Type) [NormedAddCommGroup H] [InnerProductSpace ℝ H] (u : A → H) (c : H) (q r s β : ℝ) (hq : 1 ≤ q) (hr : 0 ≤ r) (hs : 0 < s) (hsmall : s*q ≤ 1) (hβ1 : 1 ≤ β) (hβq : β ≤ q) (hprod : (s*q)*β ≤ 1) (hdiff : (β-s*q)^2 ≤ 4*r^2) (hparam : r^2 + q^2 * (1 - (s*q)*β) ≤ q^2 * r^2) (hu : ∀ a, ‖u a-c‖^2 = q^2/4) (hsep : ∀ a b, a ≠ b → 1 ≤ dist (u a) (u b)) (hidentity : ∀ (x y : H), ‖x‖^2=q^2/4 → ‖y‖^2=q^2/4 → ‖β • x - (s*q) • y‖^2 = (β-s*q)^2*q^2/4 + (s*q)*β*‖x-y‖^2) (M : MetricSpace (Bool × A)) : letI := M (∀ a b, dist (false,a) (false,b) = dist (u a) (u b)) → (∀ a b, dist (false,a) (true,b)^2 = r^2 + dist (u a) (u b)^2) → (∀ a b, dist (true,a) (true,b) = s * dist (u a) (u b)^2) → ∃ F : Bool × A → WithLp 2 (H × ℝ), ∀ x y, dist x y ≤ dist (F x) (F y) ∧ dist (F x) (F y) ≤ q * dist x y
- Source
- arXiv:2611.08546, Section 6.1; small-scale spherical two-layer construction
- Verified
- 15 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- ose_spherical_two_layer_hilbert_distortion_upperLet a family of points in a complete real inner-product space lie on a sphere of radius q/2, with q positive and q² at least two, and have…
The proof, explained
The proof constructs an explicit embedding $F$ of the two-layer metric space $\operatorname{Bool} \times A$ into the Hilbert product $H \times \mathbb{R}$ with the $\ell_2$ norm. Points $(\text{false}, a)$ in layer 0 are mapped to $\beta(u(a) - c) \in H$ at vertical height $0$, while points $(\text{true}, a)$ in layer 1 are mapped to $\alpha(u(a) - c)$ with $\alpha = sq$ at vertical height $\sqrt{z}$, where $z = \max(0, r^2 + q^2(1 - \alpha\beta) - C)$ and $C = (\beta - \alpha)^2 q^2 / 4$. The two-scale norm identity and the parameter bounds ensure that for every pair of points, the embedded distance is at least the original distance and at most $q$ times the original distance across all four layer combinations.
Parameters $\alpha$, $C$, and $z$ are well-defined and nonnegative, with $C \le q^2 r^2$.
Introduce the metric assumptions $hf$, $hc$, and $ht$. Define $\alpha = s \cdot q$, $C = (\beta - \alpha)^2 q^2 / 4$, and $z = \max(0, r^2 + q^2(1 - \alpha\beta) - C)$. Linear arithmetic and positivity show $q \ge 0$, $\beta \ge 0$, $\alpha \ge 0$, $z \ge 0$, and $C \ge 0$. Multiplying the assumed bound $(\beta - sq)^2 \le 4r^2$ by $q^2 \ge 0$ proves $C \le q^2 r^2$ via non-linear arithmetic.
uses
le_max_left,mul_nonneg,sq_nonneg,sub_nonneg.mprintro hf hc ht let α := s*q let C := (β-α)^2*q^2/4 let z := max 0 (r^2+q^2*(1-α*β)-C) have hq0 : 0 ≤ q := by linarith have hβ0 : 0 ≤ β := by linarith have hα0 : 0 ≤ α := by dsimp [α]; positivity have hz0 : 0 ≤ z := le_max_left _ _ have hC0 : 0 ≤ C := by dsimp [C]; positivity have hCla : C ≤ q^2*r^2 := by have hmul := mul_nonneg (sq_nonneg q) (sub_nonneg.mpr hdiff) dsimp [C,α] at * nlinarith
The combined offset $C + z$ is bounded below by $r^2 + q^2(1 - \alpha\beta)$ and above by $q^2 r^2$.
Because $z$ is the maximum of $0$ and $r^2 + q^2(1 - \alpha\beta) - C$, $z$ is at least this difference (`le_max_right`), which directly gives $r^2 + q^2(1 - \alpha\beta) \le C + z$. For the upper bound, $z \le q^2 r^2 - C$ follows from `max_le` because both $0 \le q^2 r^2 - C$ (from $C \le q^2 r^2$) and $r^2 + q^2(1 - \alpha\beta) - C \le q^2 r^2 - C$ (by the hypothesis $hparam$). Adding $C$ gives $C + z \le q^2 r^2$.
uses
le_max_right,max_lehave hbaseLo : r^2+q^2*(1-α*β) ≤ C+z := by have hz := le_max_right (0 : ℝ) (r^2+q^2*(1-α*β)-C) dsimp [z]; linarith have hbaseHi : C+z ≤ q^2*r^2 := by have hz : z ≤ q^2*r^2-C := by dsimp [z] apply max_le · linarith · dsimp [α] at * linarith linarith
Every base point $u(a)$ lies at distance $q/2$ from $c$, and the pairwise diameter of $u(A)$ is at most $q$.
Since $\|u(a) - c\|^2 = q^2/4$ and norms are nonnegative, $\|u(a) - c\| = q/2$. By the triangle inequality through the center $c$, $\operatorname{dist}(u(a), u(b)) \le \operatorname{dist}(u(a), c) + \operatorname{dist}(c, u(b)) = q/2 + q/2 = q$.
uses
norm_nonneg,dist_triangle,dist_eq_norm,dist_commhave hnorm (a : A) : ‖u a-c‖ = q/2 := by have h := hu a have hn : 0 ≤ ‖u a-c‖ := norm_nonneg _ nlinarith have hdiam (a b : A) : dist (u a) (u b) ≤ q := by have htri := dist_triangle (u a) c (u b) have h1 : dist (u a) c = q/2 := by rw [dist_eq_norm, hnorm] have h2 : dist c (u b) = q/2 := by rw [dist_comm, dist_eq_norm, hnorm] linarith
The embedding $F$ is defined, and the cross-layer squared embedded distance between $(\text{false}, a)$ and $(\text{true}, b)$ equals $C + z + \alpha\beta \operatorname{dist}(u(a), u(b))^2$.
Define layer-dependent scaling factors $T(\text{false}) = \beta$, $T(\text{true}) = \alpha$ and vertical offsets $Z(\text{false}) = 0$, $Z(\text{true}) = \sqrt{z}$. Define the embedding $F(b, a) = (T(b)(u(a) - c), Z(b)) \in H \times \mathbb{R}$. In the $\ell_2$ product, squared distances decompose into the squared norm in $H$ plus the squared difference in vertical coordinate. For cross-layer pairs, the vertical squared difference is $(\sqrt{z})^2 = z$, and the $H$-norm squared expands via the two-scale norm identity `hidentity`, simplifying algebraically to $C + z + \alpha\beta \operatorname{dist}(u(a), u(b))^2$.
uses
dist_eq_norm,WithLp.prod_norm_sq_eq_of_L2,WithLp.sub_fst,WithLp.sub_snd,Real.norm_eq_abs,sq_abs,Bool.false_eq_true,zero_sub,neg_sq,Real.sq_sqrt,sub_sub_sub_cancel_rightlet T : Bool → ℝ := fun b => if b then α else β let Z : Bool → ℝ := fun b => if b then Real.sqrt z else 0 let F : Bool × A → WithLp 2 (H × ℝ) := fun p => WithLp.toLp 2 (T p.1 • (u p.2-c), Z p.1) have hFsq (b1 b2 : Bool) (a1 a2 : A) : dist (F (b1,a1)) (F (b2,a2))^2 = ‖T b1 • (u a1-c) - T b2 • (u a2-c)‖^2 + (Z b1-Z b2)^2 := by rw [dist_eq_norm, WithLp.prod_norm_sq_eq_of_L2] simp [F, WithLp.sub_fst, WithLp.sub_snd, Real.norm_eq_abs, sq_abs] have hcrossout (a b : A) : dist (F (false,a)) (F (true,b))^2 = C+z+(α*β)*dist (u a) (u b)^2 := by rw [hFsq] simp only [T, Z, Bool.false_eq_true, ↓reduceIte, zero_sub, neg_sq, Real.sq_sqrt hz0] rw [hidentity (u a-c) (u b-c) (hu a) (hu b)] have hsub : ‖(u a-c)-(u b-c)‖ = dist (u a) (u b) := by rw [sub_sub_sub_cancel_right, ← dist_eq_norm] rw [hsub] dsimp [C,α] ring
The non-contraction and Lipschitz bounds hold for pairs within layer 0 (`false`, `false`).
Provide $F$ as the witness and case split on the boolean flags $(b_1, b_2)$. When both flags are `false`, both points have vertical coordinate $0$ and vector scaling factor $\beta$, so the embedded distance is $\beta \operatorname{dist}(u(a), u(b))$. Because the original layer-0 distance is $\operatorname{dist}(u(a), u(b))$ and $1 \le \beta \le q$, multiplying by $\beta$ directly satisfies non-contraction and the $q$-Lipschitz bound.
uses
Bool.false_eq_true,sub_self,zero_pow,add_zero,smul_sub,norm_smul,Real.norm_eq_abs,abs_of_nonneg,mul_pow,sub_sub_sub_cancel_right,dist_eq_norm,dist_nonneg,mul_nonneg,le_mul_of_one_le_left,mul_le_mul_of_nonneg_rightrefine ⟨F, ?_⟩ intro ⟨b1,a⟩ ⟨b2,b⟩ cases b1 <;> cases b2 · have he := hFsq false false a b simp only [T,Z,Bool.false_eq_true,↓reduceIte,sub_self,zero_pow,add_zero] at he rw [← smul_sub, norm_smul, Real.norm_eq_abs, abs_of_nonneg hβ0, mul_pow] at he have hd : ‖(u a-c)-(u b-c)‖ = dist (u a) (u b) := by rw [sub_sub_sub_cancel_right, ← dist_eq_norm] rw [hd] at he have hx := hf a b have hfa : 0 ≤ dist (F (false,a)) (F (false,b)) := dist_nonneg have hda : 0 ≤ dist (u a) (u b) := dist_nonneg have hβδ : 0 ≤ β * dist (u a) (u b) := mul_nonneg hβ0 hda have heq : dist (F (false,a)) (F (false,b)) = β * dist (u a) (u b) := by nlinarith rw [hx,heq] exact ⟨le_mul_of_one_le_left hda hβ1, mul_le_mul_of_nonneg_right hβq hda⟩
The non-contraction and Lipschitz bounds hold for cross-layer pairs with $b_1 = \text{false}$ and $b_2 = \text{true}$.
The original squared distance is $r^2 + \delta^2$ where $\delta = \operatorname{dist}(u(a), u(b))$, and the embedded squared distance is $C + z + \alpha\beta \delta^2$. The lower bound $C + z \ge r^2 + q^2(1 - \alpha\beta)$ together with $\delta \le q$ yields $C + z + \alpha\beta \delta^2 \ge r^2 + \delta^2 + (1 - \alpha\beta)(q^2 - \delta^2) \ge r^2 + \delta^2$. The upper bound $C + z \le q^2 r^2$ and $\alpha\beta \le 1 \le q^2$ yields $C + z + \alpha\beta \delta^2 \le q^2(r^2 + \delta^2)$. Taking square roots on both inequalities gives non-contraction and the $q$-Lipschitz condition.
uses
dist_nonneg,mul_nonneg,sq_nonneg,congrArg,pow_le_pow_iff_left₀· have he := hcrossout a b have hx := hc a b have hδ0 : 0 ≤ dist (u a) (u b) := dist_nonneg have hδq := hdiam a b have hk0 : 0 ≤ α*β := mul_nonneg hα0 hβ0 have hk1 : α*β ≤ 1 := hprod have h1 := mul_nonneg (show 0 ≤ 1-α*β by linarith) (show 0 ≤ q^2-dist (u a) (u b)^2 by nlinarith) have h2 := mul_nonneg (show 0 ≤ q^2-α*β by nlinarith) (sq_nonneg (dist (u a) (u b))) have hlow : dist (false,a) (true,b)^2 ≤ dist (F (false,a)) (F (true,b))^2 := by nlinarith [hbaseLo,h1] have hxq := congrArg (fun t : ℝ => q^2 * t) hx have hhigh : dist (F (false,a)) (F (true,b))^2 ≤ (q*dist (false,a) (true,b))^2 := by nlinarith [hbaseHi,h2,hxq] constructor · exact (pow_le_pow_iff_left₀ dist_nonneg dist_nonneg (by norm_num : 2 ≠ 0)).1 hlow · exact (pow_le_pow_iff_left₀ dist_nonneg (mul_nonneg hq0 dist_nonneg) (by norm_num : 2 ≠ 0)).1 hhigh
The non-contraction and Lipschitz bounds hold for cross-layer pairs with $b_1 = \text{true}$ and $b_2 = \text{false}$.
By symmetry of distance (`dist_comm`), the distance between $(\text{true}, a)$ and $(\text{false}, b)$ equals the distance between $(\text{false}, b)$ and $(\text{true}, a)$. Applying the exact same cross-layer algebraic bounds with $a$ and $b$ exchanged establishes both required inequalities.
uses
dist_comm,dist_nonneg,mul_nonneg,sq_nonneg,congrArg,pow_le_pow_iff_left₀· rw [dist_comm (true,a) (false,b), dist_comm (F (true,a)) (F (false,b))] have he := hcrossout b a have hx := hc b a have hδ0 : 0 ≤ dist (u b) (u a) := dist_nonneg have hδq := hdiam b a have hk0 : 0 ≤ α*β := mul_nonneg hα0 hβ0 have hk1 : α*β ≤ 1 := hprod have h1 := mul_nonneg (show 0 ≤ 1-α*β by linarith) (show 0 ≤ q^2-dist (u b) (u a)^2 by nlinarith) have h2 := mul_nonneg (show 0 ≤ q^2-α*β by nlinarith) (sq_nonneg (dist (u b) (u a))) have hlow : dist (false,b) (true,a)^2 ≤ dist (F (false,b)) (F (true,a))^2 := by nlinarith [hbaseLo,h1] have hxq := congrArg (fun t : ℝ => q^2 * t) hx have hhigh : dist (F (false,b)) (F (true,a))^2 ≤ (q*dist (false,b) (true,a))^2 := by nlinarith [hbaseHi,h2,hxq] constructor · exact (pow_le_pow_iff_left₀ dist_nonneg dist_nonneg (by norm_num : 2 ≠ 0)).1 hlow · exact (pow_le_pow_iff_left₀ dist_nonneg (mul_nonneg hq0 dist_nonneg) (by norm_num : 2 ≠ 0)).1 hhigh
The non-contraction and Lipschitz bounds hold for pairs within layer 1 (`true`, `true`), completing the proof.
When both flags are `true`, both points share the same vertical offset $\sqrt{z}$ (so their vertical difference vanishes) and are scaled by $\alpha = sq$, yielding embedded distance $sq \cdot \delta$ where $\delta = \operatorname{dist}(u(a), u(b))$. The original distance is $s\delta^2$. If $a = b$, both distances are zero. If $a \neq b$, separation implies $1 \le \delta \le q$. Then $s\delta^2 \le sq\delta$ because $\delta \le q$ (non-contraction), and $sq\delta \le q(s\delta^2)$ because $1 \le \delta$ (Lipschitz condition).
uses
sub_self,zero_pow,add_zero,smul_sub,norm_smul,Real.norm_eq_abs,abs_of_nonneg,mul_pow,sub_sub_sub_cancel_right,dist_eq_norm,mul_nonneg,dist_nonneg,le_trans,sub_nonneg.mpr· have he := hFsq true true a b simp only [T,Z,↓reduceIte,sub_self,zero_pow,add_zero] at he rw [← smul_sub, norm_smul, Real.norm_eq_abs, abs_of_nonneg hα0, mul_pow] at he have hd : ‖(u a-c)-(u b-c)‖ = dist (u a) (u b) := by rw [sub_sub_sub_cancel_right, ← dist_eq_norm] rw [hd] at he have hαδ : 0 ≤ α * dist (u a) (u b) := mul_nonneg hα0 dist_nonneg have heq : dist (F (true,a)) (F (true,b)) = α * dist (u a) (u b) := by nlinarith [dist_nonneg (x := F (true,a)) (y := F (true,b)), dist_nonneg (x := u a) (y := u b)] rw [heq, ht a b] by_cases hab : a=b · subst b; simp · have hδ := hsep a b hab have hδq := hdiam a b have hδ0 : 0 ≤ dist (u a) (u b) := le_trans (by norm_num) hδ have hmul1 := mul_nonneg hs.le (mul_nonneg hδ0 (sub_nonneg.mpr hδq)) have hmul2 := mul_nonneg hs.le (mul_nonneg (mul_nonneg hq0 hδ0) (by linarith : 0 ≤ dist (u a) (u b)-1)) dsimp [α] constructor · nlinarith only [hmul1] · nlinarith only [hmul2]
le_max_left- An element is less than or equal to the maximum of itself and another element ($a \le \max(a, b)$).
mul_nonneg- The product of two nonnegative numbers is nonnegative.
sq_nonneg- The square of any real number is nonnegative.
sub_nonneg.mpr- If $b \le a$, then $a - b \ge 0$.
le_max_right- An element is less than or equal to the maximum of another element and itself ($b \le \max(a, b)$).
max_le- If both $a \le c$ and $b \le c$, then $\max(a, b) \le c$.
norm_nonneg- The norm of any vector in a seminormed group is nonnegative.
dist_triangle- The triangle inequality in a pseudo-metric space: $\operatorname{dist}(x, z) \le \operatorname{dist}(x, y) + \operatorname{dist}(y, z)$.
dist_eq_norm- In a seminormed space, the distance between two points equals the norm of their difference.
dist_comm- Distance is symmetric: $\operatorname{dist}(x, y) = \operatorname{dist}(y, x)$.
WithLp.prod_norm_sq_eq_of_L2- In the $\ell_2$ direct product of two normed spaces, the squared norm of a pair is the sum of the squared norms of its components.
WithLp.sub_fst- The first component of a difference in an $\ell_p$ product space is the difference of the first components.
WithLp.sub_snd- The second component of a difference in an $\ell_p$ product space is the difference of the second components.
Real.norm_eq_abs- For real numbers, the norm equals the absolute value.
sq_abs- The square of the absolute value of a number equals its square ($|a|^2 = a^2$).
Bool.false_eq_true- The boolean values `false` and `true` are distinct.
zero_sub- Subtracting a number from zero gives its negation ($0 - a = -a$).
neg_sq- The square of the negation of a number equals its square ($(-a)^2 = a^2$).
Real.sq_sqrt- For any nonnegative real number $x$, the square of its square root equals $x$ ($(\sqrt{x})^2 = x$).
sub_sub_sub_cancel_right- Common offset cancellation in subtraction: $(a - c) - (b - c) = a - b$.
sub_self- Subtracting an element from itself yields zero ($a - a = 0$).
zero_pow- Zero raised to any positive integer power equals zero.
smul_sub- Scalar multiplication distributes over vector subtraction ($r \cdot (x - y) = r \cdot x - r \cdot y$).
dist_nonneg- The distance between two points in a metric space is nonnegative.
le_mul_of_one_le_left- If $b \ge 0$ and $a \ge 1$, then $b \le a \cdot b$.
mul_le_mul_of_nonneg_right- Multiplying both sides of an inequality by a nonnegative number preserves the inequality.
congrArg- Applying a function to equal inputs yields equal outputs.
pow_le_pow_iff_left₀- For nonnegative numbers and a positive exponent $n$, $a^n \le b^n$ if and only if $a \le b$.
add_zero- Adding zero to any element leaves it unchanged ($a + 0 = a$).
norm_smul- The norm of a scalar multiple is the absolute value of the scalar times the norm of the vector ($\|r \cdot x\| = |r| \cdot \|x\|$).
abs_of_nonneg- The absolute value of a nonnegative real number equals the number itself.
mul_pow- The power of a product is the product of the powers ($(a \cdot b)^n = a^n \cdot b^n$).
le_trans- Transitivity of inequality: if $a \le b$ and $b \le c$, then $a \le c$.
- Several steps rely on non-linear arithmetic automation (`nlinarith`) to verify quadratic polynomial inequalities on the distances and parameters from the established bounds.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem ose_spherical_small_scale_aux (A H : Type) [NormedAddCommGroup H] [InnerProductSpace ℝ H] (u : A → H) (c : H) (q r s β : ℝ) (hq : 1 ≤ q) (hr : 0 ≤ r) (hs : 0 < s) (hsmall : s*q ≤ 1) (hβ1 : 1 ≤ β) (hβq : β ≤ q) (hprod : (s*q)*β ≤ 1) (hdiff : (β-s*q)^2 ≤ 4*r^2) (hparam : r^2 + q^2 * (1 - (s*q)*β) ≤ q^2 * r^2) (hu : ∀ a, ‖u a-c‖^2 = q^2/4) (hsep : ∀ a b, a ≠ b → 1 ≤ dist (u a) (u b)) (hidentity : ∀ (x y : H), ‖x‖^2=q^2/4 → ‖y‖^2=q^2/4 → ‖β • x - (s*q) • y‖^2 = (β-s*q)^2*q^2/4 + (s*q)*β*‖x-y‖^2) (M : MetricSpace (Bool × A)) : letI := M (∀ a b, dist (false,a) (false,b) = dist (u a) (u b)) → (∀ a b, dist (false,a) (true,b)^2 = r^2 + dist (u a) (u b)^2) → (∀ a b, dist (true,a) (true,b) = s * dist (u a) (u b)^2) → ∃ F : Bool × A → WithLp 2 (H × ℝ), ∀ x y, dist x y ≤ dist (F x) (F y) ∧ dist (F x) (F y) ≤ q * dist x y := by intro hf hc ht let α := s*q let C := (β-α)^2*q^2/4 let z := max 0 (r^2+q^2*(1-α*β)-C) have hq0 : 0 ≤ q := by linarith have hβ0 : 0 ≤ β := by linarith have hα0 : 0 ≤ α := by dsimp [α]; positivity have hz0 : 0 ≤ z := le_max_left _ _ have hC0 : 0 ≤ C := by dsimp [C]; positivity have hCla : C ≤ q^2*r^2 := by have hmul := mul_nonneg (sq_nonneg q) (sub_nonneg.mpr hdiff) dsimp [C,α] at * nlinarith have hbaseLo : r^2+q^2*(1-α*β) ≤ C+z := by have hz := le_max_right (0 : ℝ) (r^2+q^2*(1-α*β)-C) dsimp [z]; linarith have hbaseHi : C+z ≤ q^2*r^2 := by have hz : z ≤ q^2*r^2-C := by dsimp [z] apply max_le · linarith · dsimp [α] at * linarith linarith have hnorm (a : A) : ‖u a-c‖ = q/2 := by have h := hu a have hn : 0 ≤ ‖u a-c‖ := norm_nonneg _ nlinarith have hdiam (a b : A) : dist (u a) (u b) ≤ q := by have htri := dist_triangle (u a) c (u b) have h1 : dist (u a) c = q/2 := by rw [dist_eq_norm, hnorm] have h2 : dist c (u b) = q/2 := by rw [dist_comm, dist_eq_norm, hnorm] linarith let T : Bool → ℝ := fun b => if b then α else β let Z : Bool → ℝ := fun b => if b then Real.sqrt z else 0 let F : Bool × A → WithLp 2 (H × ℝ) := fun p => WithLp.toLp 2 (T p.1 • (u p.2-c), Z p.1) have hFsq (b1 b2 : Bool) (a1 a2 : A) : dist (F (b1,a1)) (F (b2,a2))^2 = ‖T b1 • (u a1-c) - T b2 • (u a2-c)‖^2 + (Z b1-Z b2)^2 := by rw [dist_eq_norm, WithLp.prod_norm_sq_eq_of_L2] simp [F, WithLp.sub_fst, WithLp.sub_snd, Real.norm_eq_abs, sq_abs] have hcrossout (a b : A) : dist (F (false,a)) (F (true,b))^2 = C+z+(α*β)*dist (u a) (u b)^2 := by rw [hFsq] simp only [T, Z, Bool.false_eq_true, ↓reduceIte, zero_sub, neg_sq, Real.sq_sqrt hz0] rw [hidentity (u a-c) (u b-c) (hu a) (hu b)] have hsub : ‖(u a-c)-(u b-c)‖ = dist (u a) (u b) := by rw [sub_sub_sub_cancel_right, ← dist_eq_norm] rw [hsub] dsimp [C,α] ring refine ⟨F, ?_⟩ intro ⟨b1,a⟩ ⟨b2,b⟩ cases b1 <;> cases b2 · have he := hFsq false false a b simp only [T,Z,Bool.false_eq_true,↓reduceIte,sub_self,zero_pow,add_zero] at he rw [← smul_sub, norm_smul, Real.norm_eq_abs, abs_of_nonneg hβ0, mul_pow] at he have hd : ‖(u a-c)-(u b-c)‖ = dist (u a) (u b) := by rw [sub_sub_sub_cancel_right, ← dist_eq_norm] rw [hd] at he have hx := hf a b have hfa : 0 ≤ dist (F (false,a)) (F (false,b)) := dist_nonneg have hda : 0 ≤ dist (u a) (u b) := dist_nonneg have hβδ : 0 ≤ β * dist (u a) (u b) := mul_nonneg hβ0 hda have heq : dist (F (false,a)) (F (false,b)) = β * dist (u a) (u b) := by nlinarith rw [hx,heq] exact ⟨le_mul_of_one_le_left hda hβ1, mul_le_mul_of_nonneg_right hβq hda⟩ · have he := hcrossout a b have hx := hc a b have hδ0 : 0 ≤ dist (u a) (u b) := dist_nonneg have hδq := hdiam a b have hk0 : 0 ≤ α*β := mul_nonneg hα0 hβ0 have hk1 : α*β ≤ 1 := hprod have h1 := mul_nonneg (show 0 ≤ 1-α*β by linarith) (show 0 ≤ q^2-dist (u a) (u b)^2 by nlinarith) have h2 := mul_nonneg (show 0 ≤ q^2-α*β by nlinarith) (sq_nonneg (dist (u a) (u b))) have hlow : dist (false,a) (true,b)^2 ≤ dist (F (false,a)) (F (true,b))^2 := by nlinarith [hbaseLo,h1] have hxq := congrArg (fun t : ℝ => q^2 * t) hx have hhigh : dist (F (false,a)) (F (true,b))^2 ≤ (q*dist (false,a) (true,b))^2 := by nlinarith [hbaseHi,h2,hxq] constructor · exact (pow_le_pow_iff_left₀ dist_nonneg dist_nonneg (by norm_num : 2 ≠ 0)).1 hlow · exact (pow_le_pow_iff_left₀ dist_nonneg (mul_nonneg hq0 dist_nonneg) (by norm_num : 2 ≠ 0)).1 hhigh · rw [dist_comm (true,a) (false,b), dist_comm (F (true,a)) (F (false,b))] have he := hcrossout b a have hx := hc b a have hδ0 : 0 ≤ dist (u b) (u a) := dist_nonneg have hδq := hdiam b a have hk0 : 0 ≤ α*β := mul_nonneg hα0 hβ0 have hk1 : α*β ≤ 1 := hprod have h1 := mul_nonneg (show 0 ≤ 1-α*β by linarith) (show 0 ≤ q^2-dist (u b) (u a)^2 by nlinarith) have h2 := mul_nonneg (show 0 ≤ q^2-α*β by nlinarith) (sq_nonneg (dist (u b) (u a))) have hlow : dist (false,b) (true,a)^2 ≤ dist (F (false,b)) (F (true,a))^2 := by nlinarith [hbaseLo,h1] have hxq := congrArg (fun t : ℝ => q^2 * t) hx have hhigh : dist (F (false,b)) (F (true,a))^2 ≤ (q*dist (false,b) (true,a))^2 := by nlinarith [hbaseHi,h2,hxq] constructor · exact (pow_le_pow_iff_left₀ dist_nonneg dist_nonneg (by norm_num : 2 ≠ 0)).1 hlow · exact (pow_le_pow_iff_left₀ dist_nonneg (mul_nonneg hq0 dist_nonneg) (by norm_num : 2 ≠ 0)).1 hhigh · have he := hFsq true true a b simp only [T,Z,↓reduceIte,sub_self,zero_pow,add_zero] at he rw [← smul_sub, norm_smul, Real.norm_eq_abs, abs_of_nonneg hα0, mul_pow] at he have hd : ‖(u a-c)-(u b-c)‖ = dist (u a) (u b) := by rw [sub_sub_sub_cancel_right, ← dist_eq_norm] rw [hd] at he have hαδ : 0 ≤ α * dist (u a) (u b) := mul_nonneg hα0 dist_nonneg have heq : dist (F (true,a)) (F (true,b)) = α * dist (u a) (u b) := by nlinarith [dist_nonneg (x := F (true,a)) (y := F (true,b)), dist_nonneg (x := u a) (y := u b)] rw [heq, ht a b] by_cases hab : a=b · subst b; simp · have hδ := hsep a b hab have hδq := hdiam a b have hδ0 : 0 ≤ dist (u a) (u b) := le_trans (by norm_num) hδ have hmul1 := mul_nonneg hs.le (mul_nonneg hδ0 (sub_nonneg.mpr hδq)) have hmul2 := mul_nonneg hs.le (mul_nonneg (mul_nonneg hq0 hδ0) (by linarith : 0 ≤ dist (u a) (u b)-1)) dsimp [α] constructor · nlinarith only [hmul1] · nlinarith only [hmul2]