(
`(!v0 v1:real^3 v2 v3 p x1 x2 x3 x4 x5 x6 alpha1 alpha2 alpha3 d w1 w2 w3.
p =
v0 v1 v2 v3 in
let x1,x2,x3,x4,x5,x6 = xlist v0 v1 v2 v3 in
let alpha1 =
(* -------------------------------------------------------------------------*)
(* Rescale by considering new points v1',v2',v3' *)
(* -------------------------------------------------------------------------*)
[(DISCH_TAC THEN REPEAT GEN_TAC THEN REPEAT LET_TAC THEN DISCH_TAC);
(ABBREV_TAC `v1' = v0 + inv (
norm(v1:real^3 - v0)) % (v1 - v0)`);
(ABBREV_TAC `v2' = v0 + inv (
norm(v2:real^3 - v0)) % (v2 - v0)`);
(ABBREV_TAC `v3' = v0 + inv (
norm(v3:real^3 - v0)) % (v3 - v0)`);
(ABBREV_TAC `w1' = (v1':real^3) - v0`);
(ABBREV_TAC `w2' = (v2':real^3) - v0`);
(ABBREV_TAC `w3' = (v3':real^3)- v0`);
(* -------------------------------------------------------------------------*)
(* Subgoal 1: &0 < norm (v1 - v0) *)
(* &0 < norm (v2 - v0) *)
(* &0 < norm (v3 - v0) *)
(* -------------------------------------------------------------------------*)
(SUBGOAL_THEN
`&0 <
norm (v1:real^3 - v0) /\
&0 <
norm (v2:real^3 - v0) /\
&0 <
norm (v3:real^3 - v0)`
ASSUME_TAC);
(PURE_ONCE_REWRITE_TAC[
NORM_POS_LT]);
(PURE_REWRITE_TAC[VECTOR_ARITH `(a - b =
vec 0) <=> (a = b)`;
MESON[] `(a <=> b) <=> ~ a <=> ~ b`]);
(REPEAT CONJ_TAC); (* Break into 3 subgoal *)
STRIP_TAC;
(SUBGOAL_THEN `
collinear {v0:real^3 , v1, v2}` ASSUME_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(PURE_REWRITE_TAC[
collinear; SET_RULE `{a, a, b} = {a , b}`]);
(EXISTS_TAC `v2:real^3 - v0`);
(REPEAT GEN_TAC);
(REWRITE_TAC[SET_RULE ` x
IN {a, b} <=> (x = a \/ x = b)`]);
STRIP_TAC; (* Break into 4 subgoals *)
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `-- &1` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&1` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC);
(ASM_MESON_TAC[
DELTA_X_LT_0_COLLINEAR]);
STRIP_TAC;
(SUBGOAL_THEN `
collinear {v0:real^3 , v1, v2}` ASSUME_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(PURE_REWRITE_TAC[
collinear; SET_RULE `{a, b, a} = {a , b}`]);
(EXISTS_TAC `v1:real^3 - v0`);
(REPEAT GEN_TAC);
(REWRITE_TAC[SET_RULE ` x
IN {a, b} <=> (x = a \/ x = b)`]);
STRIP_TAC; (* Break into 4 subgoals *)
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `-- &1` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&1` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC);
(ASM_MESON_TAC[
DELTA_X_LT_0_COLLINEAR]);
STRIP_TAC;
(SUBGOAL_THEN `
collinear {v0:real^3 , v1, v3}` ASSUME_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(PURE_REWRITE_TAC[
collinear; SET_RULE `{a, b, a} = {a , b}`]);
(EXISTS_TAC `v1:real^3 - v0`);
(REPEAT GEN_TAC);
(REWRITE_TAC[SET_RULE ` x
IN {a, b} <=> (x = a \/ x = b)`]);
STRIP_TAC; (* Break into 4 subgoals *)
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `-- &1` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&1` THEN VECTOR_ARITH_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC);
(ASM_MESON_TAC[
DELTA_X_LT_0_COLLINEAR]);
(* -------------------------------------------------------------------------*)
(* Subgoal 2: w1', w2', w3' havnorms equal 1 *)
(* -------------------------------------------------------------------------*)
(SUBGOAL_THEN
`
norm (w1':real^3) = &1 /\
norm (w2':real^3) = &1 /\
norm (w3':real^3) = &1`
ASSUME_TAC);
(EXPAND_TAC "w1'" THEN EXPAND_TAC "w2'" THEN EXPAND_TAC "w3'");
(UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC THEN DISCH_TAC);
(EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'");
(ONCE_REWRITE_TAC[VECTOR_ARITH `((a:real^3) + b) - a = b`]);
(REWRITE_TAC[
NORM_MUL;
REAL_ABS_INV]);
(SUBGOAL_THEN
`abs (
norm (v1 - v0)) =
norm (v1:real^3 - v0) /\
abs (
norm (v2 - v0)) =
norm (v2:real^3 - v0) /\
abs (
norm (v3 - v0)) =
norm (v3:real^3 - v0)`
ASSUME_TAC);
(SIMP_TAC[
NORM_POS_LE;
REAL_ABS_REFL]);
(ONCE_ASM_REWRITE_TAC[]);
(ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> ~(a = &0)`;REAL_MUL_LINV]);
(* ------------------------------------------------------------------------- *)
(* SUBGOAL 3 : *)
(* alpha1, alpha2, alpha3 arunchanged *)
(* ------------------------------------------------------------------------- *)
(ABBREV_TAC `alpha1' =
dihV (v0:real^3) v1' v2' v3'`);
(ABBREV_TAC `alpha2' =
dihV (v0:real^3) v2' v3' v1'`);
(ABBREV_TAC `alpha3' =
dihV (v0:real^3) v3' v1' v2'`);
(SUBGOAL_THEN
`alpha1:real = alpha1' /\ alpha2:real = alpha2' /\ alpha3:real = alpha3'`
ASSUME_TAC);
(EXPAND_TAC "alpha1" THEN EXPAND_TAC "alpha2" THEN EXPAND_TAC "alpha3");
(EXPAND_TAC "alpha1'" THEN EXPAND_TAC "alpha2'" THEN EXPAND_TAC "alpha3'");
(ABBREV_TAC `m = inv (
norm (v1:real^3 - v0))`);
(ABBREV_TAC `n = inv (
norm (v2:real^3 - v0))`);
(ABBREV_TAC `q = inv (
norm (v3:real^3 - v0))`);
(SUBGOAL_THEN
` v1' - v0 = m % (v1:real^3 - v0) /\
v2' - v0 = n % (v2:real^3 - v0) /\
v3' - v0 = q % (v3:real^3 - v0)`
ASSUME_TAC);
(EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'");
(VECTOR_ARITH_TAC);
(SUBGOAL_THEN `&0 < m /\ &0 < n /\ &0 < q ` ASSUME_TAC);
(EXPAND_TAC "m" THEN EXPAND_TAC "n" THEN EXPAND_TAC "q");
(REPLICATE_TAC 8 DEL_TAC THEN UP_ASM_TAC THEN STRIP_TAC);
(ASM_MESON_TAC[
REAL_LT_INV]);
(ASM_MESON_TAC[
DIHV_RESCALE_UNCHANGED]);
(* ========================================================================== *)
(* Subgoal 4: *)
(* (x1',x2',x3,'x4',x5',x6') = xlist (v0:real^3) v1' v2' v3' *)
(* ========================================================================== *)
(ABBREV_TAC `p' =
euler_p (v0:real^3) v1' v2' v3'`);
(ABBREV_TAC `x1' =
dist (v0:real^3,v1') pow 2`);
(ABBREV_TAC `x2' =
dist (v0:real^3,v2') pow 2`);
(ABBREV_TAC `x3' =
dist (v0:real^3,v3') pow 2`);
(ABBREV_TAC `x4' =
dist (v2':real^3,v3') pow 2`);
(ABBREV_TAC `x5' =
dist (v1':real^3,v3') pow 2`);
(ABBREV_TAC `x6' =
dist (v1':real^3,v2') pow 2`);
(ABBREV_TAC `d' =
delta_x (x1':real) x2' x3' x4' x5' x6' `);
(SUBGOAL_THEN
`x1':real,x2',x3',x4',x5',x6' =
xlist (v0:real^3) v1' v2' v3'`
ASSUME_TAC);
(REWRITE_TAC[xlist;ylist]);
(REPEAT LET_TAC);
(UP_ASM_TAC THEN PURE_REWRITE_TAC[
PAIR_EQ] THEN STRIP_TAC);
(ASM_MESON_TAC[
PAIR_EQ]);
(* --------------------------------------------------------------------------*)
(* Subgoal 5: *)
(* p' = k * p with somk *)
(*---------------------------------------------------------------------------*)
(ABBREV_TAC `
t1 = inv (
norm ((v1:real^3) - v0)) `);
(ABBREV_TAC `t2 = inv (
norm ((v2:real^3) - v0)) `);
(ABBREV_TAC `t3 = inv (
norm ((v3:real^3) - v0)) `);
(SUBGOAL_THEN `p' = (
t1 * t2 * t3) * p` ASSUME_TAC);
(EXPAND_TAC "p" THEN EXPAND_TAC "p'");
(MATCH_MP_TAC
COMPUTE_EULER_P_AFTER_RESCALE);
(EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'");
(REWRITE_TAC[VECTOR_ARITH `((a:real^3) + b) - a = b`]);
(EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3");
(ASM_MESON_TAC[
REAL_LT_INV]);
(* --------------------------------------------------------------------------*)
(* Subgoal 6: *)
(* d' = k * d with somk *)
(*---------------------------------------------------------------------------*)
(SUBGOAL_THEN `d' = (
t1 * t2 * t3) * (
t1 * t2 * t3) * d` ASSUME_TAC);
(EXPAND_TAC "d" THEN EXPAND_TAC "d'");
(MATCH_MP_TAC
COMPUTE_DELTA_X_AFTER_RESCALE);
(EXISTS_TAC `v0:real^3`);
(EXISTS_TAC `v1':real^3`);
(EXISTS_TAC `v2':real^3`);
(EXISTS_TAC `v3':real^3`);
(EXISTS_TAC `v0:real^3`);
(EXISTS_TAC `v1:real^3`);
(EXISTS_TAC `v2:real^3`);
(EXISTS_TAC `v3:real^3`);
(EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'");
(REWRITE_TAC[VECTOR_ARITH `((a:real^3) + b) - a = b`]);
(ASM_REWRITE_TAC[]);
(SUBGOAL_THEN `&0 <
t1 /\ &0 < t2 /\ &0 < t3 /\ &0 < d` ASSUME_TAC);
(EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3");
(REPLICATE_TAC 18 DEL_TAC);
(UP_ASM_TAC THEN REPLICATE_TAC 6 DEL_TAC THEN UP_ASM_TAC);
(MESON_TAC[
REAL_LT_INV]);
(UP_ASM_TAC THEN MESON_TAC[REAL_ARITH `&0 < a ==> &0 <= a`]);
(* -------------------------------------------------------------------------- *)
(* Subgoal 7: *)
(* This part is thproof of d' > 0 *)
(* -------------------------------------------------------------------------- *)
(SUBGOAL_THEN `&0 < d'` ASSUME_TAC);
(PURE_ONCE_ASM_REWRITE_TAC[]);
(SUBGOAL_THEN `&0 <
t1 /\ &0 < t2 /\ &0 < t3 /\ &0 < d` ASSUME_TAC);
(EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3");
(REPLICATE_TAC 19 DEL_TAC);
(UP_ASM_TAC THEN REPLICATE_TAC 6 DEL_TAC THEN UP_ASM_TAC);
(MESON_TAC[
REAL_LT_INV]);
(UP_ASM_TAC THEN MESON_TAC[
REAL_LT_MUL]);
(*---------------------------------------------------------------------------*)
(* Subgoal 8: *)
(* atn2 (sqrt d,&2 * p) is unchanged *)
(*---------------------------------------------------------------------------*)
(SUBGOAL_THEN `&2 * atn2 (
sqrt (d':real), &2 * (p':real)) =
&2 * atn2 (
sqrt (d:real), &2 * (p:real))` ASSUME_TAC);
AP_TERM_TAC;
(* Sugoal 8.1 *)
(SUBGOAL_THEN `&0 <
sqrt d /\ &0 <
sqrt d'` ASSUME_TAC);
(MESON_TAC[ASSUME `&0 < d`; ASSUME `&0 < d'`;
SQRT_POS_LT]);
(* Sugoal 8.2 *)
(SUBGOAL_THEN `atn2 (
sqrt d,&2 * p) =
atn ((&2 * p) /
sqrt d)`
ASSUME_TAC);
(FIRST_ASSUM MP_TAC THEN MESON_TAC[
ATN2_BREAKDOWN]);
(* Sugoal 8.3 *)
(SUBGOAL_THEN `atn2 (
sqrt d',&2 * p') =
atn ((&2 * p') /
sqrt d')`
ASSUME_TAC);
(MESON_TAC[ASSUME `&0 <
sqrt d /\ &0 <
sqrt d'`;
ATN2_BREAKDOWN]);
(ONCE_ASM_REWRITE_TAC[]);
AP_TERM_TAC;
(DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN STRIP_TAC);
(* Sugoal 8.4 *)
(SUBGOAL_THEN `((&2 * p') /
sqrt d' = (&2 * p) /
sqrt d) <=>
&2 * p' = ((&2 * p) /
sqrt d) *
sqrt d'`
ASSUME_TAC);
(UP_ASM_TAC THEN MESON_TAC[
REAL_EQ_LDIV_EQ]);
(ONCE_ASM_REWRITE_TAC[]);
(REWRITE_TAC[REAL_ARITH `((x * y) / b) * c = x * (c * y) / b`]);
AP_TERM_TAC;
DEL_TAC;
(PURE_ASM_REWRITE_TAC[
REAL_EQ_LDIV_EQ]);
(PURE_ONCE_REWRITE_TAC[REAL_ARITH `(x * y) / b = (x / b) * y`]);
(AP_THM_TAC THEN AP_TERM_TAC);
(ABBREV_TAC `S =
t1 * t2 * t3`);
(REWRITE_TAC[REAL_MUL_ASSOC;GSYM REAL_POW_2]);
(* Subgoal 8.5 *)
(SUBGOAL_THEN `
sqrt (S pow 2 * d) =
sqrt (S pow 2) *
sqrt d` ASSUME_TAC);
(MATCH_MP_TAC
SQRT_MUL);
(ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> &0 <= a`]);
(MESON_TAC[
REAL_LE_POW_2]);
(ONCE_ASM_REWRITE_TAC[]);
(ONCE_REWRITE_TAC[REAL_ARITH `(a * b) / c = a * (b / c)`]);
(* Subgoal 8.6 *)
(SUBGOAL_THEN `
sqrt d /
sqrt d = &1` ASSUME_TAC);
(MATCH_MP_TAC
REAL_DIV_REFL);
(ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> ~ (a = &0)`]);
(ONCE_ASM_REWRITE_TAC[]);
(REWRITE_TAC[
REAL_MUL_RID]);
(MATCH_MP_TAC (GSYM
SQRT_OF_POW_2_LE));
(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`));
(EXPAND_TAC "S");
(* Subgoal 8.7 *)
(SUBGOAL_THEN `&0 <
t1 /\ &0 < t2 /\ &0 < t3 /\ &0 < d` ASSUME_TAC);
(EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3");
(REPLICATE_TAC 19 DEL_TAC);
(ASM_MESON_TAC[
REAL_LT_INV]);
(UP_ASM_TAC THEN MESON_TAC[
REAL_LT_MUL]);
(*---------------------------------------------------------------------------*)
(* SUBGOAL 9 : *)
(* Finish the lemma about rescaling *)
(*---------------------------------------------------------------------------*)
(SUBGOAL_THEN
`alpha1' + alpha2' + alpha3' -
pi =
pi - &2 * atn2 (
sqrt d',&2 * p')`
ASSUME_TAC);
(ASM_MESON_TAC[]);
(ASM_MESON_TAC[])]);;