Goal and scope
In the Euclidean plane represented by ℝ², let P=(1,−2), Q=(4,2), R=(2,3). Compute d(P,Q)=5 exactly; compute d(P,R)=√26 and prove by comparing squares that 5.09<√26<5.1, showing that 5.1 is only an approximation. For general real coordinates, also prove that the distance is defined and nonnegative, that d(Q,P)=d(P,Q), that d(P,P)=0, and that d(P,Q)=0 ⇔ P=Q.
Uses only the MKO's two-dimensional coordinate distance formula (real coordinates, nonnegative principal square root). It proves basic properties of the formula (nonnegativity, symmetry, and its relation to equality of points); it does not prove the triangle inequality, does not treat the link to an abstract metric or to Mathlib's EuclideanSpace, and does not prove that √26 is irrational. It does not change the canonical MKO or its English edition.
Main derivation
S01 · definition
Before
d(P,Q)
After
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}Conditions: none
Rule: mko_length_def · Uses: G1, G2, mko_length_def
Leaf basis: mko_length_def + def_unfold
By the MKO's definition: take the two coordinate differences, square each, add, and finally take the nonnegative principal square root. The order is 'difference, square, add, root'; the coordinate differences may not be added directly. The definition treats the horizontal and vertical displacements as two perpendicular components.
S02 · implies
Before
s=(x_2-x_1)^2+(y_2-y_1)^2
After
s\ge 0,\ d(P,Q)=\sqrt{s}\ge 0Conditions: x_1,y_1,x_2,y_2\in\mathbb{R}
Rule: square_nonneg · Uses: S01, square_nonneg
Leaf basis: square_nonneg + order_basics + sqrt_def
Both squares are ≥0 (squares of reals are nonnegative), and a sum of two nonnegative numbers is ≥0 (order and addition), so the radicand s≥0 and √s is defined; by the definition of the principal root, √s≥0. So for any two points the distance is defined and nonnegative (MKO assumption a3).
S03 · equivalent
Before
x_2-x_1,\ y_2-y_1\ \text{for}\ P,QAfter
4-1=3,\ 2-(-2)=4
Conditions: none
Rule: numeric_evaluation · Uses: G3, S01
Leaf basis: numeric_evaluation + add_inverse + neg_mul
P=(1,−2), Q=(4,2): x₂−x₁=4−1=3 and y₂−y₁=2−(−2)=2+2=4. Subtracting a negative number adds its opposite.
S04 · equivalent
Before
3^2+4^2
After
25
Conditions: none
Rule: numeric_evaluation · Uses: S03
Leaf basis: numeric_evaluation + power_laws
Square first, then add: 3²=9, 4²=16, and 9+16=25.
S05 · equivalent
Before
d(P,Q)=\sqrt{25}After
d(P,Q)=5
Conditions: 25\ge 0
Rule: sqrt_def · Uses: S02, S04, sqrt_def
Leaf basis: sqrt_def + numeric_evaluation + order_basics
By the definition of the principal root, √25 is the unique real b with b≥0 and b²=25. b=5 satisfies 5≥0 and 5²=25, so √25=5. −5 also satisfies (−5)²=25, but −5<0, so it is not the principal value; a distance cannot be −5.
S06 · equivalent
Before
d(Q,P)=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}After
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}=d(P,Q)Conditions: none
Rule: L_neg_sq · Uses: S01, L_neg_sq
Leaf basis: L_neg_sq + eq_replace
Swapping P and Q changes the sign of each difference: x₁−x₂=−(x₂−x₁). By Lemma L_neg_sq, (x₁−x₂)²=(x₂−x₁)², and likewise for y, so the radicands agree and d(Q,P)=d(P,Q) for all real coordinates. Example: d(Q,P)=√((1−4)²+(−2−2)²)=√(9+16)=5. The lemma is proved in S06.1.
S07 · equivalent
Before
d(P,P)=\sqrt{(x_1-x_1)^2+(y_1-y_1)^2}After
\sqrt{0}=0Conditions: none
Rule: sqrt_def · Uses: S01, sqrt_def
Leaf basis: sqrt_def + mul_zero + add_zero + add_inverse
Comparing P with itself, both differences are 0 and the radicand is 0²+0²=0; 0≥0 and 0²=0, so √0=0 and d(P,P)=0.
S08 · equivalent
Before
\sqrt{s}=0\ \ (s\ge 0)After
s=0
Conditions: s\ge 0
Rule: sqrt_def · Uses: S02, S07, sqrt_def
Leaf basis: sqrt_def + eq_congruence + mul_zero
⇒: by the definition of the principal root, (√s)²=s, so s=0²=0. ⇐: if s=0 then √0=0 (S07). This turns 'distance 0' into 'radicand 0'.
S09 · equivalent
Before
(x_2-x_1)^2+(y_2-y_1)^2=0
After
x_2=x_1\ \land\ y_2=y_1\ \iff\ P=Q
Conditions: none
Rule: L_sum_sq_zero · Uses: S08, L_sum_sq_zero
Leaf basis: L_sum_sq_zero + cartesian_product_def + add_inverse
By Lemma L_sum_sq_zero (a=x₂−x₁, b=y₂−y₁): the sum of squares is 0 ⇔ both differences are 0 ⇔ x₂=x₁ and y₂=y₁; by equality of ordered pairs this is P=Q. With S08: d(P,Q)=0 ⇔ P=Q. The lemma is proved in S09.1 and S09.2.
S10 · equivalent
Before
d(P,R)
After
\sqrt{(2-1)^2+(3-(-2))^2}=\sqrt{26}Conditions: none
Rule: mko_length_def · Uses: G3, S01
Leaf basis: mko_length_def + numeric_evaluation
R=(2,3): the x-difference is 2−1=1 and the y-difference is 3−(−2)=5; 1²+5²=1+25=26, so d(P,R)=√26. The exact form √26 is kept rather than replaced by a decimal.
S11 · equivalent
Before
5^2=25<26<36=6^2
After
5<\sqrt{26}<6Conditions: 5\ge 0,\ \sqrt{26}\ge 0,\ 6\ge 0
Rule: L_sq_mono · Uses: S10, L_sq_mono, sqrt_def
Leaf basis: L_sq_mono + sqrt_def + numeric_evaluation
5, √26 and 6 are all ≥0, and (√26)²=26 (definition of the principal root). By Lemma L_sq_mono: 25<26 ⇔ 5<√26, and 26<36 ⇔ √26<6. So √26 lies between 5 and 6. The lemma is proved in S11.1 and S11.2.
S12 · implies
Before
5.09^2=25.9081<26<26.01=5.1^2
After
5.09<\sqrt{26}<5.1,\ \sqrt{26}\neq 5.1Conditions: 5.09\ge 0,\ 5.1\ge 0
Rule: L_sq_mono · Uses: S10, L_sq_mono, sqrt_def
Leaf basis: L_sq_mono + sqrt_def + numeric_evaluation + contradiction
Exactly, 5.09²=25.9081<26 and 5.1²=26.01>26, so L_sq_mono gives 5.09<√26<5.1. In particular 5.1²=26.01≠26, so √26≠5.1: a finite decimal such as 5.1 or 5.0990195 printed by a program is only an approximation (5.0990195²<26, N14), while √26 is the exact distance.
S13 · implies
Before
\text{S02, S05, S06, S07, S09, S12}After
d(P,Q)=5,\ d(P,R)=\sqrt{26}\in(5.09,\,5.1);\ d\ge 0,\ d(Q,P)=d(P,Q),\ d(P,Q)=0\iff P=QConditions: none
Rule: and_intro_elim · Uses: S02, S05, S06, S07, S09, S12
Leaf basis: and_intro_elim
Putting the steps together: in the example d(P,Q)=5 and d(P,R)=√26, which lies between 5.09 and 5.1; for all real coordinates, the distance is defined and nonnegative, symmetric, and equal to 0 exactly when the two points coincide.
Substeps and lemmas
S06.1 · equivalent
Before
(p-q)^2
After
(q-p)^2
Conditions: none
Rule: neg_mul · Uses: add_inverse, neg_mul
Leaf basis: neg_mul + add_inverse + distributive
p−q=−(q−p) (additive inverses); by signs and multiplication (−w)(−w)=w·w, so (p−q)²=(−(q−p))²=(q−p)². This proves Lemma L_neg_sq; it is a polynomial identity (N6).
S09.1 · implies
Before
a^2+b^2=0
After
a=0\ \land\ b=0
Conditions: a,b\in\mathbb{R}
Rule: square_nonneg · Uses: square_nonneg
Leaf basis: square_nonneg + order_basics + eq_congruence
a²≥0 and b²≥0. From a²+b²=0 we get a²=−b²≤0; together with a²≥0, trichotomy gives a²=0, and square_nonneg (u²=0 ⇔ u=0) gives a=0. Likewise b=0.
S09.2 · implies
Before
a=0\ \land\ b=0
After
a^2+b^2=0
Conditions: none
Rule: mul_zero · Uses: mul_zero
Leaf basis: mul_zero + add_zero
Conversely: 0·0+0·0=0+0=0. S09.1 and S09.2 together prove both directions of Lemma L_sum_sq_zero.
S11.1 · implies
Before
0\le a<b
After
a^2<b^2
Conditions: a\ge 0
Rule: order_basics · Uses: distributive, order_basics
Leaf basis: distributive + order_basics + neg_mul
b²−a²=(b−a)(b+a) (check by expanding with distributivity, N17). b−a>0; and b>a≥0 gives b>0, so b+a>0. A product of two positive numbers is positive (order and multiplication), so b²−a²>0, that is a²<b².
S11.2 · implies
Before
a,b\ge 0,\ a^2<b^2
After
a<b
Conditions: a\ge 0; b\ge 0
Rule: contrapositive · Uses: S11.1, order_basics
Leaf basis: contrapositive + case_analysis + order_basics
By contraposition: if a<b fails, trichotomy gives a=b or b<a. If a=b then a²=b²; if b<a then S11.1 (with roles swapped, 0≤b<a) gives b²<a². In both cases a²<b² fails. So a²<b² implies a<b. S11.1 and S11.2 together prove Lemma L_sq_mono.
Error controls and negative controls
Square before adding
One misconception the MKO names is adding the coordinate differences without squaring them first. For P, Q, 3+4=7, but 7²=49≠25 (N16), so 7 is not d(P,Q); the correct order is to square first, 9+16=25, then take the root, 5. Differences can be negative, and adding them directly can even cancel: differences 1 and −1 add to 0, but the distance is √(1+1)=√2≠0 (N20).
The square root is the nonnegative principal value
The other misconception the MKO names is ignoring the nonnegative principal value. −5 also satisfies x²=25, but the distance is the principal value √25=5 (S05); writing d=±5 or d=−5 violates MKO assumption a3. S02 proves d≥0 for any two points.
A floating value is not the exact value
The MKO notes that a program can compute distances with hypot or a square root, but floating-point representations differ from exact real-number arithmetic. A decimal display of √26 is only an approximation: 5.1²=26.01≠26 (N13) and 5.0990195²<26 (N14). The exact answer is √26, and the comparison of squares in S11 to S12 gives a guaranteed range.
- d(P,Q)=3+4=7 →
reject — 7²=49≠25; the distance formula squares before adding (N16). - d(P,Q)=−5, because (−5)²=25 →
reject — The principal square root is nonnegative, so √25=5 (S05). - √26=5.1 →
reject — 5.1²=26.01≠26 (N13); 5.1 is only an approximation. - If the x-difference is 1 and the y-difference is −1, the differences add to 0, so the distance is 0 →
reject — The distance is √(1²+(−1)²)=√2≠0; by S09 the distance is 0 only when the two points coincide (N20).