STRIP_TAC
THEN ASM_REWRITE_TAC[GSYM
DOT_SQUARE_NORM]
THEN MRESA_TAC
th3[`
vec 0:real^3`;`v1:real^3`;`v2:real^3`]
THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`
vec 0:real^3`;`v1:real^3`;`v2:real^3`][
dist;VECTOR_ARITH`
vec 0- A= --A/\ A-
vec 0=A:real^3`;GSYM
DOT_SQUARE_NORM;
NORM_NEG]
THEN MRESAL_TAC Collect_geom.FHFMKIY[`
vec 0:real^3`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`][
dist;VECTOR_ARITH`
vec 0- A= --A/\ A-
vec 0=A:real^3`;GSYM
DOT_SQUARE_NORM;
NORM_NEG]
THEN MP_TAC(REAL_ARITH`&0< x3/\ &0< x1==> &0<= x3/\ ~(x1= &0)`)
THEN RESA_TAC
THEN EXPAND_TAC"v3"
THEN REWRITE_TAC[
DOT_LADD;
DOT_RADD;
DOT_LMUL;
DOT_RMUL;
DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;
DOT_CROSS]
THEN ASM_TAC
THEN ASM_REWRITE_TAC[GSYM
DOT_SQUARE_NORM;
DOT_RSUB;
DOT_LSUB]
THEN REPEAT RESA_TAC
THEN MRESA_TAC
DOT_SYM[`v2:real^3`;`v1:real^3`]
THEN REPLICATE_TAC (23-9)(POP_ASSUM MP_TAC)
THEN POP_ASSUM(fun th->
REPEAT STRIP_TAC
THEN MP_TAC
th)
THEN ASM_REWRITE_TAC[REAL_ARITH`x1 - v1
dot v2 - (v1
dot v2 - x2) = x6
<=> v1
dot v2 = (x1 + x2 - x6)/ &2`;REAL_ARITH`a*a *b=a pow 2 *b/\ A- &0=A/\ (a*b) pow 2=a pow 2 * b pow 2`;
REAL_INV_MUL]
THEN RESA_TAC
THEN ASM_SIMP_TAC[
SGIN_POW_EQ]
THEN MRESA_TAC REAL_MUL_LINV[`x1:real`]
THEN ASM_REWRITE_TAC[REAL_ARITH`((inv (&2) pow 2 * inv x1 pow 2) * (x1 + x3 - x5) pow 2) * x1 = ((inv (&2) pow 2 * inv x1 ) * (x1 + x3 - x5) pow 2) * (inv x1 *x1)
/\ A * &1 =A `]
THEN ASM_SIMP_TAC[
SGIN_POW_EQ]
THEN MP_TAC(REAL_ARITH`&0<
ups_x x1 x3 x5==> &0<=
ups_x x1 x3 x5/\ ~(
ups_x x1 x3 x5 = &0)`)
THEN RESA_TAC
THEN MRESA_TAC
REAL_LE_INV[`
ups_x x1 x2 x6`]
THEN MRESA_TAC
REAL_LE_MUL[`inv(
ups_x x1 x2 x6)`;`
ups_x x1 x3 x5`]
THEN MRESA_TAC
SQRT_POW2[`inv (
ups_x x1 x2 x6) *
ups_x x1 x3 x5`]
THEN ASM_REWRITE_TAC[REAL_ARITH`(inv x1 pow 2 * &1 * inv (
ups_x x1 x2 x6) *
ups_x x1 x3 x5) *
x1 *
(x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2)
= (inv x1 *x1) * inv x1 * inv (
ups_x x1 x2 x6) *
ups_x x1 x3 x5 *
(x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2)`]
THEN MRESA_TAC
REAL_EQ_MUL_LCANCEL[`
ups_x x1 x2 x6`;`(inv (&2) pow 2 * inv x1) * (x1 + x3 - x5) pow 2 +
&1 *
inv x1 *
inv (
ups_x x1 x2 x6) *
ups_x x1 x3 x5 *
(x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2)`;`x3:real`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM
th])
THEN MRESA_TAC REAL_MUL_LINV[`
ups_x x1 x2 x6`]
THEN ASM_REWRITE_TAC[REAL_ARITH`
ups_x x1 x2 x6 *
((inv (&2) pow 2 * inv x1) * (x1 + x3 - x5) pow 2 +
&1 *
inv x1 *
inv (
ups_x x1 x2 x6) *
ups_x x1 x3 x5 *
(x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))
= inv x1 *(
ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2/ &4 +
(inv (
ups_x x1 x2 x6) *
ups_x x1 x2 x6 ) *
ups_x x1 x3 x5 *
(x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))`]
THEN MRESA_TAC
REAL_EQ_MUL_LCANCEL[`x1:real`;`inv x1 *
(
ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2 / &4 +
&1 *
ups_x x1 x3 x5 * (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))`;`
ups_x x1 x2 x6 * x3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM
th])
THEN ASM_REWRITE_TAC[REAL_ARITH`x1 *
inv x1 *
(
ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2 / &4 +
&1 *
ups_x x1 x3 x5 * (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))
= (inv x1 *x1) *
(
ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2 / &4 +
ups_x x1 x3 x5 * (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))/\ a pow 2=a*a`;
ups_x]
THEN REAL_ARITH_TAC);;