(* ========================================================================== *)
(* FLYSPECK - BOOK FORMALIZATION *)
(* *)
(* Chapter: Nonlinear *)
(* Author: Thomas C. Hales *)
(* Date: 2012-06-08 *)
(* ========================================================================== *)
(*
Copies DIHV_EQ_DIH_Y from Tame_general.
*)
(*
There are many nonlinear inequalities in the database, which have
been broken into pieces to simplify verification. However, the text
"Dense Sphere Packings" uses the inequalities in a merged formed that
combine many separate pieces. Here we merge the inequalities
into the form used in the text.
In particular the 5*46 inequalities of nonlinear/ineqdata3q1h.hl have
been merged into a single inequality: ox3q1h_merge (in 13 variables).
The assumption ox3q1h is the conjunction of these 230 inequalities.
This file is rather slow to load because it processes hundreds of
inequalities.
Major results in this file:
ox3q1h_merge : the 5*46 inequalities merged into one.
TSKAJXY_DERIVED4: tsk; that is, Ineq.TSKAJXY_DERIVED.ineq
ztg4 : ztg4_concl : combining ZTGIJCF4 ineqs.
lindih inequalities.
This file also proves many compatibilities of definitions.
*)
(* bug b14<->b34 fixed, feb 13, 2013 tchales *)
flyspeck_needs "nonlinear/ineqdata3q1h.hl";;
module Merge_ineq = struct
open Sphere;;
open Hales_tactic;;
let CALC_ID_TAC = Calc_derivative.CALC_ID_TAC;;
let let_RULE = fun th -> REWRITE_RULE[DEPTH_CONV let_CONV (concl th)] th;;
let add_hyp s concl =
let nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) s in
let conj = end_itlist (curry mk_conj) nonlinear in
mk_imp(conj,concl);;
(* }}} *)
(* ========================================================================== *)
(* Merge ineqdata3q1h.hl into a single inequality *)
(* ========================================================================== *)
let idq_of_string s = hd(Ineq.getexact s);;
(* idq_of_string "OXLZLEZ 6346351218 1 18";; *)
(* merge the inequalities in ineqdata3q1h.hl *)
let ox n i =
(idq_of_string (Printf.sprintf "OXLZLEZ 6346351218 %d %d" i n)).ineq;;
let tm0 n = ox n 0;;
let tm1 n = ox n 1;;
let tm2 n = ox n 2;;
let tm3 n = ox n 3;;
let tm4 n = ox n 4;;
let numcases = List.length Ineqdata3q1h.records;;
let ox_conj n = end_itlist (curry mk_conj) [tm0 n;tm1 n;tm2 n;tm3 n;tm4 n];;
let ox3q1h_term() =
end_itlist (curry mk_conj) (map ox_conj (0--(numcases-1)));;
let ox3q1h_mp = MP_TAC(ox3q1h());;
(* GENERATE PACKING CHAPTER NONLINEAR INEQS *)
(* get ids, make 1 def, extract *)
let filter_flypaper tl =
List.flatten (map (function
| Flypaper s -> s
| _ -> []) tl);;
let has_flypaper_tag sl ind =
let tl = ind.tags in
List.length (intersect (filter_flypaper tl) sl) > 0;;
let is_ox3q1h ind =
let oxl = "OXLZLEZ 6346351218" in
let s = ind.idv in
( (String.length oxl <= String.length s) &&
(String.sub s 0 (String.length oxl) = oxl));;
let packing_ineq_data =
filter (fun ind ->
has_flypaper_tag ["UKBRPFE";"BIEFJHU";"OXLZLEZ";"TSKAJXY"] ind &&
not(is_ox3q1h ind)) (!Ineq.ineqs);;
let mk_pack_nonlinear =
let ineql = map (fun idv -> idv.ineq) packing_ineq_data in
let packing_ineq_conj = end_itlist (curry mk_conj) ineql in
let _ = new_definition (mk_eq (`pack_nonlinear_non_ox3q1h:bool`,packing_ineq_conj)) in
();;
let get_pack_nonlinear_non_ox3q1h =
let ineql = map (fun ind -> ind.ineq) packing_ineq_data in
let sl = map (fun ind -> ind.idv) packing_ineq_data in
let packing_ineq_conj = end_itlist (curry mk_conj) ineql in
let th = new_definition (mk_eq (`pack_nonlinear_non_ox3q1h:bool`,packing_ineq_conj)) in
let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in
let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in
fun s ->
let i = index s sl in
let th2 = funpow i CONJUNCT2 th1 in
co1 th2;;
let example1 = (get_pack_nonlinear_non_ox3q1h "BIXPCGW 6652007036 a2");;
let [yv;a12;a23;a34;a14;b12;b23;b34;b14;c1;c2;c3;c4] =
map (fun t -> mk_var(t,`:real`))
(Str.split (Str.regexp " ")
"y a12 a23 a34 a14 b12 b23 b34 b14 c1 c2 c3 c4");;
let y12 = `(a12 + b12)/ &2`;;
let y23 = `(a23 + b23)/ &2`;;
let y34 = `(a34 + b34)/ &2`;;
let y41 = `(a14 + b14)/ &2`;;
let specl x = concl o (SPECL x) o ASSUME;;
let spec1 = specl[yv;a12;a14;c1;b14;b12];;
let spec2 = specl[yv;a23;a12;c2;b12;b23];;
let spec3 = specl[yv;a34;a23;c3;b23;b34];;
let spec4 = specl[yv;a14;a34;c4;b34;b14];;
(* let spec4 = specl[yv;a14;a34;c4;b14;b34];; (* bug b14<->b34 fixed, feb 13, 2013 tchales *) *)
let spec0 = specl[yv;y12;y23;y34;y41];;
let in1 n = spec1 (tm1 n);;
let in2 n = spec2 (tm2 n);;
let in3 n = spec3 (tm3 n);;
let in4 n = spec4 (tm4 n);;
let in0 n = spec0 (tm0 n);;
(* labels: y=spine, aij lower edge shared between i & j. bij = top edge.
ci = edge opp spine on simplex i *)
prioritize_real();;
(*
let getinstantiation =
let concl1 = ` (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / w +
cb * beta_bump_force_y y1 y2 y3 y4 y5 y6 +
cd * dih_y y1 y2 y3 y4 y5 y6 +
cy * y1 +
cab * (y2 + y3 + y5 + y6) +
cc >
&0)` in
fun in2 ->
let u = hd(tl(snd (strip_comb in2))) in
(term_match [] (concl1)) u;;
*)
let combinator_lemma = prove_by_refinement(`!cd cy1 cy2 cy3 cy4 cab1 cab2 cab3 cab4 cc1 cc2 cc3 cc4.
((
dih_y y a12 a14
c1 b14 b12 +
dih_y y a23 a12 c2 b12 b23 +
dih_y y a34 a23 c3 b23 b34 +
// bug2/14/2013:
dih_y y a14 a34 c4 b14 b34 =
dih_y y a14 a34 c4 b34 b14 =
&2 *
pi) /\ (&2 *
pi * cd +
(cy1 + cy2 + cy3 + cy4) * y +
&2 * (cab1 + cab2) * (a12 + b12) / &2 +
&2 * (cab2 + cab3) * (a23 + b23) / &2 +
&2 * (cab3 + cab4) * (a34 + b34) / &2 +
&2 * (cab4 + cab1) * (a14 + b14) / &2 +
cc1 +
cc2 +
cc3 +
cc4 <
&0) /\ ( gamma4fgcy y a12 a14
c1 b14 b12 lmfun / &2 +
&1 *
beta_bump_force_y y a12 a14
c1 b14 b12 +
cd *
dih_y y a12 a14
c1 b14 b12 +
cy1 * y +
cab1 * (a12 + a14 + b14 + b12) +
cc1 >
&0) /\
(gamma4fgcy y a23 a12 c2 b12 b23 lmfun / &1 +
&0 *
beta_bump_force_y y a23 a12 c2 b12 b23 +
cd *
dih_y y a23 a12 c2 b12 b23 +
cy2 * y +
cab2 * (a23 + a12 + b12 + b23) +
cc2 > &0) /\
(gamma4fgcy y a34 a23 c3 b23 b34 lmfun / &1 +
&0 *
beta_bump_force_y y a34 a23 c3 b23 b34 +
cd *
dih_y y a34 a23 c3 b23 b34 +
cy3 * y +
cab3 * (a34 + a23 + b23 + b34) +
cc3 >
&0) /\
// (gamma4fgcy y a14 a34 c4 b14 b34 lmfun / &1 +
// &0 *
beta_bump_force_y y a14 a34 c4 b14 b34 +
// cd *
dih_y y a14 a34 c4 b14 b34 +
(gamma4fgcy y a14 a34 c4 b34 b14 lmfun / &1 +
&0 *
beta_bump_force_y y a14 a34 c4 b34 b14 +
cd *
dih_y y a14 a34 c4 b34 b14 +
cy4 * y +
cab4 * (a14 + a34 + b34 + b14) +
cc4 >
&0) ==>
( gamma4fgcy y a12 a14
c1 b14 b12 lmfun / &2 +
beta_bump_force_y y a12 a14
c1 b14 b12 +
gamma4fgcy y a23 a12 c2 b12 b23 lmfun +
gamma4fgcy y a34 a23 c3 b23 b34 lmfun +
// gamma4fgcy y a14 a34 c4 b14 b34 lmfun >
gamma4fgcy y a14 a34 c4 b34 b14 lmfun >
&0
))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REPEAT(FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC);
MATCH_MP_TAC (arith `(a + b+c+d - e < &0) ==> ((a > &0) ==> (b > &0) ==> (c > &0) ==> (d > &0) ==> (e> &0))`);
FIRST_X_ASSUM MP_TAC;
MATCH_MP_TAC (arith `(t = e) ==> ((t< &0) ==> (e < &0))`);
REWRITE_TAC[arith `&2 *
pi * cd = (&2 *
pi) * cd`];
FIRST_X_ASSUM (SUBST1_TAC o (SYM));
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let template_OX = `!in0 in1 in2 in3 in4
y' y''
c1' c1'' c2' c2'' c3' c3'' c4' c4''
a12' a12'' a23' a23'' a34' a34'' a14' a14''
b12' b12'' b23' b23'' b34' b34'' b14' b14''.
(in0 /\ in1 /\ in2 /\ in3 /\ in4) ==>
ineq [(y',y,y'');
(c1',c1,c1'');
(c2',c2,c2'');
(c3',c3,c3'');
(c4',c4,c4'');
(a12',a12,a12'');
(a23',a23,a23'');
(a34',a34,a34'');
(a14',a14,a14'');
(b12',b12,b12'');
(b23',b23,b23'');
(b34',b34,b34'');
(b14',b14,b14'')
]
((dih_y y a12 a14 c1 b14 b12 +
dih_y y a23 a12 c2 b12 b23 +
dih_y y a34 a23 c3 b23 b34 +
// dih_y y a14 a34 c4 b14 b34 = &2 * pi) ==>
dih_y y a14 a34 c4 b34 b14 = &2 * pi) ==>
(gamma4fgcy y a12 a14 c1 b14 b12 lmfun / &2 +
beta_bump_force_y y a12 a14 c1 b14 b12 +
gamma4fgcy y a23 a12 c2 b12 b23 lmfun +
gamma4fgcy y a34 a23 c3 b23 b34 lmfun +
// gamma4fgcy y a14 a34 c4 b14 b34 lmfun
gamma4fgcy y a14 a34 c4 b34 b14 lmfun
> &0))`;;
let template_OX2 = `!
y' y''
c1' c1'' c2' c2'' c3' c3'' c4' c4''
a12' a12'' a23' a23'' a34' a34'' a14' a14''
b12' b12'' b23' b23'' b34' b34'' b14' b14''.
ox3q1h ==>
ineq [(y',y,y'');
(c1',c1,c1'');
(c2',c2,c2'');
(c3',c3,c3'');
(c4',c4,c4'');
(a12',a12,a12'');
(a23',a23,a23'');
(a34',a34,a34'');
(a14',a14,a14'');
(b12',b12,b12'');
(b23',b23,b23'');
(b34',b34,b34'');
(b14',b14,b14'')
]
((dih_y y a12 a14 c1 b14 b12 +
dih_y y a23 a12 c2 b12 b23 +
dih_y y a34 a23 c3 b23 b34 +
// dih_y y a14 a34 c4 b14 b34 = &2 * pi) ==>
dih_y y a14 a34 c4 b34 b14 = &2 * pi) ==>
(gamma4fgcy y a12 a14 c1 b14 b12 lmfun / &2 +
beta_bump_force_y y a12 a14 c1 b14 b12 +
gamma4fgcy y a23 a12 c2 b12 b23 lmfun +
gamma4fgcy y a34 a23 c3 b23 b34 lmfun +
// gamma4fgcy y a14 a34 c4 b14 b34 lmfun
gamma4fgcy y a14 a34 c4 b34 b14 lmfun
> &0))`;;
let dest_triple x =
let (a,b) = dest_pair x in
let (b,c) = dest_pair b in (b,(a,c));;
let getbounds tm =
let xx1 = hd(snd(strip_comb tm)) in
let xx2 = dest_list xx1 in
map dest_triple xx2;;
let allbounds n = setify(List.flatten (map getbounds [in1 n;in2 n;in3 n;in4 n]));;
let goal_OX n =
let g1 = specl [in0 n;in1 n;in2 n;in3 n;in4 n] template_OX in
let a = C assoc (allbounds n) in
let s1 v g =
let (v',v'') = a v in
specl [v';v''] g in
itlist s1 (List.rev [yv;c1;c2;c3;c4;a12;a23;a34;a14;b12;b23;b34;b14]) g1;;
let goal_OX2 n =
let g1 = template_OX2 in
let a = C assoc (allbounds n) in
let s1 v g =
let (v',v'') = a v in
specl [v';v''] g in
itlist s1 (List.rev [yv;c1;c2;c3;c4;a12;a23;a34;a14;b12;b23;b34;b14]) g1;;
let mk13ner n = prove_by_refinement(
goal_OX n,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.ineq];
REPEAT STRIP_TAC;
REPEAT (FIRST_X_ASSUM_ST `/\` MP_TAC);
ASM_REWRITE_TAC[];
ASM_SIMP_TAC[arith `a <= b /\ a <= c ==> a <= (b + c)/ &2`; arith `b <= a /\ c <= a ==> (b + c)/ &2 <= a` ];
FIRST_X_ASSUM_ST `dih_y` MP_TAC;
REWRITE_TAC[TAUT `(a ==> b==>c ==>d==>e==>f==>g)<=>(a /\ b /\ c /\ d/\ e /\ f ==>g)`];
DISCH_THEN (ASSUME_TAC o (MATCH_MP combinator_lemma));
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
let mk_ox3q1h n = prove_by_refinement(
goal_OX2 n,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC (mk13ner n);
BY(BY(ox3q1h_mp THEN ASM_REWRITE_TAC[] THEN REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[]))
]);;
(* }}} *)
let ox3q1h_46() = map mk_ox3q1h (0--(numcases-1));;
(* now start combining inequalities from ineqdata31h.hl *)
let ineq_APPEND = prove_by_refinement(
`!v f u. ineq (
APPEND u v) f = ineq u (ineq v f)`,
(* {{{ proof *)
[
GEN_TAC;
GEN_TAC;
LIST_INDUCT_TAC;
REWRITE_TAC[
APPEND];
BY(REWRITE_TAC[
APPEND;Sphere.ineq]);
REWRITE_TAC[
APPEND;Sphere.ineq];
SUBGOAL_THEN `?(a:real) (b:real) (c:real). h = (a,b,c)` MP_TAC;
BY(MESON_TAC[
PAIR_SURJECTIVE]);
REPEAT WEAK_STRIP_TAC;
ASM_REWRITE_TAC[];
REWRITE_TAC[Sphere.ineq];
BY(ASM_MESON_TAC[])
]);;
(* }}} *)
let pathL_pathR = prove_by_refinement(
`!c x.
(
FST c <= x /\ x <=
SND c) <=> (
(
FST(pathL c) <= x /\ x <=
SND(pathL c)) \/
(
FST(pathR c) <= x /\ x <=
SND(pathR c)))
`,
(* {{{ proof *)
[
REPEAT STRIP_TAC;
SUBGOAL_THEN `?(a:real) (b:real). c = (a,b)` MP_TAC;
BY(REWRITE_TAC[
PAIR_SURJECTIVE]);
REPEAT WEAK_STRIP_TAC;
ASM_REWRITE_TAC[Sphere.pathL;Sphere.pathR];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let ineq_pathL_pathR = prove_by_refinement(
`!u c x f.
ineq (
APPEND u (CONS (
FST(pathL c),x,
SND(pathL c)) v)) f /\
ineq (
APPEND u (CONS (
FST(pathR c),x,
SND(pathR c)) v)) f ==>
ineq (
APPEND u (CONS (
FST c,x,
SND c) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
ONCE_REWRITE_TAC[
pathL_pathR];
REPEAT (FIRST_X_ASSUM MP_TAC);
BY(ASM_CASES_TAC `
FST (pathL c) <= x /\ x <=
SND (pathL c)` THEN ASM_CASES_TAC `
FST (pathR c) <= x /\ x <=
SND (pathR c)` THEN ASM_REWRITE_TAC[] THEN REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[])
]);;
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
let CHOP_LIST_TAC n =
let chop = List.nth [chop0;chop1;chop2;chop3;chop4;chop5] n in
ONCE_REWRITE_TAC[chop];;
let CHOP_LIST_RULE n =
let chop = List.nth [chop0;chop1;chop2;chop3;chop4;chop5] n in
ONCE_REWRITE_RULE[chop];;
let get_cover i =
let zipr = zip (0--(numcases-1)) Ineqdata3q1h.records in
let fil = filter (fun (_,t) -> t.caseno=i) zipr in
let v = List.rev in
map
(fun (k,t) ->
(k,(v t.branch1,v t.branch2,v t.branch3,v t.branch4,v t.branch5)))
fil;;
let op1 gc k =
let thm = REWRITE_RULE[FST;SND] (UNDISCH (mk_ox3q1h k)) in
(thm,assoc k gc);;
let prep n =
let gc = get_cover n in
let vs = map fst gc in
map (op1 gc) vs;;
let merge_match (th1,r1) (th2,r2) =
let ((bx,nx),r3) = Ineqdata3q1h.combine (r1,r2) in
let (th1',th2') = if bx then (th1,th2) else (th2,th1) in
let th3 = CHOP_LIST_RULE nx (CONJ th1' th2') in
let th4 = MATCH_MP ineq_pathL_pathR th3 in
let th5 = REWRITE_RULE[APPEND;FST;SND] th4 in
(th5,r3);;
let rec combine_l = function
[] -> []
| [a] -> [a]
| a::b::cs ->
try (merge_match a b)::cs
with Failure _ -> a::combine_l (b::cs);;
let rec combine_r x =
let x'= combine_l x in
if (x'=x) then x else combine_r x';;
let combos = map (combine_r o prep) (1--4);;
let partial_merge = end_itlist CONJ (map fst (List.flatten combos));;
let hminus_h0_hplus = prove_by_refinement(
`!x. (&2 * hminus <= x /\ x <= &2 * hplus) <=> ((&2 * hminus <= x /\ x <= &2 *h0) \/ (&2 * h0 <= x /\ x <= &2 * hplus))`,
(* {{{ proof *)
[
GEN_TAC;
MP_TAC Nonlinear_lemma.hminus_lt_h0;
MP_TAC Nonlinear_lemma.h0_lt_hplus;
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let ox3q1h_merge = prove_by_refinement(
`ox3q1h ==>
!y
c1 c2 c3 c4 a12 a23 a34 a14 b12 b23 b34 b14.
ineq
[&2 * hminus,y,&2 * hplus; &2 * hminus,
c1,&2 * hplus; &2,c2,&2 * hminus;
&2,
c3,
&2 * hminus; &2,c4,&2 * hminus; &2,a12,&2 * hminus; &2,a23,&2 * hminus;
&2,
a34,
&2 * hminus; &2,a14,&2 * hminus; &2,b12,&2 * hminus; &2,
b23,
&2 * hminus;
&2,
b34,
&2 * hminus; &2,b14,&2 * hminus]
(
dih_y y a12 a14
c1 b14 b12 +
dih_y y a23 a12 c2 b12 b23 +
dih_y y a34 a23 c3 b23 b34 +
//
dih_y y a14 a34 c4 b14 b34 =
dih_y y a14 a34 c4 b34 b14 =
&2 *
pi
==> gamma4fgcy y a12 a14
c1 b14 b12 lmfun / &2 +
beta_bump_force_y y a12 a14
c1 b14 b12 +
gamma4fgcy y a23 a12 c2 b12 b23 lmfun +
gamma4fgcy y a34 a23 c3 b23 b34 lmfun +
// gamma4fgcy y a14 a34 c4 b14 b34 lmfun >
gamma4fgcy y a14 a34 c4 b34 b14 lmfun >
&0)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MP_TAC partial_merge;
CHOP_LIST_TAC (2);
REWRITE_TAC[
ineq_APPEND];
REPLICATE_TAC 3 (ONCE_REWRITE_TAC[Sphere.ineq]);
REWRITE_TAC[
hminus_h0_hplus];
BY(BOOL_CASES_TAC `&2 * hminus <= y /\ y <= &2 * h0` THEN BOOL_CASES_TAC `&2 * h0 <= y /\ y <= &2 * hplus` THEN BOOL_CASES_TAC `&2 * hminus <=
c1 /\
c1 <= &2 * h0` THEN BOOL_CASES_TAC `&2 * h0 <=
c1 /\
c1 <= &2 * hplus` THEN REWRITE_TAC[] THEN ASM_MESON_TAC[])
]);;
(* }}} *)
(* ========================================================================== *)
(* Prove Ineq.TSKAJXY_DERIVED.ineq from the nonlinear inequalities *)
(* ========================================================================== *)
let atn2_0 = REWRITE_RULE[ATN_0;arith `&0 <= &0`;arith `~(&0 < &0)`;arith `x - &0 = x`;arith `&0/x = &0`] (SPEC `&0` Trigonometry1.ATN2_BREAKDOWN);;
(* }}} *)
(* }}} *)
let ATN2_LE_PI2 = prove_by_refinement(
`!x y. &0 < x ==> atn2(x,y) < pi/ &2`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.atn2];
REPEAT WEAKER_STRIP_TAC;
INTRO_TAC
ATN_BOUNDS [];
ASSUME_TAC
PI_POS;
DISCH_TAC;
COND_CASES_TAC;
BY(ASM_MESON_TAC[]);
COND_CASES_TAC;
REWRITE_TAC[
ATN_POS_LT;arith `p - x < p <=> &0 < x`];
GMATCH_SIMP_TAC
REAL_LT_DIV;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
COND_CASES_TAC;
REWRITE_TAC[arith `-- (x/ &2) - y < x / &2 <=> -- x < y`];
MATCH_MP_TAC (arith `&0 <
pi /\ -- (
pi / &2) < u ==> --pi < u`);
BY(ASM_REWRITE_TAC[
ATN_BOUNDS]);
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let ATN2_POS = prove_by_refinement(
`!x y. &0 < x ==> (&0 < atn2(x,y) <=> &0 < y)`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.atn2];
REPEAT WEAKER_STRIP_TAC;
ASSUME_TAC
PI_POS;
COND_CASES_TAC;
REWRITE_TAC[
ATN_POS_LT];
BY(ASM_SIMP_TAC[Collect_geom.REAL_LT_RDIV_0]);
COND_CASES_TAC;
INTRO_TAC
ATN_BOUNDS [`x / y`];
BY(REAL_ARITH_TAC);
COND_CASES_TAC;
INTRO_TAC
ATN_BOUNDS [`x / y`];
BY(REAL_ARITH_TAC);
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let TRI_UPS_X_STRICT_POS = prove
(`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c < a + b) /\ (a < b + c) /\ (b < c + a) ==>
&0 <
ups_x (a * a) (b * b) (c * c)`,
REPEAT STRIP_TAC THEN
REWRITE_TAC [Trigonometry1.UPS_X_SQUARES] THEN
BY(REPEAT (MATCH_MP_TAC
REAL_LT_MUL ORELSE CONJ_TAC ORELSE
ASM_REAL_ARITH_TAC)));;
let ups_x_pos24 = prove_by_refinement(
`!a b c. &2 <= a /\ a < &4 /\ &2 <= b /\ b < &4 /\ &2 <= c /\ c < &4 ==> &0 <
ups_x (a pow 2) (b pow 2) (c pow 2)`,
(* {{{ proof *)
[
REPEAT STRIP_TAC;
REWRITE_TAC[arith `a pow 2 = a * a`];
MATCH_MP_TAC
TRI_UPS_X_STRICT_POS;
REPEAT (FIRST_X_ASSUM MP_TAC);
(BY(ASM_REAL_ARITH_TAC))
]);;
(* }}} *)
let sqrtpow2 = prove_by_refinement(
`!x. &0 <= x ==>
sqrt x *
sqrt x = x`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC (ISPEC `&0` Nonlinear_lemma.sq_pow2);
BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(*
let FROZEN_ONCE_REWRITE_TAC ths =
let th = end_itlist CONJ ths in
FREEZE_THEN (fun t -> ONCE_REWRITE_TAC[t]) th;;
*)
let COLLECT_MONOM t = (Optimize.FROZEN_REWRITE_TAC [
(SPEC t (REAL_ARITH `!t u v w. (((u * v)* w = u * v*w) /\ (t * (u * v)) = (u * (t * v)) /\ (t * t = t pow 2) /\ (t * t * u = (t pow 2 * u)))`))]);;
let loc_dot = prove_by_refinement(
`!v0 (v1:real^3). (v1 - v0)
dot (v1 - v0) = -- &2 * v0
dot v1 + v0
dot v0 + v1
dot v1`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[VECTOR_ARITH `((v1:real^3) - v0)
dot (v1 - v0) = v1
dot v1 - &2 * v0
dot v1 + v0
dot v0`];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let vector_of_simplex_dot = prove_by_refinement(
`!(v0:real^3) v1 v2 v3 x1 x2 x3 x4 x5 x6.
((v0 =
vec 0) /\
(v1
dot v1 = x1) /\
(v2
dot v2 = x2) /\
(v3
dot v3 = x3) /\
(v1
dot v2 = (x1 + x2 - x6)/ &2) /\
(v1
dot v3 = (x1 + x3 - x5)/ &2) /\
(v2
dot v3 = (x2 + x3 - x4)/ &2 )) ==>
((x1 =
dist(v0,v1) pow 2) /\
(x2 =
dist(v0,v2) pow 2) /\
(x3 =
dist(v0,v3) pow 2) /\
(x4 =
dist(v2,v3) pow 2) /\
(x5 =
dist(v1,v3) pow 2) /\
(x6 =
dist(v1,v2) pow 2))`,
(* {{{ proof *)
[
REWRITE_TAC[Collect_geom.DIST_POW2_DOT;
loc_dot];
REPEAT WEAK_STRIP_TAC;
ASM_REWRITE_TAC[VECTOR_ARITH `
vec 0
dot u = &0 /\ u
dot vec 0 = &0`];
ONCE_REWRITE_TAC[VECTOR_ARITH `v3
dot v2 = v2
dot v3`];
ASM_REWRITE_TAC[];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let vector_of_simplex_edge_lemma = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6 y1 u1 d1 p. ~(y1= &0) /\ ~(u1 = &0) /\
&0 <=
delta_x x1 x2 x3 x4 x5 x6 /\ y1 pow 2 = x1 /\ u1 pow 2 =
ups_x x1 x2 x6 /\
d1 pow 2 =
delta_x x1 x2 x3 x4 x5 x6 /\ p = (x1*x1 - x1*x2 - x1*x3 + x2*x3 + &2*x1*x4 - x1*x5 - x2*x5 - x1*x6 - x3*x6 + x5*x6)
==>
(let (v0:real^3) =
vec 0 in
let v1 =
vector [y1; &0; &0] in
let v2 =
vector [(x1+x2 - x6)/(&2 * y1); u1/(&2 * y1); &0] in
let v3 =
vector [(x1+x3-x5)/(&2 * y1);
-- p/(&2*y1 *u1);d1/u1] in
((x1 =
dist(v0,v1) pow 2) /\
(x2 =
dist(v0,v2) pow 2) /\
(x3 =
dist(v0,v3) pow 2) /\
(x4 =
dist(v2,v3) pow 2) /\
(x5 =
dist(v1,v3) pow 2) /\
(x6 =
dist(v1,v2) pow 2)))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[
LET_DEF;
LET_END_DEF];
MATCH_MP_TAC
vector_of_simplex_dot;
REWRITE_TAC[Collect_geom.DIST_POW2_DOT;
vector_norm;
DOT_3;
VECTOR_SUB_COMPONENT;
VECTOR_3];
BY(REPEAT CONJ_TAC THEN CALC_ID_TAC THEN ASM_REWRITE_TAC[arith `(-- x)*y = -- (x *y) /\ x*(--y) = -- (x * y) /\ (-- (x + y) = --x + --y) /\ (x +y)+z = x + y+z /\ (-- (-- x) = x) /\ (x - y = x + (-- y)) /\ x * &0 = &0 /\ &0 * x = &0 /\ (x + y)*z = x*z + y*z /\ z*(x+y) = z*x + z*y`;arith `(a * b) *c = a * b* c`;] THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[arith `~(&2= &0)`] THEN REPLICATE_TAC 3 DISCH_TAC THEN (COLLECT_MONOM `y1:real`) THEN (COLLECT_MONOM `u1:real`) THEN (COLLECT_MONOM `d1:real`) THEN REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.ups_x;Sphere.delta_x] THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let simplex_exists = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6. (&0 < x1 /\ &0 <
ups_x x1 x2 x6 /\ &0 <=
delta_x x1 x2 x3 x4 x5 x6) ==> (?(v0:real^3) v1 v2 v3.
( x1 =
dist(v0,v1) pow 2 /\
x2 =
dist (v0,v2) pow 2 /\
x3 =
dist (v0,v3) pow 2 /\
x4 =
dist (v2,v3) pow 2 /\
x5 =
dist (v1,v3) pow 2 /\
x6 =
dist (v1,v2) pow 2))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MP_TAC (ISPECL [`x1:real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`;`
sqrt x1`;`
sqrt(
ups_x x1 x2 x6)`;`
sqrt(
delta_x x1 x2 x3 x4 x5 x6)`;`(x1*x1 - x1*x2 - x1*x3 + x2*x3 + &2*x1*x4 - x1*x5 - x2*x5 - x1*x6 - x3*x6 + x5*x6)`]
vector_of_simplex_edge_lemma);
ASM_REWRITE_TAC[];
ANTS_TAC;
REWRITE_TAC[
SQRT_POW2];
GMATCH_SIMP_TAC
SQRT_EQ_0;
GMATCH_SIMP_TAC
SQRT_EQ_0;
REPEAT (FIRST_X_ASSUM (MP_TAC));
BY(REAL_ARITH_TAC);
LET_TAC;
REPEAT LET_TAC;
BY(MESON_TAC[])
]);;
(* }}} *)
let DELTA_X_AND_DELTA_X4 = prove(`!x1 x2 x3 x4 x5 x6.
(let d4 =
delta_x4 x1 x2 x3 x4 x5 x6 in
let d =
delta_x x1 x2 x3 x4 x5 x6 in
let v1 =
ups_x x1 x2 x6 in
let v2 =
ups_x x1 x3 x5 in
&4 * x1 * d = v1 * v2 - d4 * d4)`,
REPEAT GEN_TAC THEN
REPEAT (CONV_TAC let_CONV) THEN
REWRITE_TAC[Sphere.delta_x4; Sphere.delta_x; Sphere.ups_x] THEN
REAL_ARITH_TAC);;
(* dihV = dih_y *)
let DIHV_EQ_DIH_Y = prove(`!v0:real^3 v1 v2 v3. ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3}
==> (let v01 =
dist (v0, v1) in
let v02 =
dist (v0, v2) in
let v03 =
dist (v0, v3) in
let v12 =
dist (v1, v2) in
let v13 =
dist (v1, v3) in
let v23 =
dist (v2, v3) in
dihV v0 v1 v2 v3 =
dih_y v01 v02 v03 v23 v13 v12)`,
REPEAT GEN_TAC THEN
DISCH_TAC THEN
FIRST_ASSUM (MP_TAC o (fun
th -> CONJUNCT2 (MATCH_MP (let_RULE Trigonometry.OJEKOJF)
th))) THEN
DISCH_THEN (unlist REWRITE_TAC) THEN
REPEAT (CONV_TAC let_CONV) THEN
MAP_EVERY ABBREV_TAC [`v01 =
dist(v0:real^3,v1)`; `v02 =
dist(v0:real^3,v2)`;
`v03 =
dist(v0:real^3,v3)`; `v12 =
dist(v1:real^3,v2)`;
`v13 =
dist(v1:real^3,v3)`; `v23 =
dist(v2:real^3,v3)`;
`d =
delta_x (v01 pow 2) (v02 pow 2) (v03 pow 2) (v23 pow 2) (v13 pow 2) (v12 pow 2)`;
`d4 =
delta_x4 (v01 pow 2) (v02 pow 2) (v03 pow 2) (v23 pow 2) (v13 pow 2) (v12 pow 2)`] THEN
REWRITE_TAC[let_RULE Sphere.dih_y; let_RULE Sphere.dih_x; GSYM REAL_POW_2] THEN
ASM_REWRITE_TAC[REAL_ARITH `a - b = a + c <=> c = --b`] THEN
MATCH_MP_TAC Trigonometry1.ATN2_RNEG THEN
DISJ_CASES_TAC (TAUT `~(d4 = &0) \/ d4 = &0`) THEN ASM_REWRITE_TAC[] THEN
MATCH_MP_TAC
SQRT_POS_LT THEN
MP_TAC (let_RULE (SPECL [`v01 pow 2`; `v02 pow 2`; `v03 pow 2`; `v23 pow 2`; `v13 pow 2`; `v12 pow 2`]
DELTA_X_AND_DELTA_X4)) THEN
ASM_REWRITE_TAC[] THEN
DISCH_THEN (fun
th -> REWRITE_TAC[
th; REAL_ARITH `a - &0 * &0 = a`]) THEN
MP_TAC (let_RULE Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT) THEN
ASM_REWRITE_TAC[] THEN
MP_TAC (INST [`v3:real^3`,`v2:real^3`] (let_RULE Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT)) THEN
ASM_REWRITE_TAC[] THEN
REPEAT DISCH_TAC THEN
MATCH_MP_TAC
REAL_LT_MUL THEN
ASM_REWRITE_TAC[]);;
let DIHV_DIH_X = prove_by_refinement(
`!(v0:real^3) v1 v2 v3.
(let x01 =
dist (v0,v1) pow 2 in
let x02 =
dist (v0,v2) pow 2 in
let x03 =
dist (v0,v3) pow 2 in
let x12 =
dist (v1,v2) pow 2 in
let x13 =
dist (v1,v3) pow 2 in
let x23 =
dist (v2,v3) pow 2 in
&0 <
ups_x x01 x02 x12 /\ &0 <
ups_x x01 x03 x13 ==> (
dihV v0 v1 v2 v3 =
dih_x x01 x02 x03 x23 x13 x12))
`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MP_TAC(ISPECL [`v0:real^3`;`v1:real^3`;`v2:real^3`;`v3:real^3`]
DIHV_EQ_DIH_Y);
REWRITE_TAC[
LET_DEF;
LET_END_DEF];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `
collinear` MP_TAC;
ANTS_TAC;
BY(ASM_REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]);
DISCH_THEN SUBST1_TAC;
REWRITE_TAC[Sphere.dih_y];
BY(REWRITE_TAC[arith `x * x = x pow 2`;
LET_DEF;
LET_END_DEF])
]);;
(* }}} *)
let sol_x_sol_euler_x = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6. &0 < x1 /\ &0 <
ups_x x1 x2 x6 /\ &0 <
ups_x x2 x3 x4 /\
&0 <
ups_x x1 x3 x5 /\ &0 <
eulerA_x x1 x2 x3 x4 x5 x6 /\
&0 <
delta_x x1 x2 x3 x4 x5 x6 ==>
sol_x x1 x2 x3 x4 x5 x6 =
sol_euler_x x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MP_TAC (ISPECL [`x1:real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`]
simplex_exists);
ASM_REWRITE_TAC[];
ANTS_TAC;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
REPEAT WEAK_STRIP_TAC;
MP_TAC (ISPECL [`v0:real^3`;`v1:real^3`;`v2:real^3`;`v3:real^3`] Euler_main_theorem.EULER_TRIANGLE);
REWRITE_TAC[Sphere.euler_p;Sphere.xlist;Sphere.ylist];
REWRITE_TAC[Sphere.sol_x;Sphere.sol_euler_x];
REWRITE_TAC[
LET_DEF;
LET_END_DEF];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MP_TAC;
ANTS_TAC;
BY(ASM_MESON_TAC[]);
REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[
LET_DEF;
LET_END_DEF]
DIHV_DIH_X));
REPEAT ( FIRST_X_ASSUM_ST `pow` ((MP_TAC o (SYM ))));
REPEAT WEAK_STRIP_TAC;
ASM_REWRITE_TAC[];
ONCE_REWRITE_TAC[
DIST_SYM];
ASM_REWRITE_TAC[];
REPEAT WEAK_STRIP_TAC;
CONJ_TAC;
BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]);
CONJ_TAC;
BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]);
DISCH_THEN SUBST1_TAC;
REWRITE_TAC[arith `
pi - &2 * x = &2*(pi/ &2 - x)`];
GMATCH_SIMP_TAC
pi2_sub_atn2;
REWRITE_TAC[GSYM
CONJ_ASSOC];
CONJ_TAC;
BY(ASM_SIMP_TAC [
SQRT_POS_LT]);
SUBGOAL_THEN `(
dist ((v1:real^3),v0) *
dist (v2,v0) *
dist (v3,v0) +
dist (v1,v0) * ((v2 - v0)
dot (v3 - v0)) +
dist (v2,v0) * ((v3 - v0)
dot (v1 - v0)) +
dist (v3,v0) * ((v1 - v0)
dot (v2 - v0))) =
eulerA_x x1 x2 x3 x4 x5 x6` SUBST1_TAC;
REWRITE_TAC[Sphere.eulerA_x];
BINOP_TAC;
BY(REPEAT BINOP_TAC THEN ASM_MESON_TAC[
POW_2_SQRT;
DIST_POS_LE;
DIST_SYM]);
BINOP_TAC;
BINOP_TAC;
BY(ASM_MESON_TAC[
POW_2_SQRT;
DIST_POS_LE;
DIST_SYM]);
EXPAND_TAC"x2";
EXPAND_TAC "x3";
EXPAND_TAC "x4";
REWRITE_TAC[Collect_geom.DIST_POW2_DOT];
REWRITE_TAC[DOT_LSUB;DOT_RSUB];
REWRITE_TAC[DOT_SYM];
BY(REAL_ARITH_TAC);
BINOP_TAC;
BINOP_TAC;
BY(ASM_MESON_TAC[POW_2_SQRT;DIST_POS_LE;DIST_SYM]);
EXPAND_TAC"x1";
EXPAND_TAC "x3";
EXPAND_TAC "x5";
REWRITE_TAC[Collect_geom.DIST_POW2_DOT];
REWRITE_TAC[DOT_LSUB;DOT_RSUB;DOT_SYM];
BY(REAL_ARITH_TAC);
BINOP_TAC;
BY(ASM_MESON_TAC[POW_2_SQRT;DIST_POS_LE;DIST_SYM]);
EXPAND_TAC"x1";
EXPAND_TAC "x2";
EXPAND_TAC "x6";
REWRITE_TAC[Collect_geom.DIST_POW2_DOT];
REWRITE_TAC[DOT_LSUB;DOT_RSUB;DOT_SYM];
BY(REAL_ARITH_TAC);
CONJ_TAC;
FIRST_X_ASSUM_ST `eulerA_x` MP_TAC;
BY(REAL_ARITH_TAC);
REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC);
REWRITE_TAC[Sphere.eulerA_x];
MATCH_MP_TAC (arith `(a = a') ==> (a + b = a' + b)`);
GMATCH_SIMP_TAC SQRT_MUL;
GMATCH_SIMP_TAC SQRT_MUL;
GMATCH_SIMP_TAC Real_ext.REAL_PROP_NN_MUL2;
BY(ASM_MESON_TAC[REAL_LE_POW_2])
]);;
(* }}} *)
let dih_x_dih_x_div_sqrtdelta_posbranch = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
&0 < x1 /\ &0 <
delta_x x1 x2 x3 x4 x5 x6 /\
&0 <
delta_x4 x1 x2 x3 x4 x5 x6 ==>
dih_x x1 x2 x3 x4 x5 x6 =
sqrt(
delta_x x1 x2 x3 x4 x5 x6) *
dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.dih_x;Nonlin_def.dih_x_div_sqrtdelta_posbranch;
LET_DEF;
LET_END_DEF];
REPEAT WEAK_STRIP_TAC;
GMATCH_SIMP_TAC
matan_pos;
SUBCONJ_TAC;
REWRITE_TAC[Calc_derivative.invert_den_lt;GSYM REAL_MUL_ASSOC;arith `x pow 2 = x * x`];
BY(ASM_MESON_TAC[
REAL_LT_MUL;arith `&0 < &4`]);
DISCH_TAC;
ABBREV_TAC `d =
delta_x x1 x2 x3 x4 x5 x6`;
ABBREV_TAC `d4 =
delta_x4 x1 x2 x3 x4 x5 x6`;
GMATCH_SIMP_TAC Trigonometry1.ATN2_RNEG;
CONJ_TAC;
DISJ1_TAC;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
REWRITE_TAC[arith `x + -- y = x - y`];
GMATCH_SIMP_TAC
pi2_sub_atn2;
ASM_REWRITE_TAC[];
CONJ_TAC;
MATCH_MP_TAC
SQRT_POS_LT;
BY(ASM_MESON_TAC[
REAL_LT_MUL;arith `&0 < &4`]);
GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> (atn2(x,y) =
atn(y/x))`);
ASM_REWRITE_TAC[];
SUBGOAL_THEN `
sqrt((&4 * x1 * d) / d4 pow 2) =
sqrt(&4 * x1 * d)/d4` SUBST1_TAC;
BY(ASM_MESON_TAC[Trigonometry1.SQRT_DIV_R;
REAL_LT_MUL;arith `&0 < x ==> &0 <= x`;arith `&0 < &4`]);
REWRITE_TAC[arith `a * b /c * e/f = e * ((a * b/c)/f)`];
MATCH_MP_TAC (arith `x = &1 ==> u = u * x`);
GMATCH_SIMP_TAC
REAL_EQ_LDIV_EQ;
REWRITE_TAC[arith `&4 * x1 * d = d * (&4 * x1)`];
GMATCH_SIMP_TAC
SQRT_MUL;
REWRITE_TAC[Calc_derivative.invert_den_lt];
REPEAT CONJ_TAC;
BY(ASM_MESON_TAC[arith `&0 < d ==> &0 <= d`]);
BY(ASM_MESON_TAC[
REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`]);
GMATCH_SIMP_TAC
SQRT_MUL;
BY(ASM_MESON_TAC[
REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`;
SQRT_POS_LT]);
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let dih_x_dih_x_div_sqrtdelta_negbranch = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
&0 < x1 /\ &0 <
delta_x x1 x2 x3 x4 x5 x6 /\
delta_x4 x1 x2 x3 x4 x5 x6 < &0 ==>
dih_x x1 x2 x3 x4 x5 x6 =
pi +
sqrt(
delta_x x1 x2 x3 x4 x5 x6) *
dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.dih_x;Nonlin_def.dih_x_div_sqrtdelta_posbranch;
LET_DEF;
LET_END_DEF;arith `x < &0 <=> &0 < -- x`];
REPEAT WEAK_STRIP_TAC;
GMATCH_SIMP_TAC
matan_pos;
SUBCONJ_TAC;
REWRITE_TAC[Calc_derivative.invert_den_lt;GSYM REAL_MUL_ASSOC;arith `x pow 2 = (--x) * (-- x)`];
BY(BY(ASM_MESON_TAC[
REAL_LT_MUL;arith `&0 < &4`;arith `x < &0 <=> &0 < -- x`]));
DISCH_TAC;
ABBREV_TAC `d =
delta_x x1 x2 x3 x4 x5 x6`;
ONCE_REWRITE_TAC[arith `x pow 2 = (--x) pow 2`];
ONCE_REWRITE_TAC[arith `a *
sqrt u / v * r = a *
sqrt u /(-- (-- v)) * r`];
ABBREV_TAC `d4 = --
delta_x4 x1 x2 x3 x4 x5 x6`;
REWRITE_TAC[arith `
pi / &2 + x =
pi + u <=> -- u = pi/ &2 - x`];
GMATCH_SIMP_TAC
pi2_sub_atn2;
ASM_REWRITE_TAC[];
CONJ_TAC;
BY(BY(ASM_MESON_TAC[
REAL_LT_MUL;
SQRT_POS_LT;arith `x < &0 <=> &0 < -- x`;arith `&0 < &4`]));
GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> (atn2(x,y) =
atn(y/x))`);
ASM_REWRITE_TAC[];
SUBGOAL_THEN `
sqrt((&4 * x1 * d) / d4 pow 2) =
sqrt(&4 * x1 * d)/d4` SUBST1_TAC;
BY(BY(ASM_MESON_TAC[Trigonometry1.SQRT_DIV_R;
REAL_LT_MUL;arith `&0 < x ==> &0 <= x`;arith `&0 < &4`]));
REWRITE_TAC[arith `--(a * b /c * e/f) = e * ((a * (--b)/c)/f)`];
MATCH_MP_TAC (arith `x = &1 ==> u * x = u`);
GMATCH_SIMP_TAC
REAL_EQ_LDIV_EQ;
REWRITE_TAC[arith `&4 * x1 * d = d * (&4 * x1)`];
GMATCH_SIMP_TAC
SQRT_MUL;
REWRITE_TAC[Calc_derivative.invert_den_lt];
REPEAT CONJ_TAC;
BY(BY(ASM_MESON_TAC[arith `&0 < d ==> &0 <= d`]));
BY(BY(ASM_MESON_TAC[
REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`]));
GMATCH_SIMP_TAC
SQRT_MUL;
BY(BY(ASM_MESON_TAC[
REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`;
SQRT_POS_LT]));
CALC_ID_TAC;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let tau_x_tau_residual_x = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
sqrt(x1) = &2 * h0 /\
&0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\
delta_x4 x1 x2 x3 x4 x5 x6 < &0 /\
&0 <
delta_x4 x2 x3 x1 x5 x6 x4 /\
&0 <
delta_x4 x3 x1 x2 x6 x4 x5 /\
&0 <=
delta_x x1 x2 x3 x4 x5 x6 ==>
taum_x x1 x2 x3 x4 x5 x6 =
sqrt(
delta_x x1 x2 x3 x4 x5 x6) *
tau_residual_x x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[arith `&0 <= x <=> (&0 = x \/ &0 < x)`];
DISCH_THEN DISJ_CASES_TAC;
REWRITE_TAC[Sphere.taum_x;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x;Sphere.rhazim;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y;Sphere.dih_y;
LET_DEF;
LET_END_DEF;Sphere.dih_x];
ASM_SIMP_TAC[arith `x * x = x pow 2`;
SQRT_POW_2;arith `&0 < x ==> &0 <= x`];
SUBGOAL_THEN `
delta_x x2 x3 x1 x5 x6 x4 = &0` SUBST1_TAC;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC);
SUBGOAL_THEN `
delta_x x3 x1 x2 x6 x4 x5 = &0` SUBST1_TAC;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC);
FIRST_X_ASSUM (SUBST1_TAC o (GSYM));
REWRITE_TAC[arith `x * &0 = &0`;arith `&0 * x = &0`;
SQRT_0];
ASM_SIMP_TAC[atn2_0;arith `(-- y < &0 <=> &0 < y) /\ ( &0 < -- y <=> y < &0)`];
REWRITE_TAC[Sphere.h0;Nonlinear_lemma.rho_alt;arith `pi/ &2 + pi/ &2 =
pi /\ x + -- x = &0 /\ x * &0 = &0`];
BY(REAL_ARITH_TAC);
REWRITE_TAC[Sphere.taum_x;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x;Sphere.rhazim;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y;Sphere.dih_y;
LET_DEF;
LET_END_DEF];
ASM_SIMP_TAC[arith `x * x = x pow 2`;
SQRT_POW_2;arith `&0 < x ==> &0 <= x`];
REWRITE_TAC[Nonlin_def.tau_residual_x];
REWRITE_TAC[Nonlin_def.tau_residual_x;Nonlin_def.rhazim_x_div_sqrtdelta_posbranch;Nonlin_def.rhazim2_x_div_sqrtdelta_posbranch;Nonlin_def.rhazim3_x_div_sqrtdelta_posbranch;Sphere.rotate2;Sphere.rotate3];
ASM_REWRITE_TAC[];
REWRITE_TAC[arith `a + b + c - d = (a - d) + b + c`];
REWRITE_TAC[arith `a * (b + c) = a * b + a * c`];
BINOP_TAC;
ASM_SIMP_TAC[
dih_x_dih_x_div_sqrtdelta_negbranch];
REWRITE_TAC[Sphere.h0;Nonlinear_lemma.rho_alt;];
BY(REAL_ARITH_TAC);
BINOP_TAC;
ONCE_REWRITE_TAC[arith `a * b * c = b * (a * c)`];
AP_TERM_TAC;
GMATCH_SIMP_TAC
dih_x_dih_x_div_sqrtdelta_posbranch;
ASM_REWRITE_TAC[];
SUBGOAL_THEN `
delta_x x2 x3 x1 x5 x6 x4 =
delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC;
BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC);
BY(ASM_REWRITE_TAC[]);
ONCE_REWRITE_TAC[arith `a * b * c = b * (a * c)`];
AP_TERM_TAC;
GMATCH_SIMP_TAC
dih_x_dih_x_div_sqrtdelta_posbranch;
ASM_REWRITE_TAC[];
SUBGOAL_THEN `
delta_x x3 x1 x2 x6 x4 x5 =
delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC;
BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC);
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
let sol_x_sol_x_sqrtdelta = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6. &0 < x1 /\ &0 < x2 /\ &0 < x3 /\
(&0 <
eulerA_x x1 x2 x3 x4 x5 x6) /\ (&0 <=
delta_x x1 x2 x3 x4 x5 x6 ) ==>
sol_euler_x x1 x2 x3 x4 x5 x6 =
sqrt(
delta_x x1 x2 x3 x4 x5 x6) *
sol_euler_x_div_sqrtdelta x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.sol_euler_x;Nonlin_def.sol_euler_x_div_sqrtdelta];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (DISJ_CASES_TAC o (REWRITE_RULE[arith `&0 <= x <=> x = &0 \/ &0 < x`]));
ASM_REWRITE_TAC[arith `&0 / x = &0`;
SQRT_0];
LET_TAC;
REWRITE_TAC[
LET_DEF;
LET_END_DEF];
REWRITE_TAC[arith `&0 * x = &0 /\ (&2 * x = &0 <=> x = &0)`];
GMATCH_SIMP_TAC (MESON [Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> atn2 (x,&0) =
atn(&0/x)`);
REWRITE_TAC[arith `&0 / x = &0`;
ATN_0;arith `&0 < &2 * a <=> &0 < a`];
SUBGOAL_THEN `a =
eulerA_x x1 x2 x3 x4 x5 x6` SUBST1_TAC;
EXPAND_TAC "a";
REWRITE_TAC[Sphere.eulerA_x];
REPEAT (GMATCH_SIMP_TAC SQRT_MUL);
BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`;Real_ext.REAL_PROP_NN_MUL2]);
BY(ASM_REWRITE_TAC[]);
LET_TAC;
REWRITE_TAC[LET_DEF;LET_END_DEF];
SUBGOAL_THEN `a = eulerA_x x1 x2 x3 x4 x5 x6` ASSUME_TAC;
EXPAND_TAC "a";
REWRITE_TAC[Sphere.eulerA_x];
REPEAT (GMATCH_SIMP_TAC SQRT_MUL);
BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`;Real_ext.REAL_PROP_NN_MUL2]);
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC matan_pos;
REWRITE_TAC[Calc_derivative.invert_den_lt];
CONJ_TAC;
REWRITE_TAC[arith `x pow 2 = x* x`];
BY(BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`]));
REWRITE_TAC[arith `&4 * x pow 2 = (&2 * x ) pow 2`];
GMATCH_SIMP_TAC (MESON[Trigonometry1.SQRT_DIV_R] `&0 <= x /\ &0 <= y ==> sqrt(x / y pow 2) = sqrt x / y`);
GMATCH_SIMP_TAC (MESON [Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> atn2 (x,y) = atn(y/x)`);
ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`;Real_ext.REAL_PROP_NN_MUL2;arith `&0 < &2`;REAL_LT_MUL];
MATCH_MP_TAC (arith `&2 = a / y / z ==> &2 * x = a * x / y / z`);
CALC_ID_TAC;
GMATCH_SIMP_TAC SQRT_EQ_0;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(* }}} *)
let sol_x_sym = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
sol_x x1 x2 x3 x4 x5 x6 =
sol_x x1 x3 x2 x4 x6 x5`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.sol_x];
REPEAT STRIP_TAC;
MATCH_MP_TAC (arith `(a=a')/\(b=b')/\(c=c')==>((a + b + c -
pi) = (a' + c'+b'-pi)) `);
BY(MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2])
]);;
(* }}} *)
let sol_x_sym2 = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
sol_x x1 x2 x3 x4 x5 x6 =
sol_x x2 x3 x1 x5 x6 x4`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.sol_x];
REPEAT STRIP_TAC;
MATCH_MP_TAC (arith `(a=a')/\(b=b')/\(c=c')==>((a + b + c -
pi) = (b' + c'+a'-pi)) `);
BY(BY(MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]))
]);;
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
let gamma4fgcy_div_sqrtdelta = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
&0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\
&2 * h0 <=
sqrt x1 /\ &2 * h0 <=
sqrt x4 /\
sqrt x2 <= &2 * h0 /\
sqrt x3 <= &2 * h0 /\
sqrt x5 <= &2 * h0 /\
sqrt x6 <= &2 * h0 /\
&0 <
ups_x x1 x2 x6 /\ &0 <
ups_x x2 x3 x4 /\ &0 <
ups_x x1 x3 x5 /\
&0 <
ups_x x4 x5 x6 /\
&0 <
eulerA_x x1 x2 x3 x4 x5 x6 /\
&0 <
eulerA_x x4 x2 x6 x1 x5 x3 /\
&0 <
eulerA_x x5 x3 x4 x2 x6 x1 /\
&0 <
eulerA_x x6 x1 x5 x3 x4 x2 /\
&0 <
delta_x4 x5 x3 x4 x2 x6 x1 /\
&0 <
delta_x4 x3 x1 x2 x6 x4 x5 /\
&0 <
delta_x4 x2 x3 x1 x5 x6 x4 /\
&0 <
delta_x4 x6 x1 x5 x3 x4 x2 /\
&0 <
delta_x x1 x2 x3 x4 x5 x6 ==>
(gamma4fgcy (
sqrt x1) (
sqrt x2) (
sqrt x3) (
sqrt x4)
(
sqrt x5) (
sqrt x6) lmfun =
sqrt(
delta_x x1 x2 x3 x4 x5 x6) * (&1 / &12 -
(
(&2 * mm1 /
pi) *
(
sol_euler_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 +
sol_euler345_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 +
sol_euler156_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 +
sol_euler246_x_div_sqrtdelta x1 x2 x3 x4 x5 x6) -
(&8 * mm2 /
pi) * (
ldih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 +
ldih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 +
ldih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 +
ldih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6
)
)))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f;Sphere.y_of_x;
sol_x_sol_y;Sphere.dih_y;
LET_DEF;
LET_END_DEF];
ASM_SIMP_TAC[arith `x * x = x pow 2`;
SQRT_POW_2;arith `&0 < x ==> &0 <= x`];
REWRITE_TAC[Nonlin_def.sol_euler345_x_div_sqrtdelta;Nonlin_def.sol_euler156_x_div_sqrtdelta;Nonlin_def.sol_euler246_x_div_sqrtdelta;Nonlin_def.ldih2_x_div_sqrtdelta_posbranch;Nonlin_def.ldih3_x_div_sqrtdelta_posbranch;Nonlin_def.ldih5_x_div_sqrtdelta_posbranch;Nonlin_def.ldih6_x_div_sqrtdelta_posbranch;Sphere.rotate2;Sphere.rotate3;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;Nonlin_def.ldih_x_div_sqrtdelta_posbranch];
ASM_SIMP_TAC[Nonlinear_lemma.lmfun_lfun];
ASM_SIMP_TAC[Nonlinear_lemma.lmfun0;arith `&0 * x = &0 /\ &0 + x = x`];
REWRITE_TAC[arith `
sqrt x * (u - v) =
sqrt x * u -
sqrt x * v /\
sqrt x * (u+ v) =
sqrt x * u +
sqrt x * v`];
BINOP_TAC;
REWRITE_TAC[Sphere.vol_x];
BY(REAL_ARITH_TAC);
BINOP_TAC;
REWRITE_TAC[arith `
sqrt x * y * z = y *
sqrt x * z`];
AP_TERM_TAC;
SUBGOAL_THEN `
sol_x x1 x5 x6 x4 x2 x3 =
sol_x x6 x1 x5 x3 x4 x2 /\
sol_x x4 x5 x3 x1 x2 x6 =
sol_x x5 x3 x4 x2 x6 x1 /\
sol_x x4 x2 x6 x1 x5 x3 =
sol_x x4 x2 x6 x1 x5 x3` (unlist REWRITE_TAC);
BY(MESON_TAC[
sol_x_sym;
sol_x_sym2]);
REPEAT (GMATCH_SIMP_TAC
sol_x_sol_euler_x);
ASM_REWRITE_TAC[];
REWRITE_TAC[
CONJ_ASSOC];
MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
CONJ_TAC;
REWRITE_TAC[arith `x * ( y + z) = x * y + x* z`];
MATCH_MP_TAC (arith ` (a = a' /\ b = c' /\ c = b' /\ d = d')==>(a + b + c + d = a' + b' + c' + d')`);
REPEAT (GMATCH_SIMP_TAC
sol_x_sol_x_sqrtdelta);
ASM_REWRITE_TAC[];
REWRITE_TAC[GSYM
CONJ_ASSOC];
BY(REPEAT CONJ_TAC THEN REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC) THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[Sphere.delta_x;Sphere.eulerA_x] THEN REAL_ARITH_TAC);
BY(REWRITE_TAC[GSYM
CONJ_ASSOC] THEN REPEAT CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[Sphere.delta_x;Sphere.ups_x] THEN REAL_ARITH_TAC);
REWRITE_TAC[arith `
sqrt x * y * z = y *
sqrt x * z`];
AP_TERM_TAC;
SUBGOAL_THEN `
dih_x x5 x1 x6 x2 x4 x3 =
dih_x x5 x3 x4 x2 x6 x1` SUBST1_TAC;
BY(MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]);
REWRITE_TAC[arith `a * (b + c) = a* b + a*c`];
MATCH_MP_TAC (arith `a = a' /\ b = b' /\ c = c' /\ d = d' ==> a + b + c +d = a' + b' + c' + d'`);
REWRITE_TAC[arith `
sqrt x * y * z = y *
sqrt x * z`];
REPEAT (GMATCH_SIMP_TAC (
dih_x_dih_x_div_sqrtdelta_posbranch));
ASM_REWRITE_TAC[];
BY(REPEAT CONJ_TAC THEN REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC) THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[Sphere.delta_x] THEN TRY REAL_ARITH_TAC)
]);;
(* }}} *)
let gamma4fgcy_sym12 = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y2 y1 y3 y5 y4 y6 f`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f];
REPEAT WEAK_STRIP_TAC;
BINOP_TAC;
REWRITE_TAC[Sphere.y_of_x;Sphere.vol_x];
REPLICATE_TAC 3 (AP_TERM_TAC ORELSE AP_THM_TAC);
REWRITE_TAC[Sphere.delta_x];
BY(REAL_ARITH_TAC);
BINOP_TAC;
AP_TERM_TAC;
MATCH_MP_TAC (arith `a = a' /\ b = d' /\ c = c' /\ d = b' ==> a+b+c+d = a'+b' + c' + d'`);
REWRITE_TAC[
sol_x_sol_y;Sphere.y_of_x];
BY(MESON_TAC[
sol_x_sym;
sol_x_sym2]);
AP_TERM_TAC;
MATCH_MP_TAC (arith `a = b' /\ b = a' /\ c = c' /\ d = e' /\ e = d' /\ f = f' ==> (a+b+c+d+e+f = a'+b'+c'+d'+e'+f')`);
REWRITE_TAC[Sphere.dih_y];
REWRITE_TAC[Sphere.dih_y;
LET_DEF;
LET_END_DEF];
BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2])
]);;
(* }}} *)
let gamma4fgcy_sym23 = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y1 y3 y2 y4 y6 y5 f`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f];
REPEAT WEAK_STRIP_TAC;
BINOP_TAC;
REWRITE_TAC[Sphere.y_of_x;Sphere.vol_x];
REPLICATE_TAC 3 (AP_TERM_TAC ORELSE AP_THM_TAC);
REWRITE_TAC[Sphere.delta_x];
BY(BY(REAL_ARITH_TAC));
BINOP_TAC;
AP_TERM_TAC;
MATCH_MP_TAC (arith `a = a' /\ b = b' /\ c = d' /\ d = c' ==> a+b+c+d = a'+b' + c' + d'`);
REWRITE_TAC[
sol_x_sol_y;Sphere.y_of_x];
BY(BY(MESON_TAC[
sol_x_sym;
sol_x_sym2]));
AP_TERM_TAC;
MATCH_MP_TAC (arith `a = a' /\ b = c' /\ c = b' /\ d = d' /\ e = f' /\ f = e' ==> (a+b+c+d+e+f = a'+b'+c'+d'+e'+f')`);
REWRITE_TAC[Sphere.dih_y];
REWRITE_TAC[Sphere.dih_y;
LET_DEF;
LET_END_DEF];
BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]))
]);;
(* }}} *)
let gamma4fgcy_sym03 = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y5 y4 y3 y2 y1 y6 f`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f];
REPEAT WEAK_STRIP_TAC;
BINOP_TAC;
REWRITE_TAC[Sphere.y_of_x;Sphere.vol_x];
REPLICATE_TAC 3 (AP_TERM_TAC ORELSE AP_THM_TAC);
REWRITE_TAC[Sphere.delta_x];
BY(BY(BY(REAL_ARITH_TAC)));
BINOP_TAC;
AP_TERM_TAC;
MATCH_MP_TAC (arith `a = c' /\ b = b' /\ c = a' /\ d = d' ==> a+b+c+d = a'+b' + c' + d'`);
REWRITE_TAC[
sol_x_sol_y;Sphere.y_of_x];
BY(BY(BY(MESON_TAC[
sol_x_sym;
sol_x_sym2])));
AP_TERM_TAC;
MATCH_MP_TAC (arith `a = e' /\ b = d' /\ c = c' /\ d = b' /\ e = a' /\ f = f' ==> (a+b+c+d+e+f = a'+b'+c'+d'+e'+f')`);
REWRITE_TAC[Sphere.dih_y];
REWRITE_TAC[Sphere.dih_y;
LET_DEF;
LET_END_DEF];
BY(BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2])))
]);;
(* }}} *)
(*
let rho_ij'_rho_x = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6. rho_ij' x1 x2 x3 x6 x5 x4 = rho_x x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.rho_x;Collect_geom.rho_ij'];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
*)
(* }}} *)
let GDRQXLGv2 = prove_by_refinement(
`!(v0:real^3) v1 v2 v3. let s = {v0, v1, v2, v3} in
let x1 =
dist (v0,v1) pow 2 in
let x2 =
dist (v0,v2) pow 2 in
let x3 =
dist (v0,v3) pow 2 in
let x4 =
dist (v2,v3) pow 2 in
let x5 =
dist (v1,v3) pow 2 in
let x6 =
dist (v1,v2) pow 2 in
CARD s = 4 /\ ~coplanar_alt s
==> (radV s) pow 2 =
rad2_x x1 x2 x3 x4 x5 x6 `,
(* {{{ proof *)
[
REWRITE_TAC[
LET_DEF;
LET_END_DEF;Sphere.rad2_x];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `&0 <=
rho_x (
dist ((v0:real^3),(v1:real^3)) pow 2) (
dist (v0,(v2:real^3)) pow 2) (
dist (v0,(v3:real^3)) pow 2) (
dist (v2,v3) pow 2) (
dist (v1,v3) pow 2) (
dist (v1,v2) pow 2)` ASSUME_TAC;
REWRITE_TAC[GSYM Collect_geom.rho_ij'_rho_x];
MATCH_MP_TAC (REWRITE_RULE[
LET_DEF;
LET_END_DEF] Collect_geom2.SHOGYBS);
BY(ASM_REWRITE_TAC[]);
SUBGOAL_THEN `&0 <
delta_x (
dist ((v0:real^3),(v1:real^3)) pow 2) (
dist (v0,(v2:real^3)) pow 2) (
dist (v0,(v3:real^3)) pow 2) (
dist (v2,v3) pow 2) (
dist (v1,v3) pow 2) (
dist (v1,v2) pow 2)` ASSUME_TAC;
REWRITE_TAC[GSYM
delta_delta_x];
BY(ASM_REWRITE_TAC[ Collect_geom2.POS_EQ_NOT_COPLANANR]);
GMATCH_SIMP_TAC (REWRITE_RULE[
LET_DEF;
LET_END_DEF] Collect_geom2.GDRQXLG);
ASM_REWRITE_TAC[];
REWRITE_TAC[Collect_geom.rho_ij'_rho_x;
delta_delta_x];
ABBREV_TAC `r =
rho_x (
dist ((v0:real^3),(v1:real^3)) pow 2) (
dist (v0,(v2:real^3)) pow 2) (
dist (v0,(v3:real^3)) pow 2) (
dist (v2,v3) pow 2) (
dist (v1,v3) pow 2) (
dist (v1,v2) pow 2)`;
ABBREV_TAC `d =
delta_x (
dist ((v0:real^3),(v1:real^3)) pow 2) (
dist (v0,(v2:real^3)) pow 2) (
dist (v0,(v3:real^3)) pow 2) (
dist (v2,v3) pow 2) (
dist (v1,v3) pow 2) (
dist (v1,v2) pow 2)`;
REWRITE_TAC[Trigonometry2.DIV_POW2];
CALC_ID_TAC;
REWRITE_TAC[GSYM
CONJ_ASSOC];
GMATCH_SIMP_TAC
SQRT_EQ_0;
REWRITE_TAC[Trigonometry2.MUL_POW2];
REPEAT (GMATCH_SIMP_TAC
SQRT_POW_2);
REPEAT (FIRST_X_ASSUM MP_TAC);
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
(* need to fix order for future compatibility of proofs
let tsk_hyp =
let tsk_nonlinear = map (fun t -> t.ineq) (Ineq.getprefix "TSK") in
end_itlist (curry mk_conj) tsk_nonlinear;;
*)
let tsk_hyp =
let tsks= ["TSKAJXY-GXSABWC DIV"; "TSKAJXY-IYOUOBF sharp v2";
"TSKAJXY-IYOUOBF sym";
"TSKAJXY-RIBCYXU sharp"; "TSKAJXY-RIBCYXU sym"; "TSKAJXY-TADIAMB";
"TSKAJXY-WKGUESB sym"; "TSKAJXY-XLLIPLS"; "TSKAJXY-delta_x4";
"TSKAJXY-eulerA"] in
let tsk_nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) tsks in
end_itlist (curry mk_conj) tsk_nonlinear;;
let tsk =
let tsk_concl = Ineq.TSKAJXY_DERIVED.ineq in
mk_imp(tsk_hyp,tsk_concl);;
let tsk_lemma1 = prove_by_refinement(
(mk_imp(tsk_hyp,`!y1 y2 y3 y4 y5 y6.
ineq [#2.8,y1,sqrt8;
&2,y2,#2.01;
&2,y3,#2.01;
#2.8,y4,sqrt8;
&2,y5,#2.01;
&2,y6,#2.01]
(&0 < delta_y y1 y2 y3 y4 y5 y6 ==>
gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0)`)),
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM_ST `delta_x4` MP_TAC);
REPEAT (FIRST_X_ASSUM_ST `eulerA_x` MP_TAC);
REPEAT (FIRST_X_ASSUM_ST `mm1` MP_TAC);
REPEAT (FIRST_X_ASSUM (fun t -> ALL_TAC));
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `y1 = sqrt (y1 * y1) /\ y2 = sqrt(y2 * y2) /\ y3 = sqrt(y3 * y3) /\ y4 = sqrt (y4 * y4) /\ y5 = sqrt(y5 *y5) /\ y6 = sqrt(y6 * y6)` (unlist ONCE_REWRITE_TAC);
REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx);
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
GMATCH_SIMP_TAC gamma4fgcy_div_sqrtdelta;
REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx);
REWRITE_TAC[Collect_geom2.REAL_POSSQ];
REWRITE_TAC[GSYM CONJ_ASSOC];
REPLICATE_TAC 18 (CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);ALL_TAC]);
REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[arith `y1 pow 2 = y1 * y1`] ups_x_pos24));
REPLICATE_TAC 4 (CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);ALL_TAC]);
REPEAT (FIRST_X_ASSUM MP_TAC);
REPLICATE_TAC 3 DISCH_TAC;
REWRITE_TAC[TAUT `(a <= y ==> y <= b ==> c) <=> (a <= y /\ y <= b) ==> c`];
REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6];
EVERY (map SPEC_TAC [(`y6:real`,`y6:real`);(`y5:real`,`y5:real`);(`y4:real`,`y4:real`);(`y3:real`,`y3:real`);(`y2:real`,`y2:real`);(`y1:real`,`y1:real`)]);
MATCH_MP_TAC Nonlinear_lemma.ineq_square2;
(CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);ALL_TAC]);
REWRITE_TAC[Sphere.delta_y;Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MP_TAC;
REPEAT (GMATCH_SIMP_TAC sqrtpow2);
REPLICATE_TAC 6 (CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);ALL_TAC]);
SUBGOAL_THEN `delta_x4 x3 x1 x2 x6 x4 x5 = delta_x4 x3 x2 x1 x6 x5 x4 /\ delta_x4 x6 x1 x5 x3 x4 x2 = delta_x4 x6 x5 x1 x3 x2 x4` (unlist REWRITE_TAC);
BY(REWRITE_TAC[Sphere.delta_x4] THEN REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `delta_x4` MP_TAC;
REWRITE_TAC[Sphere.ineq];
DISCH_THEN (REPEAT o (GMATCH_SIMP_TAC));
ASM_REWRITE_TAC[];
REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC);
REWRITE_TAC[REWRITE_RULE[arith `x * x = x pow 2`] Nonlinear_lemma.sqrt8_2];
REWRITE_TAC[arith `#8.0 = &8 /\ &2 pow 2 = &4`];
REPLICATE_TAC 12 (DISCH_TAC);
ASM_REWRITE_TAC[];
FIRST_X_ASSUM_ST `eulerA_x` MP_TAC;
REWRITE_TAC[Sphere.ineq];
SUBGOAL_THEN `eulerA_x x5 x3 x4 x2 x6 x1 = eulerA_x x4 x3 x5 x1 x6 x2 /\ eulerA_x x6 x1 x5 x3 x4 x2 = eulerA_x x1 x5 x6 x4 x2 x3` (unlist REWRITE_TAC);
REWRITE_TAC[Sphere.eulerA_x];
BY(REAL_ARITH_TAC);
DISCH_THEN (REPEAT o (GMATCH_SIMP_TAC));
ASM_REWRITE_TAC[];
DISCH_TAC;
ASM_REWRITE_TAC[];
REWRITE_TAC[arith `a >= b <=> b <= a`];
MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2;
CONJ_TAC;
MATCH_MP_TAC SQRT_POS_LE;
BY((FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
REWRITE_TAC[arith `b <= a <=> a >= b`];
FIRST_X_ASSUM MP_TAC;
MATCH_MP_TAC (arith `(f >= &0 \/ d < &0) ==> (&0 < d ==> f >= &0)`);
FIRST_X_ASSUM_ST `mm1` MP_TAC;
REWRITE_TAC[Sphere.ineq];
DISCH_THEN (GMATCH_SIMP_TAC);
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
let specl x = concl o (SPECL x) o ASSUME;;
(* THIS APPROACH TO PROVING REAL_WLOG_SIMPLEX CRASHES OCAML ---
let real_ty = `:real`;;
let mk_y i = mk_var("y"^string_of_int i,real_ty);;
let [y1;y2;y3;y4;y5;y6] = map mk_y (1--6);;
let simplex_orders =
[[y1;y2;y3;y4;y5;y6];[y1;y3;y2;y4;y6;y5];[y1;y5;y6;y4;y2;y3];[y1;y6;y5;y4;y3;y2];
[y2;y1;y3;y5;y4;y6];[y2;y3;y1;y5;y6;y4];[y2;y4;y6;y5;y1;y3];[y2;y6;y4;y5;y3;y1];
[y3;y1;y2;y6;y4;y5];[y3;y2;y1;y6;y5;y4];[y3;y4;y5;y6;y1;y2];[y3;y5;y4;y6;y2;y1];
[y4;y2;y6;y1;y5;y3];[y4;y3;y5;y1;y6;y2];[y4;y5;y3;y1;y2;y6];[y4;y6;y2;y1;y3;y5];
[y5;y1;y6;y2;y4;y3];[y5;y3;y4;y2;y6;y1];[y5;y4;y3;y2;y1;y6];[y5;y6;y1;y2;y3;y4];
[y6;y1;y5;y3;y4;y2];[y6;y2;y4;y3;y5;y1];[y6;y4;y2;y3;y1;y5];[y6;y5;y1;y3;y2;y4]];;
let symtt =
let symt = `!y1 y2 y3 y4 y5 y6. (y6 <= y1) /\ (y5 <= y1) /\ (y4 <= y1) /\
(y3 <= y1) /\ (y2 <= y1) /\ (y6 <= y2) /\ (y5 <= y2) /\ (y3 <= y2)` in
let cs = map (fun t -> specl t symt) simplex_orders in
end_itlist (curry mk_disj) cs;;
let SYM_CASES = time REAL_ARITH symtt;; (* THIS IS THE KILLER LINE *)
*)
let (* Packing3 *) REAL_FINITE_MAX_EXISTS =
prove(`!S:real->bool. FINITE S /\ ~(S = {}) ==> ?m. m IN S /\ (!x. x IN S ==> x <= m)`,
MESON_TAC[SUP_FINITE]);;
let REAL_WLOG_SIMPLEX_LEMMA = prove_by_refinement(
`!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y1 y3 y5 y4 y6 /\
P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5 /\
P y1 y2 y3 y4 y5 y6 = P y5 y4 y3 y2 y1 y6) /\
(!y1 y2 y3 y4 y5 y6. (y6 <= y1) /\ (y5 <= y1) /\ (y4 <= y1) /\
(y3 <= y1) /\ (y2 <= y1) ==>
P y1 y2 y3 y4 y5 y6) ==>
(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `?a. a
IN {y1,y2,y3,y4,y5,y6} /\ (!x. x
IN {y1,y2,y3,y4,y5,y6} ==> x <= a)` MP_TAC;
MATCH_MP_TAC
REAL_FINITE_MAX_EXISTS;
BY(REWRITE_TAC[
FINITE_INSERT ;
FINITE_EMPTY;
NOT_INSERT_EMPTY]);
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM_ST `
IN` MP_TAC);
REWRITE_TAC[
IN_INSERT;
NOT_IN_EMPTY];
REWRITE_TAC[MESON[] `(!x. x = y1 \/ x = y2 \/ x = y3 \/ x = y4 \/ x = y5 \/ x = y6 ==> x <= a) = (y1 <= a /\ y2 <= a /\ y3 <= a /\ y4 <= a /\ y5 <= a /\ y6 <= a)`];
BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[])
]);;
(* }}} *)
let REAL_WLOG_SIMPLEX_SYM = prove_by_refinement(
`!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y1 y3 y5 y4 y6 /\
P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5 /\
P y1 y2 y3 y4 y5 y6 = P y5 y4 y3 y2 y1 y6) ==>
((!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\
(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y6 y5 y4 y3 y2))`,
(* {{{ proof *)
[
BY(MESON_TAC[])
]);;
(* }}} *)
let REAL_WLOG_SIMPLEX_LEMMA2 = prove_by_refinement(
`!P (y1:real) (y4:real).
((!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\
(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y6 y5 y4 y3 y2))
/\
(! y2 y3 y5 y6. (y3 <= y2) /\ (y5 <= y2) /\ (y6 <= y2) ==>
P y1 y2 y3 y4 y5 y6) ==>
(!y2 y3 y5 y6. P y1 y2 y3 y4 y5 y6)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `?a. a
IN {y2,y3,y5,y6} /\ (!x. x
IN {y2,y3,y5,y6} ==> x <= a)` MP_TAC;
MATCH_MP_TAC
REAL_FINITE_MAX_EXISTS;
BY(BY(BY(REWRITE_TAC[
FINITE_INSERT ;
FINITE_EMPTY;
NOT_INSERT_EMPTY])));
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM_ST `
IN` MP_TAC);
REWRITE_TAC[
IN_INSERT;
NOT_IN_EMPTY];
REWRITE_TAC[MESON[] `(!x. x = y1 \/ x = y2 \/ x = y3 \/ x = y4 \/ x = y5 \/ x = y6 ==> x <= a) = (y1 <= a /\ y2 <= a /\ y3 <= a /\ y4 <= a /\ y5 <= a /\ y6 <= a)`];
BY(BY(BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[])))
]);;
(* }}} *)
let REAL_WLOG_SIMPLEX = prove_by_refinement(
`!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y1 y3 y5 y4 y6 /\
P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5 /\
P y1 y2 y3 y4 y5 y6 = P y5 y4 y3 y2 y1 y6) /\
(!y1 y2 y3 y4 y5 y6. (y6 <= y1) /\ (y5 <= y1) /\ (y4 <= y1) /\
(y3 <= y1) /\ (y2 <= y1) /\ (y3 <= y2) /\ (y5 <= y2) /\ (y6 <= y2) ==>
P y1 y2 y3 y4 y5 y6) ==>
(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`,
(* {{{ proof *)
[
GEN_TAC;
DISCH_TAC;
MATCH_MP_TAC
REAL_WLOG_SIMPLEX_LEMMA;
ASM_REWRITE_TAC[];
REPEAT GEN_TAC;
SUBGOAL_THEN `(y6 <= y1 /\ y5 <= y1 /\ y4 <= y1 /\ y3 <= y1 /\ y2 <= y1 ==> P y1 y2 y3 y4 y5 y6) = (\y1 y2 y3 y4 y5 y6. y6 <= y1 /\ y5 <= y1 /\ y4 <= y1 /\ y3 <= y1 /\ y2 <= y1 ==> P y1 y2 y3 y4 y5 y6) y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[]);
EVERY (map SPEC_TAC [(`y6:real`,`y6:real`);(`y5:real`,`y5:real`);(`y3:real`,`y3:real`);(`y2:real`,`y2:real`)]);
ABBREV_TAC `Q = (\y1 y2 y3 y4 y5 y6. y6 <= y1 /\ y5 <= y1 /\ y4 <= y1 /\ y3 <= y1 /\ y2 <= y1 ==> P y1 y2 y3 y4 y5 y6)`;
MATCH_MP_TAC
REAL_WLOG_SIMPLEX_LEMMA2;
CONJ_TAC;
REPEAT (FIRST_X_ASSUM MP_TAC);
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP
REAL_WLOG_SIMPLEX_SYM));
EXPAND_TAC "Q";
BY(ASM_MESON_TAC[]);
EXPAND_TAC "Q";
BY(ASM_MESON_TAC[])
]);;
(* }}} *)
let rad2_x_sym = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
rad2_x x1 x2 x3 x4 x5 x6 =
rad2_x x2 x1 x3 x5 x4 x6 /\
rad2_x x1 x2 x3 x4 x5 x6 =
rad2_x x1 x3 x2 x4 x6 x5 /\
rad2_x x1 x2 x3 x4 x5 x6 =
rad2_x x5 x4 x3 x2 x1 x6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.rad2_x];
REPEAT WEAK_STRIP_TAC;
BY(REPEAT CONJ_TAC THEN BINOP_TAC THEN REWRITE_TAC[Sphere.rho_x;Sphere.delta_x] THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
let ineq_critical_edge = prove_by_refinement(
`!u v y f.
~critical_edge_y y /\
ineq (
APPEND u (CONS (&2,y,&2 * hminus) v)) f /\
ineq (
APPEND u (CONS (&2 * hplus,y,sqrt8) v)) f ==>
ineq (
APPEND u (CONS (&2,y,sqrt8) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND;
critical_edge_y];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `&2 <= y /\ y <= sqrt8 ==> y <= &2 * hminus \/ &2 * hplus <= y` ASSUME_TAC;
FIRST_X_ASSUM_ST `~` MP_TAC;
REWRITE_TAC[Sphere.hplus];
MP_TAC Nonlinear_lemma.hminus_prop;
BY(REAL_ARITH_TAC);
REPEAT (FIRST_X_ASSUM MP_TAC);
BY(ASM_CASES_TAC `&2 <= y` THEN ASM_CASES_TAC `y <= sqrt8` THEN ASM_CASES_TAC `y <= &2 * hminus` THEN ASM_CASES_TAC `&2 * hplus <= y` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[]))
]);;
(* }}} *)
let ineq_branch_edge = prove_by_refinement(
`!c a b u v y f.
ineq (
APPEND u (CONS (a,y,c) v)) f /\
ineq (
APPEND u (CONS (c,y,b) v)) f ==>
ineq (
APPEND u (CONS (a,y,b) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
ASSUME_TAC (arith `y <= c \/ c <= y`);
REPEAT (FIRST_X_ASSUM MP_TAC);
BY(ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_CASES_TAC `y <= c` THEN ASM_CASES_TAC `c <= y` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[]))
]);;
(* }}} *)
let BRANCH_TAC n c =
CHOP_LIST_TAC n THEN
MATCH_MP_TAC (SPEC c ineq_branch_edge)
THEN REWRITE_TAC[APPEND];;
let CRIT_TAC n =
CHOP_LIST_TAC n THEN
MATCH_MP_TAC ( ineq_critical_edge)
THEN ASM_REWRITE_TAC[APPEND];;
let hminus_lt_hplus = prove_by_refinement(
`&2 * hminus < &2 * hplus`,
(* {{{ proof *)
[
ASM_MESON_TAC[arith `x < h0 /\ h0 < y ==> &2 * x < &2 * y` ; Nonlinear_lemma.hminus_lt_h0;Nonlinear_lemma.h0_lt_hplus;]
]);;
(* }}} *)
(* }}} *)
let real_ty = `:real`;;
let mk_y i = mk_var("y"^string_of_int i,real_ty);;
let ys = map mk_y (1--6);;
let [y1;y2;y3;y4;y5;y6] = ys;;
let TSKAJXY_DERIVED4 = prove_by_refinement(
tsk,
(* {{{ proof *)
[
REPEAT DISCH_TAC;
MP_TAC tsk_lemma1;
ASM_REWRITE_TAC[];
DISCH_TAC;
MATCH_MP_TAC REAL_WLOG_SIMPLEX;
REPEAT STRIP_TAC;
REWRITE_TAC[Sphere.ineq];
BY(MESON_TAC[delta_y_sym;rad2_y_sym;gamma4fgcy_sym12]);
REWRITE_TAC[Sphere.ineq];
BY(MESON_TAC[delta_y_sym;rad2_y_sym;gamma4fgcy_sym23]);
REWRITE_TAC[Sphere.ineq];
BY(MESON_TAC[delta_y_sym;rad2_y_sym;gamma4fgcy_sym03]);
REWRITE_TAC[Sphere.ineq];
REPLICATE_TAC 6 DISCH_TAC;
REPEAT WEAK_STRIP_TAC;
REPLICATE_TAC 6 (FIRST_X_ASSUM_ST `/\` MP_TAC);
REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6];
PROOF_BY_CONTR_TAC;
FIRST_X_ASSUM (BURY_TAC);
FIRST_X_ASSUM_ST `ineq` (BURY_TAC);
FIRST_X_ASSUM_ST `ineq` MP_TAC;
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `rad2_x` MP_TAC;
REWRITE_TAC[GSYM Sphere.rad2_y];
DISCH_THEN BURY_TAC;
FIRST_X_ASSUM_ST `mm1` (K ALL_TAC);
FIRST_X_ASSUM_ST `~ineq a b` MP_TAC;
REWRITE_TAC[];
REPEAT (FIRST_X_ASSUM MP_TAC);
REWRITE_TAC[arith `#2.0 = &2`];
REPEAT WEAK_STRIP_TAC;
CRIT_TAC 0;
CONJ_TAC;
CRIT_TAC 1;
ONCE_REWRITE_TAC[ (CONJ_SYM)];
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
BY(ASM_MESON_TAC[y1y2_lt]);
CRIT_TAC 2;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
BY(REWRITE_TAC[Sphere.ineq] THEN ASM_MESON_TAC[y1y2_lt]);
CRIT_TAC 4;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
BY(REWRITE_TAC[Sphere.ineq] THEN ASM_MESON_TAC[y1y2_lt]);
CRIT_TAC 5;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
BY(REWRITE_TAC[Sphere.ineq] THEN ASM_MESON_TAC[y1y2_lt]);
BRANCH_TAC 0 `#2.001`;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
FIRST_X_ASSUM_ST `(#2.001,y,t)` (fun t -> MP_TAC (ISPECL ys t));
ASM_SIMP_TAC[arith `b <= a ==> ~(a < b)`];
REWRITE_TAC[Sphere.ineq];
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
BY(REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `(&2,y,#2.001)` (fun t -> MP_TAC(ISPECL ys t));
REWRITE_TAC[Sphere.ineq];
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
BY(REAL_ARITH_TAC);
CRIT_TAC 1;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC);
REWRITE_TAC[Sphere.ineq];
DISCH_THEN (fun t -> MP_TAC (ISPECL ys t));
BY(REAL_ARITH_TAC);
CRIT_TAC 2;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC);
REWRITE_TAC[Sphere.ineq];
DISCH_THEN (fun t -> MP_TAC (ISPECL [y1;y3;y2;y4;y6;y5] t));
SUBGOAL_THEN `rad2_y y1 y3 y2 y4 y6 y5 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[rad2_y_sym]);
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
BY(REAL_ARITH_TAC);
CRIT_TAC 4;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC);
REWRITE_TAC[Sphere.ineq];
DISCH_THEN (fun t -> MP_TAC (ISPECL [y1;y5;y6;y4;y2;y3] t));
SUBGOAL_THEN `rad2_y y1 y5 y6 y4 y2 y3 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[rad2_y_sym]);
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
BY(REAL_ARITH_TAC);
CRIT_TAC 5;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC);
REWRITE_TAC[Sphere.ineq];
DISCH_THEN (fun t -> MP_TAC (ISPECL [y1;y6;y5;y4;y3;y2] t));
SUBGOAL_THEN `rad2_y y1 y6 y5 y4 y3 y2 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[rad2_y_sym]);
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
BY(REAL_ARITH_TAC);
CRIT_TAC 3;
FIRST_X_ASSUM_ST `ineq (CONS (&2,y,#2.001) v) u` (K ALL_TAC);
FIRST_X_ASSUM_ST `ineq (CONS (#2.001,y1,&2*hminus) v) u` (K ALL_TAC);
CONJ_TAC;
BRANCH_TAC 1 `#2.001`;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
FIRST_X_ASSUM_ST `#2.001` (fun t -> MP_TAC ( ISPECL ys t));
BY(ASM_SIMP_TAC[arith `b <= a ==> ~(a < b)`]);
FIRST_X_ASSUM_ST `(a,b,#2.001)` (MP_TAC o (ISPECL ys));
REWRITE_TAC[Sphere.ineq];
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
BY(REAL_ARITH_TAC);
REPEAT (FIRST_X_ASSUM_ST `#2.001` (K ALL_TAC));
BRANCH_TAC 1 `#2.01`;
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
FIRST_X_ASSUM_ST `(#2.01,a,b)` (MP_TAC o (ISPECL ys));
ASM_SIMP_TAC[arith `b <= a ==> ~(a < b)`];
REWRITE_TAC[Sphere.ineq];
BY(REAL_ARITH_TAC);
BRANCH_TAC 3 `#2.8`;
CONJ_TAC;
FIRST_X_ASSUM_ST `(a,b,#2.8)` (MP_TAC o (ISPECL ys));
REWRITE_TAC[Sphere.ineq];
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
BY(REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `(#2.8,a,b)` (MP_TAC o (ISPECL ys));
ASM_REWRITE_TAC[];
REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC);
REWRITE_TAC[Sphere.ineq];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
(* ========================================================================== *)
(* Merge "ZTGIJCF4" inequalities. The main result is ztg4. *)
(* ========================================================================== *)
let REAL_WLOG_SIMPLEX_LEMMA2_LE = prove_by_refinement(
`!P .
((!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\
(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y6 y5 y4 y3 y2))
/\
(!y1 y2 y3 y4 y5 y6. (y2 <= y3) /\ (y2 <= y5 ) /\ (y2 <= y6 ) ==>
P y1 y2 y3 y4 y5 y6) ==>
(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `?a. a
IN {y2,y3,y5,y6} /\ (!x. x
IN {y2,y3,y5,y6} ==> a <= x)` MP_TAC;
MATCH_MP_TAC
REAL_FINITE_MIN_EXISTS;
BY(BY(BY(REWRITE_TAC[
FINITE_INSERT ;
FINITE_EMPTY;
NOT_INSERT_EMPTY])));
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM_ST `
IN` MP_TAC);
REWRITE_TAC[
IN_INSERT;
NOT_IN_EMPTY];
REWRITE_TAC[MESON[] `(!x. x = y1 \/ x = y2 \/ x = y3 \/ x = y4 \/ x = y5 \/ x = y6 ==> a <= x) = (a <= y1 /\ a <= y2 /\ a <= y3 /\ a <= y4 /\ a <= y5 /\ a <= y6)`];
BY(BY(BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[])))
]);;
(* }}} *)
let beta_ub = prove_by_refinement(
`!h. bump h <= #0.005`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.bump];
GEN_TAC;
REWRITE_TAC[arith `a * (&1 - c) <= a <=> &0 <= a * c`];
MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2;
REWRITE_TAC[Calc_derivative.invert_den_le];
GMATCH_SIMP_TAC Real_ext.REAL_PROP_NN_MUL2;
REWRITE_TAC[
REAL_LE_POW_2];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let beta_lb = prove_by_refinement(
`!h. hminus <= h /\ h <= hplus ==> &0 <= bump h`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.bump];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2;
CONJ_TAC;
BY(REAL_ARITH_TAC);
MATCH_MP_TAC (arith `x <= y ==> &0 <= y - x`);
REWRITE_TAC[GSYM Trigonometry2.DIV_POW2];
REWRITE_TAC[
ABS_SQUARE_LE_1;Sphere.h0];
REPEAT( FIRST_X_ASSUM MP_TAC);
REWRITE_TAC[Sphere.hplus];
MP_TAC Nonlinear_lemma.hminus_prop;
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
(*
let beta_bump_y_lb = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6.
-- #0.005 <= beta_bump_y y1 y2 y3 y4 y5 y6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.beta_bump_y];
REPEAT WEAK_STRIP_TAC;
ASM_CASES_TAC `critical_edge_y y6` THEN ASM_CASES_TAC `critical_edge_y y4` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `-- #0.005 <= &0`];
ASM_CASES_TAC `critical_edge_y y2` THEN ASM_CASES_TAC `critical_edge_y y3` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `-- #0.005 <= &0`];
ASM_CASES_TAC `critical_edge_y y5` THEN ASM_CASES_TAC `critical_edge_y y1` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `-- #0.005 <= &0`];
REWRITE_TAC[arith `&1 * x = x`];
MATCH_MP_TAC (arith `&0 <= x /\ y <= #0.005 ==> -- #0.005 <= x - y`);
GMATCH_SIMP_TAC beta_lb;
REWRITE_TAC[beta_ub];
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
*)
let beta_sub = prove_by_refinement(
`!y1 y4.
critical_edge_y y1 /\
critical_edge_y y4 ==> -- #0.005 <= bump (y1 / &2) - bump( y4 / &2)`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.critical_edge_y];
REPEAT WEAK_STRIP_TAC;
ENOUGH_TO_SHOW_TAC `&0 <= bump (y1 / &2) /\ bump (y4 / &2) <= #0.005`;
BY(REAL_ARITH_TAC);
CONJ_TAC;
MATCH_MP_TAC
beta_lb;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
BY(REWRITE_TAC[
beta_ub])
]);;
(* }}} *)
let beta_bumpA_y_lb = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6.
-- #0.005 <=
beta_bumpA_y y1 y2 y3 y4 y5 y6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.beta_bumpA_y];
REPEAT WEAK_STRIP_TAC;
REPEAT (COND_CASES_TAC) THEN (TRY (REAL_ARITH_TAC));
REWRITE_TAC[arith `&1 * x = x`];
MATCH_MP_TAC
beta_sub;
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
(* }}} *)
let ineq_branch_2hmin = prove_by_refinement(
`! a b u v y f.
(a <= &2 * hminus) /\
((~critical_edge_y y) ==> ineq (
APPEND u (CONS (a,y, &2 * hminus) v)) f) /\
ineq (
APPEND u (CONS (&2 * hminus,y,b) v)) f ==>
ineq (
APPEND u (CONS (a,y,b) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND;Sphere.critical_edge_y];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
DISJ_CASES_TAC (arith `y < &2 * hminus \/ &2 * hminus <= y`);
FIRST_X_ASSUM_ST `hplus` MP_TAC;
ANTS_TAC;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
SUBGOAL_THEN `y <= &2 * hminus` ASSUME_TAC;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC);
BY((ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[])));
REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC);
(ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[]));
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let ineq_T = prove_by_refinement(
`!a. ineq a T`,
(* {{{ proof *)
[LIST_INDUCT_TAC;
BY(REWRITE_TAC[Sphere.ineq]);
SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC;
BY(BY(MESON_TAC[
PAIR_SURJECTIVE]));
WEAK_STRIP_TAC;
BY(ASM_REWRITE_TAC[Sphere.ineq])
]);;
(* }}} *)
let ineq_MP = prove_by_refinement(
`! b c a. ineq a (b==>c) ==> ineq a b ==> ineq a c`,
(* {{{ proof *)
[
REPLICATE_TAC 2 GEN_TAC;
LIST_INDUCT_TAC;
BY(REWRITE_TAC[Sphere.ineq]);
SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC;
BY(BY(BY(MESON_TAC[
PAIR_SURJECTIVE])));
WEAK_STRIP_TAC;
(ASM_REWRITE_TAC[Sphere.ineq]);
BY(ASM_MESON_TAC[])
]);;
(* }}} *)
let ineq_CONJ = prove_by_refinement(
`!b c a. ineq a b /\ ineq a c ==> ineq a (b /\ c)`,
(* {{{ proof *)
[
REPLICATE_TAC 2 GEN_TAC;
LIST_INDUCT_TAC;
BY(BY(REWRITE_TAC[Sphere.ineq]));
SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC;
BY(BY(BY(BY(MESON_TAC[
PAIR_SURJECTIVE]))));
WEAK_STRIP_TAC;
(ASM_REWRITE_TAC[Sphere.ineq]);
BY(BY(ASM_MESON_TAC[]))
]);;
(* }}} *)
let ineq_af = prove_by_refinement(
`!f a. f ==> ineq a f`,
(* {{{ proof *)
[
GEN_TAC;
LIST_INDUCT_TAC;
BY(BY(REWRITE_TAC[Sphere.ineq]));
SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC;
BY(BY(BY(BY(MESON_TAC[
PAIR_SURJECTIVE]))));
WEAK_STRIP_TAC;
(ASM_REWRITE_TAC[Sphere.ineq]);
BY(BY(ASM_MESON_TAC[]))
]);;
(* }}} *)
let ineq_monotone = prove_by_refinement(
`! f f' a. (f ==> f') ==> (ineq a f ==> ineq a f')`,
(* {{{ proof *)
[
GEN_TAC;
GEN_TAC;
LIST_INDUCT_TAC;
BY(REWRITE_TAC[Sphere.ineq]);
REWRITE_TAC[Sphere.ineq];
SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC;
BY(MESON_TAC[
PAIR_SURJECTIVE]);
WEAK_STRIP_TAC;
ASM_REWRITE_TAC[Sphere.ineq];
BY(ASM_MESON_TAC[])
]);;
(* }}} *)
(*
let ineq_approx_ztg4 = prove_by_refinement(
`!w' m a y1 y2 y3 y4 y5 y6.
gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' <=
gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &(wtcount6_y y1 y2 y3 y4 y5 y6) /\
&m * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6 /\
ineq a ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' + &m * beta_bump_lb >
a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/
(
(y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))) ==>
ineq a ( (rad2_y y1 y2 y3 y4 y5 y6 < &2) ==>
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun /
&(wtcount6_y y1 y2 y3 y4 y5 y6) +
beta_bump_y y1 y2 y3 y4 y5 y6 >
a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MP_TAC;
MATCH_MP_TAC ineq_monotone;
REWRITE_TAC[GSYM Sphere.rad2_y];
MATCH_MP_TAC (TAUT `(b ==> a ==> c) ==> (a ==> b ==> c)`);
DISCH_TAC;
ASM_SIMP_TAC[ (arith `x < &2 ==> ~(x > &2)`)];
MATCH_MP_TAC (arith `a' <= a /\ b' <= b ==> (a'+b' > c ==> a + b > c)`);
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
*)
(*
let ineq_approx_ztg4 = prove_by_refinement(
`!w' m a y1 y2 y3 y4 y5 y6.
ineq a (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' <=
gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &(wtcount6_y y1 y2 y3 y4 y5 y6) /\
&m * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6 /\
rad2_y y1 y2 y3 y4 y5 y6 < &2)
==>
(ineq a ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' + &m * beta_bump_lb >
a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/
rad2_y y1 y2 y3 y4 y5 y6 > &2 ) ==>
ineq a (
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun /
&(wtcount6_y y1 y2 y3 y4 y5 y6) +
beta_bump_y y1 y2 y3 y4 y5 y6 >
a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6)))`,
(* {{{ proof *)
[
REPEAT GEN_TAC;
DISCH_TAC;
MATCH_MP_TAC ineq_MP;
FIRST_X_ASSUM MP_TAC;
MATCH_MP_TAC ineq_MP;
ASM_SIMP_TAC[arith `x < &2 ==> ~(x > &2)`];
MATCH_MP_TAC ineq_af;
DISCH_TAC;
MATCH_MP_TAC (arith `a' <= a /\ b' <= b ==> (a'+b' > c ==> a + b > c)`);
BY(BY(BY(ASM_REWRITE_TAC[])))
]);;
(* }}} *)
*)
(* }}} *)
(*
let beta_bump_lb1 = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6. &1 * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6`,
(* {{{ proof *)
[
BY(REWRITE_TAC[beta_bump_y_lb;Sphere.beta_bump_lb;arith `&1 * x = x`])
]);;
(* }}} *)
*)
(* }}} *)
(*
let beta_bump_lb0 = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6.
(~critical_edge_y y1 \/ critical_edge_y y2 \/ critical_edge_y y3 \/ critical_edge_y y5 \/ critical_edge_y y6 \/ ~critical_edge_y y4)
==> &0 * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.beta_bump_y;arith `&0 * x = &0`];
REPEAT GEN_TAC;
DISCH_TAC;
ASM_CASES_TAC `critical_edge_y y6` THEN ASM_CASES_TAC `critical_edge_y y4` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`];
ASM_CASES_TAC `critical_edge_y y2` THEN ASM_CASES_TAC `critical_edge_y y3` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`];
ASM_CASES_TAC `critical_edge_y y5` THEN ASM_CASES_TAC `critical_edge_y y1` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`];
FIRST_X_ASSUM_ST `\/` MP_TAC;
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
*)
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
let quarter_norm2hh = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6. (norm2hh y1 y2 y3 y4 y5 y6 < (hplus- hminus) pow 2) ==>
critical_edge_y y1 /\ (y2 < &2 * hminus) /\ (y3 < &2*hminus) /\
(y4 < &2 * hminus) /\ (y5 < &2 * hminus) /\ (y6 < &2*hminus)`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.critical_edge_y;Sphere.norm2hh];
REPEAT GEN_TAC;
REWRITE_TAC[GSYM
CONJ_ASSOC];
MATCH_MP_TAC (TAUT `((~b) ==> ~a) ==> (a ==> b)`);
REWRITE_TAC[DE_MORGAN_THM;arith `(~(a < b) <=> (b <= a)) /\ (~(a <= b) <=> (b < a))`];
REPEAT STRIP_TAC;
MATCH_MP_TAC
quarter_lemma2;
REPEAT (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma3;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);
MATCH_MP_TAC
quarter_lemma2;
REPEAT (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma3;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);
MATCH_MP_TAC
quarter_lemma;
MATCH_MP_TAC
quarter_lemma2;
REPEAT (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma3;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);
REPLICATE_TAC 2 (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma2;
REPEAT (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma3;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);
REPLICATE_TAC 3 (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma2;
REPEAT (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma3;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);
REPLICATE_TAC 4 (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma2;
REPEAT (MATCH_MP_TAC
quarter_lemma);
MATCH_MP_TAC
quarter_lemma3;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);
REPLICATE_TAC 5 (MATCH_MP_TAC
quarter_lemma);
ONCE_REWRITE_TAC[arith `x <= y <=> x <= y + &0 pow 2`];
MATCH_MP_TAC
quarter_lemma2;
MATCH_MP_TAC
quarter_lemma3;
BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let gamma_wte = prove_by_refinement(
`!w' y1 y2 y3 y4 y5 y6.
(w' =
wtcount6_y y1 y2 y3 y4 y5 y6) ==>
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &w' <=
gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(
wtcount6_y y1 y2 y3 y4 y5 y6))`,
(* {{{ proof *)
[
REPEAT GEN_TAC;
DISCH_THEN SUBST1_TAC;
REWRITE_TAC[REAL_ARITH `x <= x`]
]);;
(* }}} *)
(* }}} *)
let gamma_wt = prove_by_refinement(
`!w' y1 y2 y3 y4 y5 y6.
(0 <
wtcount6_y y1 y2 y3 y4 y5 y6 /\
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) /\
wtcount6_y y1 y2 y3 y4 y5 y6 <= w'
) ==>
gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &(
wtcount6_y y1 y2 y3 y4 y5 y6)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[arith `a / b <= a /c <=> &0 <= a * (&1/c - &1/b)`];
MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2;
ASM_SIMP_TAC[arith `x > &0 ==> &0 <= x`];
REWRITE_TAC[arith `&0 <= x - y <=> y <= x`;
real_div;arith `&1 * x = x`];
MATCH_MP_TAC
REAL_LE_INV2;
BY(ASM_REWRITE_TAC[
REAL_OF_NUM_LT;REAL_OF_NUM_LE])
]);;
(* }}} *)
(* }}} *)
(*
let ztg4_concl =
Sphere.all_forall `ineq
[&2 * hminus,y1,&2 * hplus;
(&2,y2,sqrt8);
(&2,y3,sqrt8);
(&2,y4,sqrt8);
(&2,y5,sqrt8);
(&2,y6,sqrt8)]
(rad2_y y1 y2 y3 y4 y5 y6 < &2 ==>
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) +
beta_bump_y y1 y2 y3 y4 y5 y6 >
a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6))`;;
*)
let ztg4_concl =
Sphere.all_forall `ineq
[&2 * hminus,y1,&2 * hplus;
(&2,y2,sqrt8);
(&2,y3,sqrt8);
(&2,y4,sqrt8);
(&2,y5,sqrt8);
(&2,y6,sqrt8)]
(rad2_y y1 y2 y3 y4 y5 y6 < &2 ==>
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) +
beta_bumpA_y y1 y2 y3 y4 y5 y6 >
a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6))`;;
(* need to include beta ge betalb,
Uses gamma >= 0, when not a quarter, so throw that in, and that uses rad *)
(*
let ztg4_hyp =
let ztgs =
["GLFVCVK4 2477216213";"MKFKQWU halfwt";"MKFKQWU";
"ZTGIJCF4 1 1 1 1 1821661595"; "ZTGIJCF4 1 1 1 0 1821661595";
"ZTGIJCF4 1 1 0 1 1821661595"; "ZTGIJCF4 1 1 0 0 1821661595";
"ZTGIJCF4 1 0 1 1 1821661595"; "ZTGIJCF4 1 0 1 0 1821661595";
"ZTGIJCF4 1 0 0 1 1821661595"; "ZTGIJCF4 1 0 0 0 1821661595";
"ZTGIJCF4 0 1 1 1 1821661595"; "ZTGIJCF4 0 1 1 0 1821661595";
"ZTGIJCF4 0 1 0 1 1821661595"; "ZTGIJCF4 0 1 0 0 1821661595";
"ZTGIJCF4 0 0 1 1 1821661595"; "ZTGIJCF4 0 0 1 0 1821661595";
"ZTGIJCF4 0 0 0 1 1821661595"; "ZTGIJCF4 0 0 0 0 1821661595"] in
let ztg_nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) ztgs in
end_itlist (curry mk_conj) ztg_nonlinear;;
*)
(*
let ztg4_concl' =
mk_imp(ztg4_hyp,ztg4_concl);;
*)
let ztg4_ineqs = ["GLFVCVK4 2477216213";"MKFKQWU halfwt";"MKFKQWU";
"ZTGIJCF4 1 1 1 1 1821661595"; "ZTGIJCF4 1 1 1 0 1821661595";
"ZTGIJCF4 1 1 0 1 1821661595"; "ZTGIJCF4 1 1 0 0 1821661595";
"ZTGIJCF4 1 0 1 1 1821661595"; "ZTGIJCF4 1 0 1 0 1821661595";
"ZTGIJCF4 1 0 0 1 1821661595"; "ZTGIJCF4 1 0 0 0 1821661595";
"ZTGIJCF4 0 1 1 1 1821661595"; "ZTGIJCF4 0 1 1 0 1821661595";
"ZTGIJCF4 0 1 0 1 1821661595"; "ZTGIJCF4 0 1 0 0 1821661595";
"ZTGIJCF4 0 0 1 1 1821661595"; "ZTGIJCF4 0 0 1 0 1821661595";
"ZTGIJCF4 0 0 0 1 1821661595"; "ZTGIJCF4 0 0 0 0 1821661595"];;
let ztg4_concl' =
add_hyp ztg4_ineqs ztg4_concl;;
(* let skip_prove_by_refinement(a,b) = ASSUME a;; *)
let ztg4 = prove_by_refinement(
ztg4_concl',
(* {{{ proof *)
[
DISCH_TAC;
MATCH_MP_TAC REAL_WLOG_SIMPLEX_LEMMA2_LE;
CONJ_TAC;
CONJ_TAC;
REPEAT GEN_TAC;
SUBGOAL_THEN `rad2_y y1 y3 y2 y4 y6 y5 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(BY(MESON_TAC[rad2_y_sym]));
SUBGOAL_THEN `beta_bumpA_y y1 y3 y2 y4 y6 y5 = beta_bumpA_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(BY(REWRITE_TAC[Sphere.beta_bumpA_y;REAL_MUL_AC]));
SUBGOAL_THEN `wtcount6_y y1 y3 y2 y4 y6 y5 = wtcount6_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
BY(BY(REWRITE_TAC[ADD_AC]));
SUBGOAL_THEN `dih_y y1 y3 y2 y4 y6 y5 = dih_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF];
BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]));
SUBGOAL_THEN `gamma4fgcy y1 y3 y2 y4 y6 y5 lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun` SUBST1_TAC;
BY(BY(MESON_TAC[gamma4fgcy_sym12;gamma4fgcy_sym23;gamma4fgcy_sym03;]));
REWRITE_TAC[Sphere.ineq];
BY(BY(MESON_TAC[]));
REPEAT GEN_TAC;
SUBGOAL_THEN `rad2_y y1 y6 y5 y4 y3 y2 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(BY(MESON_TAC[rad2_y_sym]));
SUBGOAL_THEN `beta_bumpA_y y1 y6 y5 y4 y3 y2 = beta_bumpA_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(BY(REWRITE_TAC[Sphere.beta_bumpA_y;REAL_MUL_AC]));
SUBGOAL_THEN `wtcount6_y y1 y6 y5 y4 y3 y2 = wtcount6_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
BY(BY(REWRITE_TAC[ADD_AC]));
SUBGOAL_THEN `dih_y y1 y6 y5 y4 y3 y2 = dih_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF];
BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]));
SUBGOAL_THEN `gamma4fgcy y1 y6 y5 y4 y3 y2 lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun` SUBST1_TAC;
BY(BY(MESON_TAC[gamma4fgcy_sym12;gamma4fgcy_sym23;gamma4fgcy_sym03;]));
REWRITE_TAC[Sphere.ineq];
BY(BY(MESON_TAC[]));
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[GSYM Sphere.rad2_y];
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT DISCH_TAC;
REPEAT (FIRST_X_ASSUM_ST `/\` MP_TAC);
REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6];
REWRITE_TAC[Sphere.ineq];
REPEAT DISCH_TAC;
SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC;
BY(ASM_SIMP_TAC[critical_y_range]);
REPLICATE_TAC 6 (FIRST_X_ASSUM_ST `/\` MP_TAC);
REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6];
FIRST_X_ASSUM_ST `gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0` (MP_TAC o (ISPECL ys));
ASM_REWRITE_TAC[];
DISCH_TAC;
REWRITE_TAC[Sphere.ineq];
REPLICATE_TAC 6 (DISCH_THEN (COMBINE_TAC BURY_TAC ASSUME_TAC));
REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC);
REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6];
PROOF_BY_CONTR_TAC;
FIRST_X_ASSUM_ST `rad2_y` MP_TAC;
ASM_REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[arith `x < &2 ==> ~(x > &2)`];
DISCH_TAC;
SUBGOAL_THEN `(&2*hminus <= y3 \/ &2 * hminus <= y4 \/ &2 * hminus <= y5 \/ &2*hminus <= y6 ==> gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0)` ASSUME_TAC;
FIRST_X_ASSUM MP_TAC;
BY(MESON_TAC[quarter_norm2hh;arith `x <= y <=> ~(y < x)`]);
FIRST_X_ASSUM_ST `~` MP_TAC;
REWRITE_TAC[];
CHOP_LIST_TAC 1;
MATCH_MP_TAC ineq_branch_2hmin;
REWRITE_TAC[APPEND;hmin22];
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
FIRST_X_ASSUM_ST `rad2_y` MP_TAC;
FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL ys t ));
REPEAT (FIRST_X_ASSUM_ST `a <= b` MP_TAC);
REWRITE_TAC[Sphere.ineq];
BY(REAL_ARITH_TAC);
DISCH_TAC;
SUBGOAL_THEN `~(rad2_y y1 y2 y3 y4 y5 y6 > &2)` ASSUME_TAC;
FIRST_X_ASSUM_ST `rad2_y` MP_TAC;
BY(REAL_ARITH_TAC);
COMMENT" start on branch with y4 ";
CHOP_LIST_TAC 3;
MATCH_MP_TAC ineq_branch_2hmin;
REWRITE_TAC[hmin22;APPEND];
ONCE_REWRITE_TAC[CONJ_SYM];
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPLICATE_TAC 3 DISCH_TAC;
DISCH_THEN (COMBINE_TAC BURY_TAC ASSUME_TAC);
REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC);
REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6];
SUBGOAL_THEN `(y3 <= &2 * hplus /\ y5 <= &2 * hplus /\ y6 <= &2 * hplus)` MP_TAC THEN REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` BURY_TAC;
CONJ_TAC;
MATCH_MP_TAC (arith `~(x <= y3) ==> (y3 <= x)`);
DISCH_TAC;
FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL [y1;y3;y2;y4;y6;y5] t));
REWRITE_TAC[Sphere.ineq];
ASM_REWRITE_TAC[];
SUBGOAL_THEN `rad2_y y1 y3 y2 y4 y6 y5 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[rad2_y_sym]);
BY(ASM_REWRITE_TAC[]);
CONJ_TAC;
MATCH_MP_TAC (arith `~(x <= y3) ==> (y3 <= x)`);
DISCH_TAC;
FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL [y1;y5;y6;y4;y2;y3] t));
REWRITE_TAC[Sphere.ineq];
ASM_REWRITE_TAC[];
SUBGOAL_THEN `rad2_y y1 y5 y6 y4 y2 y3 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[rad2_y_sym]);
BY(ASM_REWRITE_TAC[]);
MATCH_MP_TAC (arith `~(x <= y3) ==> (y3 <= x)`);
DISCH_TAC;
FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL [y1;y6;y5;y4;y3;y2] t));
REWRITE_TAC[Sphere.ineq];
ASM_REWRITE_TAC[];
SUBGOAL_THEN `rad2_y y1 y6 y5 y4 y3 y2 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[rad2_y_sym]);
BY(ASM_REWRITE_TAC[]);
COMMENT "2nd rad ineq here";
CHOP_LIST_TAC 2 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 4 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 5 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN FIRST_X_ASSUM (fun t -> (MP_TAC (SPECL ys t) THEN MATCH_MP_TAC ineq_approxA_ztg4));
COMMENT " 1st case ";
ASM_REWRITE_TAC[Sphere.ineq;beta_bumpA_lb1];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC `y4:real` critical_edge_bound);
BY(ARITH_TAC);
COMMENT " 2nd case ";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y4 critical_edge_bound);
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
COMMENT " 3rd case ";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y4 critical_edge_bound);
MP_TAC (ISPEC y5 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
COMMENT " 4th case ";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y4 critical_edge_bound);
MP_TAC (ISPEC y5 critical_edge_bound);
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
COMMENT " 5th case ";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
MP_TAC (ISPEC y4 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
COMMENT "6th case";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
MP_TAC (ISPEC y4 critical_edge_bound);
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
COMMENT "7th case";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
MP_TAC (ISPEC y4 critical_edge_bound);
MP_TAC (ISPEC y5 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
COMMENT "8th case";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
MP_TAC (ISPEC y4 critical_edge_bound);
MP_TAC (ISPEC y5 critical_edge_bound);
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
DISCH_TAC;
CHOP_LIST_TAC 2 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 4 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 5 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN FIRST_X_ASSUM (fun t -> (MP_TAC (SPECL ys t) THEN MATCH_MP_TAC ineq_approxA_ztg4));
COMMENT "1st' case";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wte;
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_SIMP_TAC[critical_y_range]);
COMMENT "2nd' case";
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_CONJ;
CONJ_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt;
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC beta_bumpA_lb0;
BY(ASM_REWRITE_TAC[]);
COMMENT "3rd' case";
ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y5 critical_edge_bound);
BY(ARITH_TAC);
BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]);
COMMENT "4th' case";
ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y5 critical_edge_bound);
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]);
COMMENT "5th' case";
ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
BY(ARITH_TAC);
BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]);
COMMENT "6th' case";
ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]);
COMMENT "7th' case";
ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
MP_TAC (ISPEC y5 critical_edge_bound);
BY(ARITH_TAC);
BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]);
COMMENT "8th' case";
ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
MP_TAC (ISPEC y3 critical_edge_bound);
MP_TAC (ISPEC y5 critical_edge_bound);
MP_TAC (ISPEC y6 critical_edge_bound);
BY(ARITH_TAC);
BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[])
]);;
(* }}} *)
let ztg4_ALT = prove_by_refinement(
`pack_nonlinear_non_ox3q1h ==>
!y1 y2 y3 y4 y5 y6.
ineq
[&2 * hminus,y1,&2 * hplus; &2,y2,sqrt8; &2,y3,sqrt8; &2,y4,sqrt8;
&2,
y5,
sqrt8; &2,y6,sqrt8]
(
rad2_y y1 y2 y3 y4 y5 y6 < &2
==> gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun /
&(
wtcount6_y y1 y2 y3 y4 y5 y6) +
beta_bumpA_y y1 y2 y3 y4 y5 y6 >
a_spine5 +
b_spine5 *
dih_y y1 y2 y3 y4 y5 y6)`,
(* {{{ proof *)
[
REPEAT WEAKER_STRIP_TAC;
MP_TAC ztg4;
ANTS_TAC;
BY(ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ztg4_ineqs));
BY(DISCH_THEN (unlist REWRITE_TAC))
]);;
(* }}} *)
(* ========================================================================== *)
(* lindih inequalities *)
(* ========================================================================== *)
(* }}} *)
(* }}} *)
let lindihpi_lt = prove_by_refinement(
`!u x1 x2 x3 x4 x5 x6. abs u < pi/ & 2 /\
&0 < x1 /\
delta_x4 x1 x2 x3 x4 x5 x6 < &0 ==> (
dih_x x1 x2 x3 x4 x5 x6 <
pi - u <=>
--
tan(u) *
delta_x4 x1 x2 x3 x4 x5 x6 <
sqrt(&4 * x1 *
delta_x x1 x2 x3 x4 x5 x6)
)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.dih_x;
LET_DEF;
LET_END_DEF];
GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < y ==> atn2(x,y) = (pi/ &2) -
atn(x/y)`);
ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`;arith `
pi / &2 + (pi/ &2) - x =
pi - x`];
ABBREV_TAC `t = --tan u *
delta_x4 x1 x2 x3 x4 x5 x6 <
sqrt (&4 * x1 *
delta_x x1 x2 x3 x4 x5 x6)`;
REWRITE_TAC[arith `
pi - t <
pi - u <=> u < t`];
GMATCH_SIMP_TAC (GSYM
TAN_MONO_LT_EQ);
REWRITE_TAC[
ATN_TAN;
ATN_BOUNDS];
CONJ_TAC;
FIRST_X_ASSUM_ST `abs` MP_TAC;
BY(BY(REAL_ARITH_TAC));
GMATCH_SIMP_TAC
REAL_LT_RDIV_EQ;
ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`];
EXPAND_TAC "t";
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let lindihpi_gt = prove_by_refinement(
`!u x1 x2 x3 x4 x5 x6. abs u < pi/ & 2 /\
&0 < x1 /\
delta_x4 x1 x2 x3 x4 x5 x6 < &0 ==> (
pi - u <
dih_x x1 x2 x3 x4 x5 x6 <=>
(
sqrt(&4 * x1 *
delta_x x1 x2 x3 x4 x5 x6) < --
tan(u) *
delta_x4 x1 x2 x3 x4 x5 x6
))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.dih_x;
LET_DEF;
LET_END_DEF];
GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < y ==> atn2(x,y) = (pi/ &2) -
atn(x/y)`);
ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`;arith `
pi / &2 + (pi/ &2) - x =
pi - x`];
ABBREV_TAC `t =
sqrt (&4 * x1 *
delta_x x1 x2 x3 x4 x5 x6) < --tan u *
delta_x4 x1 x2 x3 x4 x5 x6`;
REWRITE_TAC[arith `
pi - t <
pi - u <=> u < t`];
GMATCH_SIMP_TAC (GSYM
TAN_MONO_LT_EQ);
REWRITE_TAC[
ATN_TAN;
ATN_BOUNDS];
CONJ_TAC;
FIRST_X_ASSUM_ST `abs` MP_TAC;
BY(BY(BY(REAL_ARITH_TAC)));
GMATCH_SIMP_TAC
REAL_LT_LDIV_EQ;
ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`];
EXPAND_TAC "t";
BY(BY(REAL_ARITH_TAC))
]);;
(* }}} *)
(* }}} *)
let lindihpi_lt_y = prove_by_refinement(
`!a y1 y2 y3 y4 y5 y6.
&0 < y1 /\
&0 < a /\
&0 <
delta_y y1 y2 y3 y4 y5 y6 /\
delta4_y y1 y2 y3 y4 y5 y6 < &0 ==>
(
dih_y y1 y2 y3 y4 y5 y6 <
pi -
atn a <=>
a pow 2 *
delta4_squared_y y1 y2 y3 y4 y5 y6 < &4 *
x1_delta_y y1 y2 y3 y4 y5 y6
)`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.delta_y;Sphere.delta4_y;Sphere.dih_y;
LET_DEF;
LET_END_DEF;Sphere.delta4_squared_y;Sphere.x1_delta_y;Sphere.y_of_x;Sphere.delta4_squared_x;Sphere.x1_delta_x];
REPEAT WEAKER_STRIP_TAC;
INTRO_TAC
lindihpi_lt [`
atn a`;`y1 * y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`];
ASM_REWRITE_TAC[
ATN_BOUND];
ANTS_TAC;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
BY(ASM_REWRITE_TAC[]);
REWRITE_TAC[
ATN_TAN];
DISCH_THEN SUBST1_TAC;
TYPED_ABBREV_TAC `s = (&4 * (y1 * y1) *
delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))` ;
TYPIFY `&0 < s` (C SUBGOAL_THEN ASSUME_TAC);
EXPAND_TAC "s";
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
REWRITE_TAC[arith `&0 < &4`];
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
BY(ASM_REWRITE_TAC[]);
TYPIFY `!d. (d < s <=> d < sqrt s pow 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC));
BY(ASM_SIMP_TAC[SQRT_POW_2;arith `&0 < s ==> &0 <= s`]);
REWRITE_TAC[arith `a pow 2 * d pow 2 = ( a * -- d) pow 2`];
GMATCH_SIMP_TAC (GSYM Collect_geom2.LT_POW2_EQ_LT);
REWRITE_TAC[arith `-- a * d = a * --d`];
CONJ2_TAC;
GMATCH_SIMP_TAC REAL_LT_RSQRT;
BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC);
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let lindihpi_gt_y = prove_by_refinement(
`!a y1 y2 y3 y4 y5 y6.
&0 < y1 /\
&0 < a /\
&0 <
delta_y y1 y2 y3 y4 y5 y6 /\
delta4_y y1 y2 y3 y4 y5 y6 < &0 ==>
(
pi -
atn a <
dih_y y1 y2 y3 y4 y5 y6 <=>
&4 *
x1_delta_y y1 y2 y3 y4 y5 y6 < a pow 2 *
delta4_squared_y y1 y2 y3 y4 y5 y6
)`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.delta_y;Sphere.delta4_y;Sphere.dih_y;
LET_DEF;
LET_END_DEF;Sphere.delta4_squared_y;Sphere.x1_delta_y;Sphere.y_of_x;Sphere.delta4_squared_x;Sphere.x1_delta_x];
REPEAT WEAKER_STRIP_TAC;
INTRO_TAC
lindihpi_gt [`
atn a`;`y1 * y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`];
ASM_REWRITE_TAC[
ATN_BOUND];
ANTS_TAC;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
BY(ASM_REWRITE_TAC[]);
REWRITE_TAC[
ATN_TAN];
DISCH_THEN SUBST1_TAC;
TYPED_ABBREV_TAC `s = (&4 * (y1 * y1) *
delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))` ;
TYPIFY `&0 < s` (C SUBGOAL_THEN ASSUME_TAC);
EXPAND_TAC "s";
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
REWRITE_TAC[arith `&0 < &4`];
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
BY(ASM_REWRITE_TAC[]);
TYPIFY `!d. (s < d <=> sqrt s pow 2 < d)` (C SUBGOAL_THEN (unlist REWRITE_TAC));
BY(ASM_SIMP_TAC[SQRT_POW_2;arith `&0 < s ==> &0 <= s`]);
REWRITE_TAC[arith `a pow 2 * d pow 2 = ( a * -- d) pow 2`];
GMATCH_SIMP_TAC (GSYM Collect_geom2.LT_POW2_EQ_LT);
REWRITE_TAC[arith `-- a * d = a * --d`];
CONJ_TAC;
GMATCH_SIMP_TAC REAL_LT_RSQRT;
BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC);
GMATCH_SIMP_TAC REAL_LT_MUL_EQ;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(* ========================================================================== *)
(* 3-cell inequality: gamma3f is non-negative. Also 1-cell and 2-cells *)
(* ========================================================================== *)
let cell_3_delta_x_eta_x = prove_by_refinement(
`!x4 x5 x6. (&0 < x4) /\ (&0 < x5) /\ (&0 < x6) /\ (&0 <
ups_x x4 x5 x6) ==>
((&0 <
delta_x (&2) (&2) (&2) x4 x5 x6) <=> (
eta_x x4 x5 x6 < sqrt2))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[
delta_delta_x];
REWRITE_TAC[GSYM
delta_delta_x;Collect_geom.DELTA_RRR_INTERPRETE;Sphere.eta_x];
REWRITE_TAC[Sphere.sqrt2];
GMATCH_SIMP_TAC
SQRT_MONO_LT_EQ;
GMATCH_SIMP_TAC
REAL_LT_LDIV_EQ;
ASM_REWRITE_TAC[ arith `&0 <= &2`];
CONJ2_TAC;
REWRITE_TAC[Sphere.ups_x];
BY(REAL_ARITH_TAC);
MATCH_MP_TAC
REAL_LE_DIV;
ASM_SIMP_TAC[ arith `&0 < x ==> &0 <= x`];
MATCH_MP_TAC (arith `&0 < x ==> &0 <= x`);
BY(REPEAT (MATCH_MP_TAC
REAL_LT_MUL THEN ASM_REWRITE_TAC[]))
]);;
(* }}} *)
let lmfun_h0cut = prove_by_refinement(
`!y. lmfun (y / &2) = lfun (y / &2) * h0cut y `,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.lmfun;Sphere.lfun;Sphere.h0cut];
GEN_TAC;
ASSUME_TAC (arith `y <= &2 * h0 <=> (y / &2 <= h0)`);
COND_CASES_TAC;
BY(ASM_SIMP_TAC[arith `x * &1 = x`]);
BY(ASM_MESON_TAC[ arith `x * &0 = &0`])
]);;
(* }}} *)
let ups_x_cell3 = prove_by_refinement(
`!y. &0 < y /\ y < &2 *
sqrt(&2) ==> &0 <
ups_x (&2) (&2) (y *y)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC [ GSYM Nonlinear_lemma.sqrt2_sqrt2 ];
MATCH_MP_TAC
TRI_UPS_X_STRICT_POS;
REWRITE_TAC[Sphere.sqrt2];
ASM_SIMP_TAC[arith `x + x = &2* x`;arith `&0 < x ==> &0 <= x`];
ASM_SIMP_TAC[arith `&0 < x ==> u < x + u /\ u < u + x`];
GMATCH_SIMP_TAC
SQRT_POS_LT;
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let UPS_X_POS = prove_by_refinement(
`!y1 y2 y3. &2 <= y1 /\ y1 < &4 /\ &2 <= y2 /\ y2 < &4 /\
&2 <= y3 /\ y3 < &4 ==> &0 <
ups_x (y1*y1) (y2*y2) (y3*y3)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC
TRI_UPS_X_STRICT_POS;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(* }}} *)
let delta_xrrr_ups_x = prove_by_refinement(
`!x4 x5 x6 r2. &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ &0 < r2 /\
&0 <
delta_x r2 r2 r2 x4 x5 x6 ==> &0 <
ups_x x4 x5 x6`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[GSYM
delta_delta_x];
REWRITE_TAC[Collect_geom.DELTA_RRR_INTERPRETE];
DISCH_TAC;
SUBGOAL_THEN `&0 < r2 *
ups_x x4 x5 x6` ASSUME_TAC;
MATCH_MP_TAC (
REAL_LT_TRANS);
EXISTS_TAC `x6 * x5 * x4`;
CONJ_TAC;
BY(ASM_MESON_TAC[
REAL_LT_MUL ]);
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[Sphere.ups_x];
BY(REAL_ARITH_TAC);
BY(ASM_MESON_TAC[
REAL_LT_MUL_EQ])
]);;
(* }}} *)
let eulerA_x_pos = prove_by_refinement(
`!x4 x5 x6.
&4 <= x4 /\ &4 <= x5 /\ x6 <= &16 ==>
&0 <
eulerA_x (&2) x4 x5 x6 (&2) (&2)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.eulerA_x;arith `&2 + x - &2 = x`];
MATCH_MP_TAC (arith `&0 < x /\ &0 <= y ==> &0 < x + y`);
CONJ_TAC;
(MATCH_MP_TAC
REAL_LT_MUL);
GMATCH_SIMP_TAC
SQRT_POS_LT;
GMATCH_SIMP_TAC
REAL_LT_MUL;
GMATCH_SIMP_TAC
SQRT_POS_LT;
GMATCH_SIMP_TAC
SQRT_POS_LT;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
MATCH_MP_TAC (arith `&0 <= x * y + u * v + a * b ==> &0 <= x * y / &2 + u * v / &2 + a * b / &2`);
(unlist REWRITE_TAC) (REAL_RING `a * (x4 + x5 - x6) + b * x5 + c * x4 = a * (x4 - &4) + a * (x5 - &4) + a * (&16 - x6) - a * &8 + b * (x5 - &4) + c * (x4 - &4) + &4 * (b + c)`);
MATCH_MP_TAC (arith `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= e /\ &0 <= f /\ &0 <= -- d + q ==> &0 <= a + b + c - d + e + f + q`);
SUBGOAL_THEN `&0 <=
sqrt (&2)` ASSUME_TAC;
GMATCH_SIMP_TAC
SQRT_POS_LE;
BY(REAL_ARITH_TAC);
SUBGOAL_THEN `&0 <=
sqrt x4 /\ &0 <=
sqrt x5` MP_TAC;
GMATCH_SIMP_TAC
SQRT_POS_LE;
GMATCH_SIMP_TAC
SQRT_POS_LE;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
REPEAT WEAK_STRIP_TAC;
REPLICATE_TAC 5 (CONJ_TAC THENL[MATCH_MP_TAC
REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC;ALL_TAC]);
MATCH_MP_TAC (arith `a <= b /\ a <= c ==> &0 <= -- (a * &8) + &4 * (b + c)`);
GMATCH_SIMP_TAC
SQRT_MONO_LE_EQ;
GMATCH_SIMP_TAC
SQRT_MONO_LE_EQ;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(* }}} *)
(* }}} *)
let gamma3f_gamma3f_x_div_sqrtdelta_WEAK = prove_by_refinement(
`!y4 y5 y6 a b c.
&0 < y4 /\ &0 < y5 /\ &0 < y6 /\
y4 < &2 *
sqrt(&2) /\ y5 < &2 *
sqrt(&2) /\ y6 < &2 *
sqrt(&2) /\
&0 <
ups_x (y4 * y4) (y5 * y5) (y6 *y6) /\
&0 <
delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6) /\
&0 <
eulerA_x (&2) (y4 *y4) (y5*y5) (y6*y6) (&2) (&2) /\
&0 <
eulerA_x (&2) (y6*y6) (y4 *y4) (y5*y5) (&2) (&2) /\
&0 <
eulerA_x (&2) (y5*y5) (y6*y6) (y4 *y4) (&2) (&2) /\
&0 <
delta_x4 (y6 * y6) (&2) (y5 * y5) (&2) (y4 * y4) (&2) /\
&0 <
delta_x4 (y5 * y5) (&2) (y4 * y4) (&2) (y6 * y6) (&2) /\
&0 <
delta_x4 (y4 * y4) (&2) (y6 * y6) (&2) (y5 * y5) (&2)
==>
(gamma3f y4 y5 y6 sqrt2 lmfun =
gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6)
a b c (y4*y4) (y5*y5) (y6*y6) *
sqrt(
delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6)))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.gamma3f; Functional_equation.nonf_gamma3f_x_div_sqrtdelta;Sphere.vol3r;Sphere.vol3f;Sphere.vol_y;Sphere.y_of_x;Sphere.vol_x];
ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx ; arith `&0 < x ==> &0 <= x`;arith `y * #0.5 = y / &2`;GSYM
lmfun_h0cut];
REWRITE_TAC[Sphere.dih_y;
sol_y_sol_x ;
LET_END_DEF;
LET_DEF; Nonlinear_lemma.sqrt2_sqrt2];
SUBGOAL_THEN `!x y z.
dih_x x y (&2) (&2) (&2) z =
dih_x x (&2) z (&2) y (&2)` (unlist REWRITE_TAC);
BY(MESON_TAC[Nonlinear_lemma.dih_x_sym2;Nonlinear_lemma.dih_x_sym]);
SUBGOAL_THEN `!x y z.
sol_x x y (&2) (&2) (&2) z =
sol_x y (&2) x (&2) z (&2)` (unlist REWRITE_TAC);
BY(MESON_TAC[
sol_x_sym;
sol_x_sym2]);
REPEAT (GMATCH_SIMP_TAC
sol_x_sol_euler_x);
REPEAT (GMATCH_SIMP_TAC
sol_x_sol_x_sqrtdelta);
REPEAT (GMATCH_SIMP_TAC
dih_x_dih_x_div_sqrtdelta_posbranch);
SUBGOAL_THEN `!x4 x5 x6.
delta_x x4 (&2) x5 (&2) x6 (&2) =
delta_x (&2) (&2) (&2) x4 x5 x6` (unlist REWRITE_TAC);
BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC);
SUBGOAL_THEN `
delta_x (&2) (&2) (&2) (y5 * y5) (y4 * y4) (y6 * y6) =
delta_x (&2) (&2) (&2) (y4 *y4) (y5*y5) (y6*y6) ` SUBST1_TAC;
BY(MESON_TAC[
delta_x_sym]);
SUBGOAL_THEN `
delta_x (&2) (&2) (&2) (y6 *y6) (y5 * y5) (y4 * y4) =
delta_x (&2) (&2) (&2) (y4 *y4) (y5*y5) (y6*y6) ` SUBST1_TAC;
BY(MESON_TAC[
delta_x_sym]);
SUBGOAL_THEN `
delta_x (&2) (&2) (&2) (y4 * y4) (y6 *y6) (y5 * y5) =
delta_x (&2) (&2) (&2) (y4 *y4) (y5*y5) (y6*y6) ` SUBST1_TAC;
BY(MESON_TAC[
delta_x_sym]);
REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`];
CONJ2_TAC;
BY(REAL_ARITH_TAC);
REWRITE_TAC[TAUT `(a /\ b) /\ c <=> a /\ b /\ c`];
ASM_SIMP_TAC[
REAL_LT_MUL ; arith `&0 < &2`;arith `&0 < x ==> &0 <= x`];
SUBGOAL_THEN `!x.
ups_x x (&2) (&2) =
ups_x (&2) (&2) x /\
ups_x (&2) x (&2) =
ups_x (&2) (&2) x` (unlist REWRITE_TAC);
BY(MESON_TAC[ Collect_geom.UPS_X_SYM ]);
REPEAT (GMATCH_SIMP_TAC
ups_x_cell3);
ASM_REWRITE_TAC[];
ONCE_REWRITE_TAC[
ups_x_sym];
ASM_REWRITE_TAC[];
SUBGOAL_THEN ` &0 <
ups_x (y6 * y6) (y4 * y4) (y5 * y5) ` (unlist REWRITE_TAC);
BY(ASM_MESON_TAC[ Collect_geom.UPS_X_SYM]);
SUBGOAL_THEN `&0 <
ups_x (y5 * y5) (y6 * y6) (y4 * y4)` (unlist REWRITE_TAC);
BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]);
BY(ASM_MESON_TAC[
eulerA_x_sym])
]);;
(* }}} *)
let gamma3f_gamma3f_x_div_sqrtdelta_WEAK2 = prove_by_refinement(
`!y4 y5 y6 a b c.
&2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\
y4 < &2 *
sqrt(&2) /\ y5 < &2 *
sqrt(&2) /\ y6 < &2 *
sqrt(&2) /\
eta_x (y4*y4) (y5*y5) (y6*y6) <
sqrt(&2)
==>
(gamma3f y4 y5 y6 sqrt2 lmfun =
gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6)
a b c (y4*y4) (y5*y5) (y6*y6) *
sqrt(
delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6)))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC
gamma3f_gamma3f_x_div_sqrtdelta_WEAK;
ASM_SIMP_TAC[arith `&2 <= x ==> &0 < x`];
SUBCONJ_TAC;
MATCH_MP_TAC
UPS_X_POS;
SUBGOAL_THEN `!x. x < &2 *
sqrt (&2) ==> x < &4` ASSUME_TAC;
GEN_TAC;
MATCH_MP_TAC (arith `b < c ==> (x < b ==> x < c)`);
MP_TAC Flyspeck_constants.bounds;
REWRITE_TAC[Sphere.sqrt2];
BY(REAL_ARITH_TAC);
BY(ASM_SIMP_TAC[]);
DISCH_TAC;
SUBCONJ_TAC;
GMATCH_SIMP_TAC
cell_3_delta_x_eta_x;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
ASM_REWRITE_TAC[Sphere.sqrt2];
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
DISCH_TAC;
REPEAT (GMATCH_SIMP_TAC
eulerA_x_pos);
REPEAT (GMATCH_SIMP_TAC
delta_x4_pos);
SUBGOAL_THEN `!x. &2 <= x ==> &4 <= x*x` (unlist ASM_SIMP_TAC);
GEN_TAC;
REWRITE_TAC[arith `&4 = &2 * &2`];
DISCH_TAC;
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE;
BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC);
SUBGOAL_THEN `!x. &2 <= x ==> &0 < x * x` (unlist ASM_SIMP_TAC);
REPEAT WEAK_STRIP_TAC;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC);
SUBGOAL_THEN `!x. &2 <= x /\ x < &2 *
sqrt(&2) ==> x * x < &8` ASSUME_TAC;
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[arith `&8 = #8.0`;GSYM Nonlinear_lemma.sqrt8_2];
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE;
REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2];
REWRITE_TAC[Sphere.sqrt2];
BY((REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC);
ASM_SIMP_TAC[];
SUBGOAL_THEN `!x. x * x < &8 ==> x * x <= &16` (unlist ASM_SIMP_TAC);
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let dih_x_nn = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
&0 < x1 /\
&0 <
delta_x x1 x2 x3 x4 x5 x6 ==>
&0 <=
dih_x x1 x2 x3 x4 x5 x6 `,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Nonlinear_lemma.dih_x_alt];
SUBGOAL_THEN `&0 <
sqrt(&4 * x1 *
delta_x x1 x2 x3 x4 x5 x6)` ASSUME_TAC;
GMATCH_SIMP_TAC
SQRT_POS_LT;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
ASM_REWRITE_TAC[];
BY(REAL_ARITH_TAC);
ASM_SIMP_TAC[Trigonometry1.ATN2_BREAKDOWN];
MATCH_MP_TAC (arith `-- a < c ==> &0 <= a + c`);
BY(MESON_TAC[
ATN_BOUNDS])
]);;
(* }}} *)
(* }}} *)
let ETA_Y_LE_IMP_LT = prove_by_refinement(
`!y4 y5 y6. &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 /\
eta_y y4 y5 y6 < sqrt2 ==> y4 < sqrt8`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.eta_y];
REWRITE_TAC[
LET_DEF;
LET_END_DEF];
REPEAT WEAK_STRIP_TAC;
INTRO_TAC
UPS_X_POS [`y4`;`y5`;`y6`];
ANTS_TAC;
REPEAT (FIRST_X_ASSUM MP_TAC);
MP_TAC Flyspeck_constants.bounds;
REWRITE_TAC[Sphere.sqrt8];
BY(REAL_ARITH_TAC);
WEAK_STRIP_TAC;
PROOF_BY_CONTR_TAC;
SUBGOAL_THEN `y4 = sqrt8` ASSUME_TAC;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
INTRO_TAC
cell_3_delta_x_eta_x [`y4*y4`;`y5*y5`;`y6*y6`];
ANTS_TAC;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
ASM_REWRITE_TAC[];
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
ASM_REWRITE_TAC[];
REWRITE_TAC[Nonlinear_lemma.sqrt8_2];
SUBGOAL_THEN `
delta_x (&2) (&2) (&2) #8.0 (y5 * y5) (y6 * y6) = -- &2 * (-- &8 + y5 * y5 + y6 * y6) pow 2` SUBST1_TAC;
REWRITE_TAC[Sphere.delta_x];
BY(REAL_ARITH_TAC);
INTRO_TAC Real_ext.REAL_LE_POW_2 [`-- &8 + y5 * y5 + y6 * y6`];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
(* }}} *)
let ETA_Y_BOUNDS = prove_by_refinement(
`!y4 y5 y6. &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 /\
eta_y y4 y5 y6 < sqrt2 ==> &0 <
ups_x (y4 * y4) (y5 * y5) (y6 * y6) /\
&0 <
delta_x (&2) (&2) (&2) (y4 * y4) (y5*y5) (y6*y6)`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.eta_y];
REWRITE_TAC[
LET_DEF;
LET_END_DEF];
REPEAT WEAK_STRIP_TAC;
INTRO_TAC
UPS_X_POS [`y4`;`y5`;`y6`];
ANTS_TAC;
REPEAT (FIRST_X_ASSUM MP_TAC);
MP_TAC Flyspeck_constants.bounds;
REWRITE_TAC[Sphere.sqrt8];
BY(BY(REAL_ARITH_TAC));
DISCH_TAC;
ASM_REWRITE_TAC[];
INTRO_TAC
cell_3_delta_x_eta_x [`y4 * y4`;`y5 * y5`;`y6 * y6`];
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let dih_y_div_sqrtdelta_pos = prove_by_refinement(
`!y4 y5 y6.
&2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\
y4 <= &2 *
sqrt(&2) /\ y5 <= &2 *
sqrt(&2) /\ y6 <= &2 *
sqrt(&2) /\
eta_y (y4) (y5) (y6) <
sqrt(&2) ==>
&0 <=
y_of_x dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6`,
(* {{{ proof *)
[
REPEAT STRIP_TAC;
INTRO_TAC
ETA_Y_LE_IMP_LT_ALL [`y4`;`y5`;`y6`];
ASM_REWRITE_TAC[];
ANTS_TAC;
REPEAT (FIRST_X_ASSUM MP_TAC);
REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2];
BY(REAL_ARITH_TAC);
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.y_of_x;Nonlin_def.dih4_x_div_sqrtdelta_posbranch;Sphere.rotate4];
MATCH_MP_TAC
dih_x_div_sqrtdelta_pos;
CONJ_TAC;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
SUBCONJ_TAC;
INTRO_TAC
ETA_Y_BOUNDS [`y4`;`y5`;`y6`];
ASM_REWRITE_TAC[];
ANTS_TAC;
BY(ASM_SIMP_TAC[Sphere.sqrt2;arith `x < y ==> x <= y`]);
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2];
BY(ASM_MESON_TAC[
delta_x_sym]);
DISCH_TAC;
INTRO_TAC
delta_x4_pos [`y5 * y5`;`y6 * y6`;`y4 * y4`];
ANTS_TAC;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
REWRITE_TAC[arith `&4 = &2 * &2`];
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE;
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE;
REWRITE_TAC[GSYM Nonlinear_lemma.sqrt8_2;arith `&8 = #8.0`];
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
BY(REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2])
]);;
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
(* }}} *)
let gamma3f_sym = prove_by_refinement(
`!y4 y5 y6.
gamma3f y4 y5 y6 sqrt2 lmfun = gamma3f y4 y6 y5 sqrt2 lmfun /\
gamma3f y4 y5 y6 sqrt2 lmfun = gamma3f y5 y6 y4 sqrt2 lmfun`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.gamma3f;Sphere.vol3r;Sphere.vol3f;Sphere.vol_y;Sphere.y_of_x;Sphere.vol_x;Nonlinear_lemma.sqrt2_sqrt2];
MATCH_MP_TAC (arith `((a = a') /\ (a = a'')) /\ ((b = b') /\ (b =b'')) /\ ((c = c') /\ c = c'') ==> (a - (b - c) = a' - (b' - c'))/\ (a - (b - c) = a'' - (b'' - c''))`);
CONJ_TAC;
BY(ASM_MESON_TAC[
delta_x_sym]);
CONJ_TAC;
REWRITE_TAC[
sol_y_sol_x];
CONJ_TAC;
REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC);
MATCH_MP_TAC (arith `(x = z') /\ (y = y') /\ (z = x') ==> (x+y+z = x'+y'+z')`);
BY(MESON_TAC[
sol_x_sym;
sol_x_sym2]);
BY(MESON_TAC[
sol_x_sym;
sol_x_sym2;arith `x + y + z = y + z + x`]);
CONJ_TAC;
REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC);
MATCH_MP_TAC (arith `(x = x') /\ (y = z') /\ (z = y') ==> (x+y+z = x'+y'+z')`);
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]);
REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC);
MATCH_MP_TAC (arith `(x = z') /\ (y = x') /\ (z = y') ==> (x+y+z = x'+y'+z')`);
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2])
]);;
(* }}} *)
(* }}} *)
(* do 3 -cell nonnegativity *)
let REAL_WLOG_SIMPLEX_3d = prove_by_refinement(
`!P.
((!y4 y5 y6. P y4 y5 y6 = P y4 y6 y5) /\
(!y4 y5 y6. P y4 y5 y6 = P y5 y6 y4))
/\
(! y4 y5 y6. (y6 <= y5) /\ (y5 <= y4) ==> P y4 y5 y6) ==>
(!y4 y5 y6. P y4 y5 y6)`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `(y4 <= y5 /\ y5 <= y6) \/ (y4 <= y6 /\ y6 <= y5) \/ (y5 <= y4 /\ y4 <= y6) \/ (y5 <= y6 /\ y6 <= y4) \/ (y6 <= y5 /\ y5 <= y4) \/ (y6 <= y4 /\ y4 <= y5)` ASSUME_TAC;
BY(REAL_ARITH_TAC);
BY(REPEAT ((FIRST_X_ASSUM DISJ_CASES_TAC) THEN (ASM_MESON_TAC[])))
]);;
(* }}} *)
let ineq_constant = prove_by_refinement(
`!a y v f. (ineq (CONS (a,y,a) v) (f y)) <=> ((y=a)==> (ineq v (f a)))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.ineq;arith `a <= y /\ y <= a <=> (y = a)`];
BY(MESON_TAC[])
]);;
(* }}} *)
(* }}} *)
let cell3_from_ineq = `!y4 y5 y6.
&2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\
y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\
eta_y (y4) (y5) (y6) < sqrt(&2) ==>
&0 <= gamma3f y4 y5 y6 sqrt2 lmfun `;;
(* }}} *)
let ineq_branch_edge_strict = prove_by_refinement(
`!c a b u v y f.
ineq (
APPEND u (CONS (a,y,c) v)) f /\
((c < y) ==> ineq (
APPEND u (CONS (c,y,b) v)) f) ==>
ineq (
APPEND u (CONS (a,y,b) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
ASSUME_TAC (arith `y <= c \/ c < y`);
REPEAT (FIRST_X_ASSUM MP_TAC);
(ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_CASES_TAC `y <= c` THEN ASM_CASES_TAC `c < y` THEN ASM_SIMP_TAC[arith `c < y ==> c <= y`;
ineq_T] THEN TRY (ASM_MESON_TAC[]))
]);;
(* }}} *)
let BRANCH_TAC_STRICT n c =
CHOP_LIST_TAC n THEN
MATCH_MP_TAC (SPEC c ineq_branch_edge_strict)
THEN REWRITE_TAC[APPEND];;
let cell3_hyp =
let cell3= ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8";
"QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";] in
let cell3_nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) cell3 in
end_itlist (curry mk_conj) cell3_nonlinear;;
(*
let goalt = mk_imp(cell3_hyp,cell3_from_ineq);;
Print_types.print_term_types goalt;;
g goalt;;
*)
g (mk_imp(cell3_hyp,cell3_from_ineq));;
let cell3_from_ineq_thm = prove_by_refinement(
(mk_imp(cell3_hyp,cell3_from_ineq)),
(* {{{ proof *)
[
DISCH_TAC;
REPEAT GEN_TAC;
ABBREV_TAC `Q = (\y4 y5 y6. &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ eta_y (y4) (y5) (y6) < sqrt(&2))`;
DISCH_TAC;
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`Q y4 y5 y6`) ASSUME_TAC));
EXPAND_TAC "Q";
BY(BY((ASM_REWRITE_TAC[])));
REPEAT WEAK_STRIP_TAC;
INTRO_TAC ETA_Y_BOUNDS [`y4`;`y5`;`y6`];
ANTS_TAC;
BY(BY((ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2])));
REPEAT WEAK_STRIP_TAC;
INTRO_TAC ETA_Y_LE_IMP_LT_ALL [`y4`;`y5`;`y6`];
ANTS_TAC;
BY(BY((ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2])));
REPEAT WEAK_STRIP_TAC;
COMMENT "1. remove excess variables";
REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC);
REWRITE_TAC[ineq_constant];
REWRITE_TAC[MESON[] `(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6) <=> (!y4 y5 y6 y1 y2 y3. P y1 y2 y3 y4 y5 y6)`];
REWRITE_TAC[ RIGHT_FORALL_IMP_THM];
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP PPx)));
COMMENT "2. insert Q";
REPEAT (FIRST_X_ASSUM MP_TAC);
REPLICATE_TAC 8 DISCH_TAC;
REWRITE_TAC[arith `!x y. x > y <=> y < x`;arith `!x y. x >= y <=> y <= x`];
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!P. (!y4 y5 y6. P y4 y5 y6) ==> (!y4 y5 y6. Q y4 y5 y6 ==> P y4 y5 y6)`) MP_TAC));
BY(BY((MESON_TAC[])));
DISCH_THEN (fun t -> (REPEAT (DISCH_THEN (ASSUME_TAC o (MATCH_MP t)))));
COMMENT "3. remove eta_y";
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6 \/ &2 < eta_y y4 y5 y6 pow 2)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6))`) MP_TAC));
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_monotone;
GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `~(&2 < eta_y y4' y5' y6' pow 2)`)));
BY(BY((MESON_TAC[])));
MATCH_MP_TAC (arith `x < &2 ==> ~(&2 < x)`);
FIRST_X_ASSUM MP_TAC;
EXPAND_TAC "Q";
DISCH_TAC;
REWRITE_TAC[GSYM Nonlinear_lemma.sqrt2_sqrt2];
REWRITE_TAC[arith `x pow 2 = x * x`];
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE;
GMATCH_SIMP_TAC (arith `&0 <= x ==> (abs x = x)`);
ASM_REWRITE_TAC[Sphere.sqrt2];
MATCH_MP_TAC eta_y_nn;
BY(BY((ASM_MESON_TAC[ETA_Y_BOUNDS;arith `x < y ==> x <= y`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2])));
DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))) THEN MP_TAC SUBST1_TAC);
MP_TAC (MESON[] `!y4 y5 y6. &2 < eta_y y4 y5 y6 pow 2 <=> (F \/ &2 < eta_y y4 y5 y6 pow 2)`);
DISCH_THEN (fun SUBST1_TAC -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN ONCE_REWRITE_TAC[SUBST1_TAC]);
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[];
(DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))) THEN MP_TAC SUBST1_TAC));
DISCH_THEN kill;
COMMENT "4. remove dih_4";
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (#0.008 * y_of_x dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6 < f y4 y5 y6)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (&0 <= f y4 y5 y6))`) MP_TAC));
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_monotone;
MATCH_MP_TAC (arith `&0 <= x ==> (x < y ==> &0 <= y)`);
GMATCH_SIMP_TAC REAL_LE_MUL;
CONJ_TAC;
BY(BY(REAL_ARITH_TAC));
MATCH_MP_TAC dih_y_div_sqrtdelta_pos;
FIRST_X_ASSUM MP_TAC;
EXPAND_TAC "Q";
BY(BY(MESON_TAC[]));
(DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `dih4_x_div_sqrtdelta_posbranch` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2))))));
COMMENT "5. make strict ineq";
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (&0 < f y4 y5 y6)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (&0 <= f y4 y5 y6))`) MP_TAC));
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_monotone;
BY(BY(REAL_ARITH_TAC));
(DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `ineq v (&0 < a)` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2))))));
COMMENT "5. insert h0cut y4 1";
SUBGOAL_THEN `#2.01 <= &2 * h0 /\ &2 * hminus <= &2 * h0` MP_TAC;
MP_TAC Sphere.h0;
MP_TAC Nonlinear_lemma.hminus_lt_h0;
BY(BY(REAL_ARITH_TAC));
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `!a b c d e f g v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (&1) (c y5) (d y6)) e f g y4 y5 y6)) ==> (b <= &2 * h0) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (c y5) (d y6)) e f g y4 y5 y6)))` MP_TAC;
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `ineq` MP_TAC;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC Optimize.h0cutA;
REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC);
BY(BY(REAL_ARITH_TAC));
(DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (&1)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2))))));
ASM_REWRITE_TAC[];
REPEAT DISCH_TAC;
COMMENT "5 h0cut y4 0";
SUBGOAL_THEN `&2 * h0 < &2 * hplus` MP_TAC;
MP_TAC Nonlinear_lemma.h0_lt_hplus;
BY(BY(REAL_ARITH_TAC));
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `!a b c d e f g v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (&0) (c y5) (d y6)) e f g y4 y5 y6)) ==> ( &2 * h0 < a) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (c y5) (d y6)) e f g y4 y5 y6)))` MP_TAC;
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `ineq` MP_TAC;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC Optimize.h0cutB;
REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC);
BY(BY(REAL_ARITH_TAC));
(DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (&0)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2))))));
ASM_REWRITE_TAC[];
DISCH_TAC; (* inserted Nov 30, 2012 *)
COMMENT "5 h0cut y5 1";
SUBGOAL_THEN `!a b a' b' c d e f g v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') (v y6))) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (&1) (d y6)) e f g y4 y5 y6)) ==> (b' <= &2 * h0) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') (v y6))) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (h0cut y5) (d y6)) e f g y4 y5 y6)))` MP_TAC;
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `ineq` MP_TAC;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC Optimize.h0cutA;
REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC);
BY(BY(REAL_ARITH_TAC));
(DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (a) (&1)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2))))));
ASM_REWRITE_TAC[];
REPEAT DISCH_TAC;
COMMENT "5 factor of 2";
FIRST_X_ASSUM_ST `x / &2` MP_TAC;
REWRITE_TAC [arith `!x. &0 <= x / &2 <=> &0 <= x`];
DISCH_TAC;
COMMENT "5 h0cut y6 1";
SUBGOAL_THEN `!a b a' b' a'' b'' c d e f g . (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') [a'',y6,b''])) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (d y5) (&1)) e f g y4 y5 y6)) ==> (b'' <= &2 * h0) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') [a'',y6,b''])) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (d y5) (h0cut y6)) e f g y4 y5 y6)))` MP_TAC;
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `y_of_x` MP_TAC;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC Optimize.h0cutA;
REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC);
BY(BY(REAL_ARITH_TAC));
(DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (a) b (&1)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2))))));
ASM_REWRITE_TAC[];
REPEAT DISCH_TAC;
COMMENT "7. gamma3f";
REPEAT (FIRST_X_ASSUM MP_TAC);
ONCE_REWRITE_TAC[gamma3f_y_div_sqrtdelta_arg3];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `!v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (v y4 y5 y6) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6)) (&1) (&1) (&1) y4 y5 y6)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (v y4 y5 y6) (&0 <= gamma3f y4 y5 y6 sqrt2 lmfun))` MP_TAC;
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`])))));
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_monotone;
DISCH_TAC;
INTRO_TAC gamma3f_gamma3f_x_div_sqrtdelta [`&1`;`&1`;`&1`];
DISCH_THEN GMATCH_SIMP_TAC;
REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC);
EXPAND_TAC "Q";
REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF];
DISCH_TAC;
ASM_REWRITE_TAC[];
DISCH_TAC;
GMATCH_SIMP_TAC REAL_LE_MUL;
CONJ_TAC;
FIRST_X_ASSUM MP_TAC;
BY(BY(REWRITE_TAC[Sphere.y_of_x;arith `&1 * &1 = &1`]));
GMATCH_SIMP_TAC SQRT_POS_LE;
MATCH_MP_TAC (arith `&0 < x ==> &0 <= x`);
INTRO_TAC ETA_Y_BOUNDS [`y4'`;`y5'`;`y6'`];
ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2];
ANTS_TAC;
BY(BY(ASM_REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]));
BY(BY(MESON_TAC[]));
((DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))))));
REPEAT WEAK_STRIP_TAC;
COMMENT "8. symmetry reduction";
ENOUGH_TO_SHOW_TAC `(!y4 y5 y6. Q y4 y5 y6 ==> ineq [(&2,y4,sqrt8);(&2,y5,sqrt8);(&2,y6,sqrt8)] (&0 <= gamma3f y4 y5 y6 sqrt2 lmfun))`;
DISCH_THEN (C INTRO_TAC [`y4`;`y5`;`y6`]);
BY(ASM_REWRITE_TAC[Sphere.ineq;Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]);
MATCH_MP_TAC REAL_WLOG_SIMPLEX_3d;
REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`];
CONJ_TAC;
EXPAND_TAC "Q";
REWRITE_TAC[Sphere.ineq];
BY(MESON_TAC[gamma3f_sym;Collect_geom.ETA_Y_SYYM]);
REPEAT WEAK_STRIP_TAC;
BRANCH_TAC_STRICT 0 `&2 * hminus`;
CONJ_TAC;
BRANCH_TAC_STRICT 0 `#2.01`;
SUBGOAL_THEN `#2.01 <= sqrt8` ASSUME_TAC;
BY(MP_TAC (Flyspeck_constants.bounds) THEN REAL_ARITH_TAC);
REPEAT (FIRST_X_ASSUM_ST `#2.01` (C INTRO_TAC [`y4'`;`y5'`;`y6'`]));
ASM_REWRITE_TAC[];
REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC);
BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC);
DISCH_TAC;
COMMENT "9. now 2hminus < y4";
DISJ_CASES_TAC (arith `&2 * hminus < y6' \/ y6' <= &2 * hminus`);
REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `F` (C INTRO_TAC [`y4'`;`y5'`;`y6'`]));
ASM_REWRITE_TAC[];
REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC);
BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC);
DISJ_CASES_TAC (arith `&2 * hplus < y5' \/ y5' <= &2 * hplus`);
REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `F` (C INTRO_TAC [`y4'`;`y5'`;`y6'`]));
ASM_REWRITE_TAC[];
REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC);
BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC);
DISJ_CASES_TAC (arith `&2 * hminus < y5' \/ y5' <= &2 * hminus`);
(FIRST_X_ASSUM (C INTRO_TAC [`y4'`;`y5'`;`y6'`]));
ASM_REWRITE_TAC[];
REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC);
BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC);
DISJ_CASES_TAC (arith `&2 * hplus < y4' \/ y4' <= &2 * hplus`);
REPEAT (FIRST_X_ASSUM_ST `#2.01` kill);
REPLICATE_TAC 2 (FIRST_X_ASSUM (C INTRO_TAC [`y4'`;`y5'`;`y6'`]));
ASM_REWRITE_TAC[];
REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC);
BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC);
REPEAT (FIRST_X_ASSUM_ST `#2.01` kill);
REPLICATE_TAC 3 (FIRST_X_ASSUM (C INTRO_TAC [`y4'`;`y5'`;`y6'`]));
ASM_REWRITE_TAC[];
REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC);
BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC)
]);;
(* }}} *)
"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8";"QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";])));
BY(REWRITE_TAC[])
]);;
(* }}} *)
let HJKDESR1a_1cell = prove_by_refinement(
`&0 < &8 *
pi * sqrt2 / &3 - &8 * mm1 `,
(* {{{ proof *)
[
REWRITE_TAC[ arith `&8 *
pi * sqrt2 / &3 = (&8 / &3) * (
pi * sqrt2)`];
MATCH_MP_TAC (arith `&3 * mm1 < z ==> &0 < (&8/ &3) * z - &8 * mm1`);
MATCH_MP_TAC
REAL_LT_TRANS;
EXISTS_TAC (`&3 * #1.3`);
GMATCH_SIMP_TAC
REAL_LT_LMUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL2;
MP_TAC Flyspeck_constants.bounds;
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let GRKIBMP_concl =
`!y. &2 <= y /\ y <= sqrt8 ==>
&0 <= gamma2_x_div_azim_v2 (h0cut y) (y* y)`;;
(* lmfun_h0cut relates this to the function lmfun *)
"GRKIBMP B V2"] GRKIBMP_concl),
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y`;`&1`;`&1`;`&1`;`&1`;`&1`]));
REWRITE_TAC[Sphere.ineq;Sphere.y_of_x;arith `&1 * &1 = &1`;arith `&1 <= &1`;Functional_equation.nonf_gamma2_x1_div_a_v2];
ASM_CASES_TAC `&2 * hplus <= y`;
ASM_REWRITE_TAC[arith `x >= &0 <=> &0 <= x`];
REPEAT WEAK_STRIP_TAC;
ENOUGH_TO_SHOW_TAC `h0cut y = &0`;
BY(ASM_MESON_TAC[]);
MATCH_MP_TAC Optimize.h0cutB;
MP_TAC Nonlinear_lemma.h0_lt_hplus;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(* see also Nonlinear_lemma.h0_lt_gt *)
let y_bounds = prove_by_refinement(
`!y. (y <= &2 * hminus ==> y <= sqrt8) /\
(y <= sqrt8 ==> y <= &2 *
sqrt(&2)) /\
(y <= &2 *
sqrt(&2) ==> y < &4) /\
(y < &2 * hminus ==> y <= &2 * hminus) /\
(y < &2 * hminus ==> y <= &2 *
sqrt(&2)) /\
(&2 <= y ==> &0 < y) /\
(&2 * hminus <= y ==> &2 <= y) /\
(&2 <= y ==> &0 <= y) /\
(&2 * hminus <= y ==> &0 <= y) /\
(y <= &2 * hminus ==> y <= &2 * h0) /\
(y <= &2 * hplus ==> y <= &2 *
sqrt(&2)) `,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MP_TAC Flyspeck_constants.bounds;
MP_TAC Nonlinear_lemma.hminus_lt_h0;
REWRITE_TAC[GSYM Nonlinear_lemma.sqrt8_sqrt2;GSYM Sphere.sqrt2];
MP_TAC Nonlinear_lemma.hminus_prop;
REWRITE_TAC[Sphere.hplus];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let rad2_x_eta_x = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
&0 < x4 /\ &0 < x5 /\ &0 < x6 /\
&0 <
ups_x x4 x5 x6 /\ &0 <
delta_x x1 x2 x3 x4 x5 x6 ==>
eta_x x4 x5 x6 pow 2 <=
rad2_x x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.rad2_x;Sphere.eta_x;GSYM (* Merge_ineq *) Collect_geom.rho_ij'_rho_x];
GMATCH_SIMP_TAC
REAL_LE_RDIV_EQ;
CONJ_TAC;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
ASM_REWRITE_TAC[];
BY(REAL_ARITH_TAC);
GMATCH_SIMP_TAC
SQRT_POW_2;
CONJ_TAC;
GMATCH_SIMP_TAC
REAL_LE_DIV;
ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`];
GMATCH_SIMP_TAC
REAL_LE_MUL;
GMATCH_SIMP_TAC
REAL_LE_MUL;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
SUBGOAL_THEN `(x4 * x5 * x6) /
ups_x x4 x5 x6 *
delta_x x1 x2 x3 x4 x5 x6 * &4 = (&4 *
delta_x x1 x2 x3 x4 x5 x6 * x4 * x5 * x6) /
ups_x x4 x5 x6` SUBST1_TAC;
Calc_derivative.CALC_ID_TAC;
FIRST_X_ASSUM_ST `
ups_x` MP_TAC;
BY(REAL_ARITH_TAC);
GMATCH_SIMP_TAC
REAL_LE_LDIV_EQ;
ASM_REWRITE_TAC[];
REWRITE_TAC[Collect_geom.RHUFIIB];
REWRITE_TAC[(* Merge_ineq *)
delta_delta_x];
MATCH_MP_TAC (arith `&0 <= x ==> y <= x + y`);
BY(REWRITE_TAC[
REAL_LE_POW_2])
]);;
(* }}} *)
let rad2_eta2 = prove_by_refinement(
`!y1 y2 y3 y4 y5 y6.
&2 <= y1 /\ &2 <= y2 /\ &2 <= y6 /\ y1 < &4 /\ y2 < &4 /\ y6 < &4 /\
rad2_y y1 y2 y3 y4 y5 y6 < &2 /\
&0 <
delta_y y1 y2 y3 y4 y5 y6 ==>
eta_y y1 y2 y6 pow 2 < &2`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC
REAL_LET_TRANS;
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `
rad2_y y1 y2 y3 y4 y5 y6`)));
ASM_REWRITE_TAC[];
REWRITE_TAC[Sphere.eta_y;Sphere.rad2_y;
LET_DEF;
LET_END_DEF;Sphere.y_of_x];
SUBGOAL_THEN `!x1 x2 x3 x4 x5 x6.
rad2_x x1 x2 x3 x4 x5 x6 =
rad2_x x4 x5 x3 x1 x2 x6` (unlist ONCE_REWRITE_TAC);
BY((MESON_TAC[(* Merge_ineq *)
rad2_x_sym]));
MATCH_MP_TAC
rad2_x_eta_x;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
ASM_SIMP_TAC[
y_bounds];
CONJ2_TAC;
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[Sphere.delta_y];
MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> &0 < y)`);
BY((MESON_TAC[(* Merge_ineq *)
delta_x_sym]));
MATCH_MP_TAC
UPS_X_POS;
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
let g_quqya_goal =
add_hyp ["FHBVYXZ a";"FHBVYXZ b";"FWGKMBZ"]
(mk_imp(cell3_from_ineq,`!y1 y2 y3 y4 y5 y6.
ineq
[(&2 * hminus, y1, &2 * hplus );
(&2,y2,&2 * hminus );
(&2,y3,&2 * hminus);
(&2,y4,&2 * hminus);
(&2,y5,&2 * hminus );
(&2,y6,&2 * hminus )
]
(rad2_y y1 y2 y3 y4 y5 y6 < &2 ==>
(&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + gamma3f y1 y2 y6 sqrt2 lmfun))`));;
g g_quqya_goal;;
let g_quqya_g_quqyb = prove_by_refinement(
g_quqya_goal,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y6`]);
REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]));
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC);
REPEAT (FIRST_X_ASSUM_ST `gamma3f` MP_TAC);
REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC);
ASM_REWRITE_TAC[];
ASM_SIMP_TAC[y_bounds];
REWRITE_TAC[GSYM Sphere.rad2_y];
ASM_SIMP_TAC[arith `x < y ==> ~(x > y)`];
DISCH_TAC;
ANTS_TAC;
GMATCH_SIMP_TAC REAL_LT_RSQRT;
MATCH_MP_TAC rad2_eta2;
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y3`)));
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y4`)));
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y5`)));
ASM_SIMP_TAC[y_bounds];
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[Sphere.y_of_x];
REWRITE_TAC[Sphere.y_of_x;Sphere.delta_y];
BY(REAL_ARITH_TAC);
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let g_quqya_g_quqyb_ALT = prove_by_refinement(
`pack_nonlinear_non_ox3q1h ==>
!y1 y2 y3 y4 y5 y6.
ineq
[(&2 * hminus, y1, &2 * hplus );
(&2,y2,&2 * hminus );
(&2,y3,&2 * hminus);
(&2,y4,&2 * hminus);
(&2,y5,&2 * hminus );
(&2,y6,&2 * hminus )
]
(
rad2_y y1 y2 y3 y4 y5 y6 < &2 ==>
(&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + gamma3f y1 y2 y6 sqrt2 lmfun))`,
(* {{{ proof *)
[
REPEAT WEAKER_STRIP_TAC;
MP_TAC
cell3_from_ineq_thm_ALT;
ASM_REWRITE_TAC[];
DISCH_TAC;
MP_TAC
g_quqya_g_quqyb;
ANTS_TAC;
BY(ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ["FHBVYXZ a";
"FHBVYXZ b";"FWGKMBZ"]));
ASM_REWRITE_TAC[];
BY(DISCH_THEN (unlist REWRITE_TAC))
]);;
(* }}} *)
(*
let gamma10_gamma11_concl =
add_hyp ["GLFVCVK4 2477216213";"QITNPEA 5400790175 a";"QITNPEA 5400790175 b";"FWGKMBZ"]
(mk_imp(cell3_from_ineq,`!y1 y2 y3 y4 y5 y6.
&2 * hminus <= y1 /\ y1 <= &2 * hplus /\
&2 <= y2 /\ y2 < &2 * hminus /\
&2 <= y3 /\ y3 < &2 * hminus /\
&2 * hminus <= y4 /\ y4 <= sqrt8 /\
&2 <= y5 /\ y5 < &2 * hminus /\
&2 <= y6 /\ y6 < &2 * hminus /\
rad2_y y1 y2 y3 y4 y5 y6 < &2 ==>
(#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6)
+ beta_bump_y y1 y2 y3 y4 y5 y6 +
gamma3f y1 y2 y6 sqrt2 lmfun)`));;
*)
let gamma10_gamma11_concl =
add_hyp ["GLFVCVK4 2477216213";"QITNPEA 5400790175 a";"QITNPEA 5400790175 b";"FWGKMBZ"]
(mk_imp(cell3_from_ineq,`!y1 y2 y3 y4 y5 y6.
&2 * hminus <= y1 /\ y1 <= &2 * hplus /\
&2 <= y2 /\ y2 < &2 * hminus /\
&2 <= y3 /\ y3 < &2 * hminus /\
&2 * hminus <= y4 /\ y4 <= sqrt8 /\
&2 <= y5 /\ y5 < &2 * hminus /\
&2 <= y6 /\ y6 < &2 * hminus /\
rad2_y y1 y2 y3 y4 y5 y6 < &2 ==>
(#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6)
+ beta_bumpA_y y1 y2 y3 y4 y5 y6 +
gamma3f y1 y2 y6 sqrt2 lmfun)`));;
let gamma10_gamma11 = prove_by_refinement(
gamma10_gamma11_concl,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y6`]);
REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]));
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC);
REPEAT (FIRST_X_ASSUM_ST `gamma3f` MP_TAC);
REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC);
ASM_REWRITE_TAC[];
ASM_SIMP_TAC[y_bounds];
REWRITE_TAC[GSYM Sphere.rad2_y];
ASM_SIMP_TAC[arith `x < y ==> ~(x > y)`];
DISCH_TAC;
ANTS_TAC;
GMATCH_SIMP_TAC REAL_LT_RSQRT;
MATCH_MP_TAC rad2_eta2;
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y3`)));
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y4`)));
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y5`)));
ASM_SIMP_TAC[y_bounds];
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[Sphere.y_of_x;Sphere.delta_y];
BY(REAL_ARITH_TAC);
REPEAT DISCH_TAC;
SUBGOAL_THEN `#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 + beta_bump_lb + gamma3f y1 y2 y6 sqrt2 lmfun` ASSUME_TAC;
ASM_CASES_TAC `eta_y y1 y2 y6 pow 2 < #1.34 pow 2`;
REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC);
BY(REAL_ARITH_TAC);
REPEAT (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC);
ASM_REWRITE_TAC[];
FIRST_X_ASSUM_ST `gamma3f` MP_TAC;
BY(REAL_ARITH_TAC);
FIRST_X_ASSUM MP_TAC;
MATCH_MP_TAC (arith `x <= x' /\ y <= y' ==> (z <= x + y + u ==> z <= x' + y' +u)`);
CONJ2_TAC;
BY(ASM_MESON_TAC[(* Merge_ineq *) beta_bumpA_lb1;arith `&1 * x = x`]);
ASM_CASES_TAC (`wtcount6_y y1 y2 y3 y4 y5 y6 = 2`);
ASM_REWRITE_TAC[];
BY(REAL_ARITH_TAC);
COMMENT "insert here";
FIRST_X_ASSUM_ST `norm2hh` MP_TAC;
REWRITE_TAC[TAUT ` (a \/b) <=> (~b ==> a) `];
ANTS_TAC;
DISCH_THEN (MP_TAC o (MATCH_MP quarter_norm2hh));
BY(REPEAT (FIRST_X_ASSUM_ST `hminus` MP_TAC) THEN REAL_ARITH_TAC);
DISCH_TAC;
COMMENT "end insert";
SUBGOAL_THEN `critical_edge_y y1 /\ ~critical_edge_y y2 /\ ~critical_edge_y y3 /\ ~critical_edge_y y4 /\ ~critical_edge_y y5 /\ ~critical_edge_y y6 /\ wtcount6_y y1 y2 y3 y4 y5 y6 = 1` ASSUME_TAC;
FIRST_X_ASSUM_ST `wtcount6_y` MP_TAC;
REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y;Sphere.critical_edge_y];
TYPED_ABBREV_TAC `A = if &2 * hminus <= y4 /\ y4 <= &2 * hplus then 1 else 0`;
ASM_REWRITE_TAC[];
REPEAT (GMATCH_SIMP_TAC COND_FALSE);
REWRITE_TAC[DE_MORGAN_THM;arith `~(x <= y) <=> y < x`];
ASM_SIMP_TAC[y_bounds];
REWRITE_TAC[arith `(1 + 0 +0 ) + A + 0 + 0 = 1 + A`];
EXPAND_TAC "A";
COND_CASES_TAC;
BY(MESON_TAC[arith `1 + 1 = 2`]);
DISCH_TAC;
CONJ2_TAC;
BY(ARITH_TAC);
REPEAT (FIRST_X_ASSUM_ST `hminus` MP_TAC);
BY(REAL_ARITH_TAC);
ASM_REWRITE_TAC[];
FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC;
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let gamma10_gamma11_ALT = prove_by_refinement(
`pack_nonlinear_non_ox3q1h ==>
(!y1 y2 y3 y4 y5 y6.
&2 * hminus <= y1 /\ y1 <= &2 * hplus /\
&2 <= y2 /\ y2 < &2 * hminus /\
&2 <= y3 /\ y3 < &2 * hminus /\
&2 * hminus <= y4 /\ y4 <= sqrt8 /\
&2 <= y5 /\ y5 < &2 * hminus /\
&2 <= y6 /\ y6 < &2 * hminus /\
rad2_y y1 y2 y3 y4 y5 y6 < &2 ==>
(#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(
wtcount6_y y1 y2 y3 y4 y5 y6)
+
beta_bumpA_y y1 y2 y3 y4 y5 y6 +
gamma3f y1 y2 y6 sqrt2 lmfun))`,
(* {{{ proof *)
[
REPEAT WEAKER_STRIP_TAC;
MP_TAC
cell3_from_ineq_thm_ALT;
ASM_REWRITE_TAC[];
DISCH_TAC;
MP_TAC
gamma10_gamma11;
ANTS_TAC;
BY(ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ["GLFVCVK4 2477216213";
"QITNPEA 5400790175 a";"QITNPEA 5400790175 b";"FWGKMBZ"]));
ASM_REWRITE_TAC[];
DISCH_THEN MATCH_MP_TAC;
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
let gamma3_x_gamma3f = prove_by_refinement(
`!a b c y4 y5 y6.
&2 * hminus <= y4 /\
&2 <= y5 /\ y5 <= &2 * hminus /\
&2 <= y6 /\ y6 <= &2 * hminus ==>
gamma3f y4 y5 y6 sqrt2 lmfun = (
gamma3_x (h0cut y4)) a b c (y4*y4) (y5*y5) (y6*y6)`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.gamma3f;Functional_equation.nonf_gamma3_x;Sphere.y_of_x;Sphere.vol3r;Sphere.vol3f;Sphere.vol_y];
REWRITE_TAC[Sphere.dih_y;(* Merge_ineq *)
sol_y_sol_x;
LET_DEF;
LET_END_DEF];
REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2];
REPEAT WEAK_STRIP_TAC;
REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx);
ASM_SIMP_TAC[
y_bounds];
REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC);
REWRITE_TAC[arith `x * #0.5 = x/ &2`];
REWRITE_TAC[GSYM (* Merge_ineq *)
lmfun_h0cut];
REPEAT (GMATCH_SIMP_TAC (GSYM Nonlinear_lemma.lmfun_lfun));
ASM_SIMP_TAC[
y_bounds];
BINOP_TAC;
REWRITE_TAC[ (arith `x * &2 * mm1/pi = (&2 * mm1/pi) * x`)];
AP_TERM_TAC;
BY(MESON_TAC[(* Merge_ineq *)
sol_x_sym;(* Merge_ineq *)
sol_x_sym2]);
REWRITE_TAC[arith `x * &8 * mm2/
pi = (&8 * mm2 /pi) * x`];
AP_TERM_TAC;
BY(MESON_TAC[Nonlinear_lemma.dih_x_sym2;Nonlinear_lemma.dih_x_sym])
]);;
(* }}} *)
(* }}} *)
let atn_inv = prove_by_refinement(
`!x. &0 < x ==>
atn x +
atn (&1 / x) = pi/ &2`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
ASM_SIMP_TAC[GSYM Trigonometry1.ATN2_BREAKDOWN];
SIMP_TAC[arith `&0 < &1`; Trigonometry1.ATN2_BREAKDOWN];
REWRITE_TAC[arith `x / &1 = x`];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let atn_add2 = prove_by_refinement(
`!x y. &0 < x /\ &0 < y /\ x * y < &1 ==>
atn x +
atn y =
atn ((x+y)/(&1 - x * y))`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC
atn_add;
MATCH_MP_TAC (arith `&0 < u /\ u < y ==> abs(u) < y`);
CONJ_TAC;
MATCH_MP_TAC (arith `&0 < x /\ &0 < y ==> &0 < x + y`);
BY(ASM_REWRITE_TAC[
ATN_POS_LT]);
INTRO_TAC
ATN_MONO_LT [`y`;`&1 / x`];
ANTS_TAC;
GMATCH_SIMP_TAC
REAL_LT_RDIV_EQ;
ONCE_REWRITE_TAC[arith `x * y = y*x`];
BY(ASM_REWRITE_TAC[]);
DISCH_TAC;
GMATCH_SIMP_TAC (GSYM
atn_inv);
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `x`)));
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
(* }}} *)
let rho_x_ups_x = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6.
rho_x x1 x2 x3 x4 x5 x6 *
ups_x x1 x2 x6 =
chi_x x4 x5 x3 x1 x2 x6 pow 2 + &4 *
delta_x x1 x2 x3 x4 x5 x6 * x1 * x2 * x6`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.rho_x;Sphere.chi_x;Sphere.delta_x;Sphere.ups_x];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
SUBGOAL_THEN `rho_x x1 x2 x3 x4 x5 x6 / (delta_x x1 x2 x3 x4 x5 x6 * &4) * ups_x x1 x2 x6 = (rho_x x1 x2 x3 x4 x5 x6 * ups_x x1 x2 x6) / (&4 *delta_x x1 x2 x3 x4 x5 x6)` SUBST1_TAC;
Calc_derivative.CALC_ID_TAC;
BY(ASM_REWRITE_TAC[arith `~(&4 = &0)`]);
REWRITE_TAC[rho_x_ups_x];
Calc_derivative.CALC_ID_TAC;
ASM_REWRITE_TAC[];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let delta_x4_rad2 = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6 r.
rad2_x x1 x2 x3 x4 x5 x6 = r /\ ~(
delta_x x1 x2 x3 x4 x5 x6 = &0) ==>
delta_x4 x1 x2 r r r x6 = x1 * (-- x1 + x2 + x6)
`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.rad2_x];
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.delta_x4];
EXPAND_TAC "r";
ABBREV_TAC `h = rho_x x1 x2 x3 x4 x5 x6`;
Calc_derivative.CALC_ID_TAC;
ASM_REWRITE_TAC[];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let dih_x_rad2 = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6 r.
rad2_x x1 x2 x3 x4 x5 x6 = r /\ &0 <
delta_x x1 x2 x3 x4 x5 x6 /\ &0 < x1 ==>
dih_x x1 x2 r r r x6 = pi/ &2 + atn2 (abs(
chi_x x4 x5 x3 x1 x2 x6) ,
sqrt(x1 *
delta_x x1 x2 x3 x4 x5 x6) * (x1 - x2 - x6))`,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.dih_x;
LET_DEF;
LET_END_DEF];
REPEAT WEAK_STRIP_TAC;
GMATCH_SIMP_TAC
delta_x4_rad2;
GMATCH_SIMP_TAC
chi_rad2;
GEXISTL_TAC [`x3`;`x4`;`x5`];
ASM_SIMP_TAC[ arith `&0 < x ==> ~(x = &0)`];
CONJ_TAC;
BY(ASM_MESON_TAC[arith `&0 < x ==> ~(x = &0)`]);
AP_TERM_TAC;
SUBGOAL_THEN `&0 <
sqrt (x1 /
delta_x x1 x2 x3 x4 x5 x6)` ASSUME_TAC;
GMATCH_SIMP_TAC
SQRT_POS_LT;
GMATCH_SIMP_TAC
REAL_LT_DIV;
BY(ASM_REWRITE_TAC[]);
SUBGOAL_THEN `
sqrt (&4 * x1 *
chi_x x4 x5 x3 x1 x2 x6 pow 2 / (&4 *
delta_x x1 x2 x3 x4 x5 x6)) = (
sqrt (x1 /delta_x x1 x2 x3 x4 x5 x6)) * abs(
chi_x x4 x5 x3 x1 x2 x6)` SUBST1_TAC;
REWRITE_TAC[ GSYM
POW_2_SQRT_ABS ];
GMATCH_SIMP_TAC (GSYM
SQRT_MUL);
REWRITE_TAC[
REAL_LE_POW_2];
GMATCH_SIMP_TAC
REAL_LE_DIV;
ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`];
AP_TERM_TAC;
Calc_derivative.CALC_ID_TAC;
ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`];
BY(REAL_ARITH_TAC);
SUBGOAL_THEN `-- (x1 * (-- x1 + x2 + x6)) =
sqrt(x1 /
delta_x x1 x2 x3 x4 x5 x6) * (
sqrt (x1 *
delta_x x1 x2 x3 x4 x5 x6) * (x1 - x2 - x6))` SUBST1_TAC;
ONCE_REWRITE_TAC[arith `x * y * z = (z * (x * y))`];
GMATCH_SIMP_TAC (GSYM
SQRT_MUL);
GMATCH_SIMP_TAC
REAL_LE_MUL;
GMATCH_SIMP_TAC
REAL_LE_DIV;
ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`];
SUBGOAL_THEN `x1 /
delta_x x1 x2 x3 x4 x5 x6 * x1 *
delta_x x1 x2 x3 x4 x5 x6 = x1 pow 2` SUBST1_TAC;
Calc_derivative.CALC_ID_TAC;
BY(ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]);
GMATCH_SIMP_TAC
POW_2_SQRT;
CONJ_TAC;
BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]);
BY(REAL_ARITH_TAC);
MATCH_MP_TAC Trigonometry1.ATN2_LMUL_EQ;
BY(ASM_REWRITE_TAC[])
]);;
(* }}} *)
(*
let dih_circumrad = prove_by_refinement(
`!x1 x2 x3 x4 x5 x6 r.
rad2_x x1 x2 x3 x4 x5 x6 = r ==>
dih_x x1 x2 r r r x6 + dih_x x1 r x3 r x5 r = dih_x x1 x2 x3 x4 x5 x6`,
(* {{{ proof *)
[
rt[Sphere.dih_x;LET_DEF;LET_END_DEF;Sphere.rad2_x]
]);;
(* }}} *)
*)
let gamma23_full8_x_gamma = prove_by_refinement(
(add_hyp ["GRKIBMP A V2"] `!y1 y2 y3 y4 y5 y6 .
eta_y y1 y2 y6 pow 2 < &2 /\
eta_y y1 y3 y5 pow 2 < &2 /\
&2 <= rad2_y y1 y2 y3 y4 y5 y6 /\
dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2 <= dih_y y1 y2 y3 y4 y5 y6
==>
ineq [
(&2 * hminus, y1, &2 * hplus);
(&2 ,y2,&2 * hminus);
(&2,y3,&2 * hminus);
(&2,y4,sqrt8);
(&2,y5,&2 * hminus);
(&2,y6,&2 * hminus)
]
(
y_of_x (gamma23_full8_x (h0cut y1)) y1 y2 y3 y4 y5 y6 <=
gamma3f y1 y2 y6 sqrt2 lmfun + gamma3f y1 y3 y5 sqrt2 lmfun +
(dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2) * gamma2_x_div_azim_v2 (h0cut y1) (y1* y1))`)
,
(* {{{ proof *)
[
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x];
REPEAT (GMATCH_SIMP_TAC (GSYM gamma3_x_gamma3f));
ASM_SIMP_TAC[y_bounds];
REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlinear_lemma.sqrt2_sqrt2];
MATCH_MP_TAC( arith `u <= v ==> (x + y + u <= x + y + v)`);
REWRITE_TAC[ arith `x - (y + z) = x - y - z`];
GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP;
CONJ2_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`&1`;`&1`;`&1`;`&1`;`&1`]);
ASM_SIMP_TAC[y_bounds;arith `&1 <= &1`];
REWRITE_TAC[Functional_equation.nonf_gamma2_x1_div_a_v2;Sphere.y_of_x];
BY(REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `dih_y` MP_TAC;
REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF];
REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let undiv_gamma3 = prove_by_refinement(
`!y4 y5 y6 w.
&2 <= y4 /\
&2 <= y5 /\
&2 <= y6 /\
y4 <= &2 *
sqrt (&2) /\
y5 <= &2 *
sqrt (&2) /\
y6 <= &2 * hminus /\
eta_x (y4 * y4) (y5 * y5) (y6 * y6) <
sqrt (&2) /\
#0.008 *y_of_x
dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6 <
y_of_x (
gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (&1)) sqrt2 sqrt2 sqrt2 y4 y5 y6 / w ==> #0.008 *
dih_y y4 sqrt2 y6 sqrt2 y5 sqrt2 < gamma3f y4 y5 y6 sqrt2 lmfun /w`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
GMATCH_SIMP_TAC
gamma3f_gamma3f_x_div_sqrtdelta;
GEXISTL_TAC [`sqrt2 * sqrt2`;`sqrt2 * sqrt2`;`sqrt2 * sqrt2`];
ASM_SIMP_TAC[
y_bounds];
REWRITE_TAC[Sphere.dih_y;
LET_DEF;
LET_END_DEF];
REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2];
GMATCH_SIMP_TAC
dih_x_dih_x_div_sqrtdelta_posbranch;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
SUBGOAL_THEN `
delta_x4 (y4 * y4) (y5 * y5) (&2) (&2) (&2) (y6 * y6) =
delta_x4 (y4*y4) (&2) (y5 * y5) (&2) (y6*y6) (&2)` SUBST1_TAC;
REWRITE_TAC[Sphere.delta_x4];
BY((REAL_ARITH_TAC));
GMATCH_SIMP_TAC (* Merge_ineq *)
delta_x4_pos;
GMATCH_SIMP_TAC
REAL_LT_MUL_EQ;
ASM_SIMP_TAC[
y_bounds];
REWRITE_TAC[arith `&4 = &2 * &2 /\ &8 = #8.0`;GSYM Nonlinear_lemma.sqrt8_2];
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE;
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE;
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE;
REWRITE_TAC[arith `abs(&2) = &2`];
GMATCH_SIMP_TAC (arith `&0 <= y ==> abs(y) = y`);
ASM_SIMP_TAC[
y_bounds];
SUBGOAL_THEN `y4 < sqrt8` ASSUME_TAC;
MATCH_MP_TAC
ETA_Y_LE_IMP_LT;
REWRITE_TAC[Sphere.eta_y;
LET_DEF;
LET_END_DEF];
GEXISTL_TAC [`y5`;`y6`];
ASM_SIMP_TAC[
y_bounds];
BY((ASM_SIMP_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]));
ASM_REWRITE_TAC[];
SUBGOAL_THEN `
delta_x (y4 * y4) (y5 * y5) (&2) (&2) (&2) (y6 * y6) =
delta_x (&2) (&2) (&2) (y4 * y4) (y5 * y5) (y6 * y6) ` SUBST1_TAC;
REWRITE_TAC[Sphere.delta_x];
BY((REAL_ARITH_TAC));
SUBGOAL_THEN `
delta_x (y4 * y4) (&2) (y6 * y6) (&2) (y5 * y5) (&2) =
delta_x (&2) (&2) (&2) (y4 * y4) (y5 * y5) (y6 * y6) ` SUBST1_TAC;
REWRITE_TAC[Sphere.delta_x];
BY((REAL_ARITH_TAC));
SUBCONJ_TAC;
GMATCH_SIMP_TAC (MESON[
ETA_Y_BOUNDS] `!y4 y5 y6. &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 /\
eta_y y4 y5 y6 < sqrt2 ==> &0 <
delta_x (&2) (&2) (&2) (y4 * y4) (y5*y5) (y6*y6)`);
REWRITE_TAC[Sphere.eta_y;
LET_DEF;
LET_END_DEF];
ASM_SIMP_TAC[
y_bounds];
BY((ASM_SIMP_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]));
DISCH_TAC;
INTRO_TAC Optimize.h0cutC [`y6`];
ASM_REWRITE_TAC[];
DISCH_THEN SUBST1_TAC;
ONCE_REWRITE_TAC[arith `(a * b * c < (e * b)/w) <=> (b * (a *c) < b * (e/w))`];
GMATCH_SIMP_TAC
REAL_LT_LMUL_EQ;
GMATCH_SIMP_TAC
SQRT_POS_LT;
ASM_REWRITE_TAC[];
FIRST_X_ASSUM_ST `
y_of_x` MP_TAC;
REWRITE_TAC[Sphere.y_of_x];
REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2];
BY((REWRITE_TAC[Nonlin_def.dih4_x_div_sqrtdelta_posbranch;Sphere.rotate4]))
]);;
(* }}} *)
let undiv_gamma3_nn = prove_by_refinement(
`!y4 y5 y6 w w'.
&0 < w' /\
&0 <= gamma3f y4 y5 y6 sqrt2 lmfun /\
&2 <= y4 /\
&2 <= y5 /\
&2 <= y6 /\
y4 <= &2 *
sqrt (&2) /\
y5 <= &2 *
sqrt (&2) /\
y6 <= &2 * hminus /\
eta_x (y4 * y4) (y5 * y5) (y6 * y6) <
sqrt (&2) /\
w' <= w /\
#0.008 *y_of_x
dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6 <
y_of_x (
gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (&1)) sqrt2 sqrt2 sqrt2 y4 y5 y6 / w ==> #0.008 *
dih_y y4 sqrt2 y6 sqrt2 y5 sqrt2 < gamma3f y4 y5 y6 sqrt2 lmfun /w'`,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
MATCH_MP_TAC
REAL_LTE_TRANS;
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `gamma3f y4 y5 y6 sqrt2 lmfun / w`)));
CONJ_TAC;
MATCH_MP_TAC
undiv_gamma3;
BY(ASM_REWRITE_TAC[]);
GMATCH_SIMP_TAC
REAL_LE_RDIV_EQ;
REWRITE_TAC[arith `x / y * z = (x * z) / y`];
GMATCH_SIMP_TAC
REAL_LE_LDIV_EQ;
GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP;
BY(ASM_MESON_TAC[arith `&0 < w' /\ w' <= w ==> &0 < w`])
]);;
(* }}} *)
(* final hypothesis is contained in cell3_from_ineq_thm *)
let cell3_008_from_ineq = `!y1 y2 y6.
&2 *hminus <= y1 /\ &2 <= y2 /\ &2 <= y6 /\
y1 <= &2 * hplus /\ y2 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\
eta_y (y1) (y2) (y6) < sqrt(&2) /\ &0 <= gamma3f y1 y2 y6 sqrt2 lmfun ==>
dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 * #0.008 <= gamma3f y1 y2 y6 sqrt2 lmfun / &(wtcount3_y y1 y2 y6)`;;
let cell3_008 =
add_hyp [ "QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";(* "CJFZZDW"; *)]
cell3_008_from_ineq;;
(*
g cell3_008;;
g (mk_imp(`pack_nonlinear_non_ox3q1h`,cell3_008_from_ineq));;
*)
SUBGOAL_THEN `!(p:real->real->real->bool). (!y1 y2 y6. p y1 y2 y6 ==> p y1 y6 y2) /\ (!y1 y2 y6. y6 <= y2 ==> p y1 y2 y6) ==> (!y1 y2 y6. p y1 y2 y6)` MATCH_MP_TAC;
BY(MESON_TAC[arith `y <= x \/ x <= y`]);
CONJ_TAC;
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `( /\ )` MP_TAC;
ASM_SIMP_TAC[];
SUBGOAL_THEN `gamma3f y1 y2 y6 sqrt2 lmfun = gamma3f y1 y6 y2 sqrt2 lmfun` SUBST1_TAC;
BY(ASM_MESON_TAC[(* Merge_ineq *) gamma3f_sym]);
ASM_REWRITE_TAC[];
ANTS_TAC;
BY(ASM_MESON_TAC[Collect_geom.ETA_Y_SYYM]);
SUBGOAL_THEN `dih_y y1 y6 sqrt2 sqrt2 sqrt2 y2 = dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6` SUBST1_TAC;
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]);
SUBGOAL_THEN `wtcount3_y y1 y6 y2 = wtcount3_y y1 y2 y6` SUBST1_TAC;
REWRITE_TAC[Sphere.wtcount3_y];
BY(ARITH_TAC);
BY(MESON_TAC[]);
REPEAT GEN_TAC;
DISCH_THEN BURY_TAC;
ABBREV_TAC `Q = (\y1 y2 y6. &2 * hminus <= y1 /\ &2 <= y2 /\ &2 <= y6 /\ y1 <= &2 * hplus /\ y2 <= &2 * sqrt (&2) /\ y6 <= &2 * sqrt (&2) /\ eta_y y1 y2 y6 < sqrt (&2))`;
DISCH_TAC;
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`Q y1 y2 y6`) ASSUME_TAC));
EXPAND_TAC "Q";
BY(BY((ASM_REWRITE_TAC[])));
INTRO_TAC ETA_Y_BOUNDS [`y1`;`y2`;`y6`];
ANTS_TAC;
BY(ASM_SIMP_TAC[y_bounds;Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]);
REPEAT WEAK_STRIP_TAC;
INTRO_TAC ETA_Y_LE_IMP_LT_ALL [`y1`;`y2`;`y6`];
ANTS_TAC;
BY((((ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2;y_bounds]))));
REPEAT WEAK_STRIP_TAC;
COMMENT "1. remove excess variables";
REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC);
REWRITE_TAC[ineq_constant];
REWRITE_TAC[ RIGHT_FORALL_IMP_THM];
REWRITE_TAC[MESON[] `(!y. (y = a ==> P y)) <=> P a`];
REPEAT WEAK_STRIP_TAC;
COMMENT "2. insert Q";
REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC);
REWRITE_TAC[arith `!x y. x > y <=> y < x`;arith `!x y. x >= y <=> y <= x`];
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!P. (!y4 y5 y6. P y4 y5 y6) ==> (!y4 y5 y6. Q y4 y5 y6 ==> P y4 y5 y6)`) MP_TAC));
BY((((MESON_TAC[]))));
DISCH_THEN (fun t -> (REPEAT (DISCH_THEN (ASSUME_TAC o (MATCH_MP t)))));
COMMENT "3. remove eta_y";
GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6 \/ &2 < eta_y y4 y5 y6 pow 2)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6))`) MP_TAC));
REPEAT WEAK_STRIP_TAC;
GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4`;`y5`;`y6'`])))));
ASM_REWRITE_TAC[];
MATCH_MP_TAC ineq_monotone;
GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `~(&2 < eta_y y4 y5 y6' pow 2)`)));
BY((((MESON_TAC[]))));
MATCH_MP_TAC (arith `x < &2 ==> ~(&2 < x)`);
FIRST_X_ASSUM MP_TAC;
EXPAND_TAC "Q";
DISCH_TAC;
REWRITE_TAC[GSYM Nonlinear_lemma.sqrt2_sqrt2];
REWRITE_TAC[arith `x pow 2 = x * x`];
GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE;
GMATCH_SIMP_TAC (arith `&0 <= x ==> (abs x = x)`);
ASM_REWRITE_TAC[Sphere.sqrt2];
MATCH_MP_TAC eta_y_nn;
BY((((ASM_MESON_TAC[ETA_Y_BOUNDS;y_bounds;arith `x < y ==> x <= y`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]))));
DISCH_THEN (fun t -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP t CONJUNCTS_THEN2)))) THEN MP_TAC t);
MP_TAC (MESON[] `!y4 y5 y6. &2 < eta_y y4 y5 y6 pow 2 <=> (F \/ &2 < eta_y y4 y5 y6 pow 2)`);
DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM_ST `eta_y` (MP_TAC o (ONCE_REWRITE_RULE[t]))));
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MP_TAC;
(DISCH_THEN (fun t -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP t CONJUNCTS_THEN2)))) THEN MP_TAC t));
DISCH_THEN kill;
COMMENT "add weight counts";
SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(ASM_SIMP_TAC[y_bounds]);
SUBGOAL_THEN `y6 < &2 * hminus` ASSUME_TAC;
REWRITE_TAC[arith `x < y <=> ~(y <= x)`];
DISCH_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y6`]);
ASM_SIMP_TAC[y_bounds;Sphere.ineq];
ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2];
REWRITE_TAC[TAUT `(~(a ==> ~b)) <=> (a /\ b)`];
CONJ2_TAC;
BY(ASM_MESON_TAC[arith `x <= y /\ y <= z ==> x <= z`]);
BY(ASM_MESON_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2;y_bounds]);
SUBGOAL_THEN `~critical_edge_y y6` ASSUME_TAC;
BY(ASM_REWRITE_TAC[Sphere.critical_edge_y;arith `x <= y <=> ~(y < x)`]);
SUBGOAL_THEN `wtcount3_y y1 y2 y6 = if critical_edge_y y2 then 2 else 1` ASSUME_TAC;
ASM_REWRITE_TAC[Sphere.wtcount3_y];
BY(COND_CASES_TAC THEN TRY (ARITH_TAC));
COMMENT "4. apply undiv_gamma3";
MATCH_MP_TAC (arith `a * b < c ==> b * a <= c`);
SUBGOAL_THEN `dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 = dih_y y1 sqrt2 y6 sqrt2 y2 sqrt2` SUBST1_TAC;
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]);
MATCH_MP_TAC undiv_gamma3_nn;
ASM_SIMP_TAC[y_bounds];
REWRITE_TAC[RIGHT_EXISTS_AND_THM];
CONJ_TAC;
BY(COND_CASES_TAC THEN REAL_ARITH_TAC);
CONJ_TAC;
FIRST_X_ASSUM_ST `eta_y` MP_TAC;
BY(REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]);
COMMENT "5. split along y2";
ASM_CASES_TAC `y2 < &2 * hminus`;
SUBGOAL_THEN `~critical_edge_y y2` (unlist REWRITE_TAC);
REWRITE_TAC[Sphere.critical_edge_y];
BY(ASM_SIMP_TAC[arith `x < y ==> ~(y <= x)`]);
EXISTS_TAC `&1`;
REWRITE_TAC[arith `&1 <= &1`];
SUBGOAL_THEN `h0cut y2 = &1` SUBST1_TAC;
MATCH_MP_TAC Optimize.h0cutC;
BY(ASM_SIMP_TAC[arith `x < y ==> (x <= y)`]);
REWRITE_TAC[arith `x/ &1 = x`];
FIRST_X_ASSUM_ST `h0cut` MP_TAC;
REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`];
DISCH_THEN MATCH_MP_TAC;
BY(ASM_SIMP_TAC [arith `x < y ==> x <= y`]);
COMMENT "5a. second half of split";
EXISTS_TAC `&2`;
CONJ_TAC;
BY(COND_CASES_TAC THEN REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `x / &2 ` MP_TAC;
REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`];
DISCH_THEN MATCH_MP_TAC;
BY(ASM_SIMP_TAC [arith `~(x < y) ==> y <= x`;arith `x < y ==> x<= y`])
]);;
(* }}} *)
"QZECFIC wt2 A";"CIHTIUM"])));
DISCH_THEN MATCH_MP_TAC;
(ASM_REWRITE_TAC[]);
FIRST_X_ASSUM MATCH_MP_TAC;
ASM_REWRITE_TAC[];
CONJ_TAC;
FIRST_X_ASSUM_ST `hminus` MP_TAC;
MP_TAC Nonlinear_lemma.hminus_gt;
BY(REAL_ARITH_TAC);
BY(ASM_MESON_TAC[y_bounds])
]);;
(* }}} *)
let gamma23_keep135_x_gamma = prove_by_refinement(
(add_hyp ["GRKIBMP A V2"] `!y1 y2 y3 y4 y5 y6 .
eta_y y1 y2 y6 pow 2 < &2 /\
eta_y y1 y3 y5 pow 2 < &2 /\
&2 <= rad2_y y1 y2 y3 y4 y5 y6 /\
dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 * #0.008 <= gamma3f y1 y2 y6 sqrt2 lmfun / &(wtcount3_y y1 y2 y6) /\
dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2 <= dih_y y1 y2 y3 y4 y5 y6
==>
ineq [
(&2 * hminus, y1, &2 * hplus);
(&2 ,y2,sqrt8);
(&2,y3,&2 * hminus);
(&2,y4,sqrt8);
(&2,y5,&2 * hminus);
(&2,y6,sqrt8)
]
(
y_of_x (gamma23_keep135_x (h0cut y1)) y1 y2 y3 y4 y5 y6 <=
gamma3f y1 y2 y6 sqrt2 lmfun / &(wtcount3_y y1 y2 y6) + gamma3f y1 y3 y5 sqrt2 lmfun +
(dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2) * gamma2_x_div_azim_v2 (h0cut y1) (y1* y1))`),
(* {{{ proof *)
[
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Functional_equation.nonf_gamma23_keep135_x;Sphere.y_of_x];
REPEAT (GMATCH_SIMP_TAC (GSYM gamma3_x_gamma3f));
ASM_SIMP_TAC[y_bounds];
MATCH_MP_TAC (arith `u <= w + v ==> (x + u <= w + x + v)`);
MATCH_MP_TAC (arith `(?f1 f2. f1 + f2 = f /\ f1 <= x /\ f2 <= y) ==> f <= x + y`);
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 * #0.008`)));
GOAL_TERM (fun w -> (EXISTS_TAC ( env w `(dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2) * #0.008 `)));
REPEAT (FIRST_X_ASSUM_ST `dih_y` MP_TAC);
REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlinear_lemma.sqrt2_sqrt2];
REPEAT WEAK_STRIP_TAC;
ASM_REWRITE_TAC[];
CONJ_TAC;
BY(REAL_ARITH_TAC);
GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP;
CONJ_TAC;
FIRST_X_ASSUM MP_TAC;
BY(REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `gamma2_x1_div_a_v2` (C INTRO_TAC [`y1`;`&1`;`&1`;`&1`;`&1`;`&1`]);
ASM_SIMP_TAC[y_bounds;arith `&1 <= &1`];
REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonf_gamma2_x1_div_a_v2];
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
(* ========================================================================== *)
(* MATERIAL ADDED FEB 2013 *)
(* ========================================================================== *)
let ineq_critical_edge2 = prove_by_refinement(
`!u v y f.
( y < &2 * hminus ==>
ineq (
APPEND u (CONS (&2,y,&2 * hminus) v)) f) /\
ineq (
APPEND u (CONS (&2 * hminus,y,sqrt8) v)) f ==>
ineq (
APPEND u (CONS (&2,y,sqrt8) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND;Sphere.critical_edge_y];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `(y <= &2 * hminus ==> y <= sqrt8) /\ (&2 * hminus <= y ==> &2 <= y)` ASSUME_TAC;
BY(ASM_SIMP_TAC[
y_bounds]);
DISJ_CASES_TAC (arith `y < &2 * hminus \/ &2 * hminus <= y`);
FIRST_X_ASSUM_ST `ineq` kill;
FIRST_X_ASSUM_ST `ineq` MP_TAC;
ASM_REWRITE_TAC[];
MATCH_MP_TAC
ineq_monotone;
BY(ASM_MESON_TAC[arith `y < x ==> y <= x`]);
FIRST_X_ASSUM_ST `ineq` MP_TAC;
MATCH_MP_TAC
ineq_monotone;
BY(ASM_MESON_TAC[])
]);;
(* }}} *)
let CRIT2_TAC n =
CHOP_LIST_TAC n THEN
MATCH_MP_TAC ( ineq_critical_edge2)
THEN ASM_REWRITE_TAC[APPEND];;
let ineq_critical_edge3 = prove_by_refinement(
`!u v y f.
( y < &2 * hminus ==>
ineq (
APPEND u (CONS (&2,y,&2 * hminus) v)) f) /\
( &2 * hplus < y ==>
ineq (
APPEND u (CONS (&2 * hplus,y,sqrt8) v)) f) /\
ineq (
APPEND u (CONS (&2 * hminus,y,&2 * hplus) v)) f ==>
ineq (
APPEND u (CONS (&2,y,sqrt8) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND;Sphere.critical_edge_y];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `(y <= &2 * hminus ==> y <= sqrt8) /\ (&2 * hminus <= y ==> &2 <= y)` ASSUME_TAC;
BY(ASM_SIMP_TAC[
y_bounds]);
SUBGOAL_THEN `(y <= &2 * hplus ==> y <= sqrt8) /\ (&2 * hplus < y ==> &2 <= y)` ASSUME_TAC;
MP_TAC
hminus_lt_hplus;
(MP_TAC
y_bounds);
REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2];
DISCH_THEN (C INTRO_TAC [`y`]);
REPEAT WEAK_STRIP_TAC;
CONJ_TAC;
BY(ASM_REWRITE_TAC[]);
DISCH_TAC;
FIRST_X_ASSUM MATCH_MP_TAC;
REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC);
BY(REAL_ARITH_TAC);
DISJ_CASES_TAC (arith `y < &2 * hminus \/ (&2 * hminus <= y /\ y <= &2 * hplus) \/ (&2 * hplus < y)`);
FIRST_X_ASSUM (fun t -> (FIRST_X_ASSUM (fun s -> MP_TAC (MATCH_MP t s) THEN ASSUME_TAC s)));
MATCH_MP_TAC
ineq_monotone;
BY(ASM_MESON_TAC[arith `y < x ==> y <= x`]);
FIRST_X_ASSUM DISJ_CASES_TAC;
FIRST_X_ASSUM_ST `ineq` MP_TAC;
MATCH_MP_TAC
ineq_monotone;
BY(ASM_MESON_TAC[]);
FIRST_X_ASSUM (fun t -> (FIRST_X_ASSUM (fun s -> MP_TAC (MATCH_MP t s) THEN ASSUME_TAC s)));
MATCH_MP_TAC
ineq_monotone;
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM MATCH_MP_TAC;
BY(ASM_MESON_TAC[arith `y < x ==> y <= x`])
]);;
(* }}} *)
let CRIT3_TAC n =
CHOP_LIST_TAC n THEN
MATCH_MP_TAC ( ineq_critical_edge3)
THEN ASM_REWRITE_TAC[APPEND];;
let ineq_critical_edge4 = prove_by_refinement(
`!u v y f.
( &2 * hplus < y ==>
ineq (
APPEND u (CONS (&2 * hplus,y,sqrt8) v)) f) /\
ineq (
APPEND u (CONS (&2 * hminus,y,&2 * hplus) v)) f ==>
ineq (
APPEND u (CONS (&2 * hminus,y,sqrt8) v)) f`,
(* {{{ proof *)
[
REWRITE_TAC[
ineq_APPEND;Sphere.critical_edge_y];
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `(y <= &2 * hminus ==> y <= sqrt8) /\ (&2 * hminus <= y ==> &2 <= y)` ASSUME_TAC;
BY(ASM_SIMP_TAC[
y_bounds]);
SUBGOAL_THEN `(y <= &2 * hplus ==> y <= sqrt8) /\ (&2 * hplus < y ==> &2 *hminus <= y)` ASSUME_TAC;
MP_TAC
hminus_lt_hplus;
(MP_TAC
y_bounds);
REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2];
DISCH_THEN (C INTRO_TAC [`y`]);
REPEAT WEAK_STRIP_TAC;
CONJ_TAC;
BY(ASM_REWRITE_TAC[]);
FIRST_X_ASSUM MP_TAC;
BY(REAL_ARITH_TAC);
DISJ_CASES_TAC (arith `(&2 * hplus < y) \/ (y <= &2 * hplus)`);
FIRST_X_ASSUM (fun t -> (FIRST_X_ASSUM (fun s -> MP_TAC (MATCH_MP t s) THEN ASSUME_TAC s)));
MATCH_MP_TAC
ineq_monotone;
BY(ASM_MESON_TAC[arith `y < x ==> y <= x`]);
FIRST_X_ASSUM_ST `ineq` MP_TAC;
MATCH_MP_TAC
ineq_monotone;
BY(ASM_MESON_TAC[])
]);;
(* }}} *)
let CRIT4_TAC n =
CHOP_LIST_TAC n THEN
MATCH_MP_TAC ( ineq_critical_edge4)
THEN ASM_REWRITE_TAC[APPEND];;
(* XX tchales 2013/2/16. I don't believe that 3803737830 is ever
used. I think it may be possible to delete! *)
(* QITNPEA4 series 3803737830.
We assume type QX, so exclude QU (quarters).
We use TSKAJXY to assume &0 <= gamma4fgcy. *)
(* Feb 2013. I don't think this gets used ...
let QITNPEA4_3803737830_concl = `!y1 y2 y3 y4 y5 y6.
ineq [(&2 * hminus, y1, &2 * hplus);
(&2 ,y2, sqrt8);
(&2,y3,sqrt8);
(&2,y4,sqrt8);
(&2,y5,sqrt8);
(&2,y6,sqrt8)]
(rad2_y y1 y2 y3 y4 y5 y6 < &2 /\
(~(y2 < &2 * hminus /\ y3 < &2 * hminus /\
y4 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus)) /\
(&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun )
==>
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) +
beta_bumpA_y y1 y2 y3 y4 y5 y6
- #0.0105256 + #0.00522841*dih_y y1 y2 y3 y4 y5 y6 > #0.0))`;;
let QITNPEA4_3803737830_full_hypl = [
"QITNPEA4 0 0 0 1 3803737830";
"QITNPEA4 0 0 1 0 3803737830";
"QITNPEA4 0 1 0 0 3803737830";
"QITNPEA4 1 0 0 0 3803737830";
"QITNPEA4 0 0 1 1 3803737830";
"QITNPEA4 0 1 0 1 3803737830";
"QITNPEA4 1 0 0 1 3803737830";
"QITNPEA4 0 1 1 0 3803737830";
"QITNPEA4 1 0 1 0 3803737830";
"QITNPEA4 1 1 0 0 3803737830";
"QITNPEA4 0 1 1 1 3803737830";
"QITNPEA4 1 0 1 1 3803737830";
"QITNPEA4 1 1 0 1 3803737830";
"QITNPEA4 1 1 1 0 3803737830";
"QITNPEA4 1 1 1 1 3803737830";
"QITNPEA4 3803737830 supercritical";
"CIHTIUM";
"FWGKMBZ";
];;
let QITNPEA4_3803737830_full = add_hyp
QITNPEA4_3803737830_full_hypl
QITNPEA4_3803737830_concl;;
let QITNPEA4_3803737830 = prove_by_refinement(
QITNPEA4_3803737830_full,
(* {{{ proof *)
[
REPEAT DISCH_TAC;
COMMENT "WLOG. y2 <= y6";
SUBGOAL_THEN `!(p:real->real->real->real->real->real->bool). ((!y1 y2 y3 y4 y5 y6. (p y1 y2 y3 y4 y5 y6 ==> p y1 y6 y5 y4 y3 y2)) /\ (!y1 y2 y3 y4 y5 y6. (y2 <= y6) ==> p y1 y2 y3 y4 y5 y6)) ==> (!y1 y2 y3 y4 y5 y6. p y1 y2 y3 y4 y5 y6)` MATCH_MP_TAC;
BY(MESON_TAC[arith `y <= x \/ x <= y`]);
CONJ_TAC;
REPEAT GEN_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC);
ASM_REWRITE_TAC[];
SUBGOAL_THEN `gamma4fgcy y1 y6 y5 y4 y3 y2 lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun` SUBST1_TAC;
BY(MESON_TAC[gamma4fgcy_sym23;gamma4fgcy_sym12;gamma4fgcy_sym03]);
SUBGOAL_THEN `wtcount6_y y1 y6 y5 y4 y3 y2 = wtcount6_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y] THEN ARITH_TAC);
SUBGOAL_THEN `beta_bumpA_y y1 y6 y5 y4 y3 y2 = beta_bumpA_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
REWRITE_TAC[ Sphere.beta_bumpA_y];
BY(REAL_ARITH_TAC);
SUBGOAL_THEN `dih_y y1 y6 y5 y4 y3 y2 = dih_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]);
SUBGOAL_THEN `rad2_y y1 y2 y3 y4 y5 y6 = rad2_y y1 y6 y5 y4 y3 y2` SUBST1_TAC;
BY(MESON_TAC[rad2_y_sym]);
REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC);
BY(MESON_TAC[]);
COMMENT "WLOG y2 < &2 * hminus";
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `delta_x` MP_TAC;
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `delta_x` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]);
REWRITE_TAC[Sphere.ineq;arith `x > &0 <=> &0 < x`;Sphere.y_of_x];
ASM_SIMP_TAC[y_bounds];
DISCH_TAC;
FIRST_X_ASSUM_ST `eta_y` (C INTRO_TAC [`&1`;`&1`;`&1`;`y1`;`y2`;`y6`]);
REWRITE_TAC[Sphere.ineq;arith `&1 <= &1`];
ASM_SIMP_TAC[y_bounds];
SUBGOAL_THEN `y1 <= sqrt8` ASSUME_TAC;
REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2];
BY(ASM_SIMP_TAC[y_bounds;Sphere.sqrt2]);
ASM_REWRITE_TAC[];
DISCH_TAC;
INTRO_TAC rad2_eta2 [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`];
ASM_SIMP_TAC[y_bounds;Sphere.delta_y];
DISCH_TAC;
ASM_CASES_TAC `&2 * hminus <= y2`;
FIRST_X_ASSUM_ST `>` MP_TAC;
ASM_REWRITE_TAC[];
ANTS_TAC;
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `eta_y` MP_TAC;
BY(REAL_ARITH_TAC);
COMMENT "remove rad2";
FIRST_X_ASSUM_ST `rad2_y` MP_TAC;
REWRITE_TAC[Sphere.rad2_y];
DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP (arith `x < &2 ==> ~(x > &2)`) t));
REPEAT (FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]));
ASM_REWRITE_TAC[];
(COMMENT "0 < weight");
SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(ASM_REWRITE_TAC[]);
SUBGOAL_THEN `&0 < &(wtcount6_y y1 y2 y3 y4 y5 y6)` ASSUME_TAC;
REWRITE_TAC[ REAL_OF_NUM_LT];
REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
ASM_REWRITE_TAC[];
BY(ARITH_TAC);
REPEAT WEAK_STRIP_TAC;
ASM_CASES_TAC `y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus`;
SUBGOAL_THEN `&2 * hminus <= y4` ASSUME_TAC;
FIRST_X_ASSUM MP_TAC;
REPEAT (FIRST_X_ASSUM_ST `~x` MP_TAC);
REWRITE_TAC[arith `&2 * hminus <= y4 <=> ~(y4 < &2 * hminus)`];
BY(REAL_ARITH_TAC);
SUBGOAL_THEN `~critical_edge_y y2 /\ ~critical_edge_y y3 /\ ~critical_edge_y y5 /\ ~critical_edge_y y6` ASSUME_TAC;
BY(ASM_SIMP_TAC[Sphere.critical_edge_y;arith `!x. x < &2 * hminus ==> ~(&2 * hminus <= x)`]);
SUBGOAL_THEN `wtcount6_y y1 y2 y3 y4 y5 y6 = if critical_edge_y y4 then (2) else (1)` SUBST1_TAC;
ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
BY(COND_CASES_TAC THEN ARITH_TAC);
SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = if critical_edge_y y4 then &1 * beta_bump_force_y y1 y2 y3 y4 y5 y6 else (&0)` SUBST1_TAC;
ASM_REWRITE_TAC[ Sphere.beta_bumpA_y;Sphere.beta_bump_force_y];
BY(COND_CASES_TAC THEN REAL_ARITH_TAC);
ASM_CASES_TAC `critical_edge_y y4`;
ASM_REWRITE_TAC[];
FIRST_X_ASSUM_ST `&1 * x` MP_TAC;
REWRITE_TAC[Sphere.ineq];
BY(ASM_SIMP_TAC[y_bounds;arith `!x. x < &2 * hminus ==> x <= &2 * hminus`]);
ASM_REWRITE_TAC[];
FIRST_X_ASSUM_ST `ineq` MP_TAC;
REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[y_bounds;arith `!x. x < &2 * hminus ==> x <= &2 * hminus`];
ANTS_TAC;
FIRST_X_ASSUM MP_TAC;
FIRST_X_ASSUM_ST `hminus` MP_TAC;
BY(MESON_TAC[Sphere.critical_edge_y;arith `~(y <= &2 * hplus) ==> &2 * hplus <= y`]);
BY(REAL_ARITH_TAC);
COMMENT "remove beta_bumpA_y";
SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0` SUBST1_TAC;
ASM_REWRITE_TAC[ Sphere.beta_bumpA_y];
FIRST_X_ASSUM MP_TAC;
REWRITE_TAC[DE_MORGAN_THM];
BY(COND_CASES_TAC THEN (TRY REAL_ARITH_TAC));
FIRST_X_ASSUM_ST `ineq` kill;
REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC);
REWRITE_TAC[arith `&0 * x = &0`];
REPEAT DISCH_TAC;
COMMENT "fix weights";
SUBGOAL_THEN `!a w' f g. ineq a (f / &w' + g > #0.0) ==> ineq a (&0 <= f /\ wtcount6_y y1 y2 y3 y4 y5 y6 <= w') ==> ineq a (f / &(wtcount6_y y1 y2 y3 y4 y5 y6) + g > #0.0)` MP_TAC;
REPEAT GEN_TAC;
DISCH_TAC;
MATCH_MP_TAC ineq_MP;
FIRST_X_ASSUM MP_TAC;
MATCH_MP_TAC ineq_monotone;
REPEAT WEAK_STRIP_TAC;
ENOUGH_TO_SHOW_TAC `f/ &w' <= f/ &(wtcount6_y y1 y2 y3 y4 y5 y6)`;
REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC);
BY(REAL_ARITH_TAC);
REWRITE_TAC[real_div];
GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC REAL_LE_INV2;
ASM_REWRITE_TAC[];
REWRITE_TAC[ REAL_OF_NUM_LE];
BY(ASM_REWRITE_TAC[]);
FIRST_X_ASSUM_ST `&1 * x` kill;
DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM_ST `ineq` (fun s -> MP_TAC(MATCH_MP t s))));
ASM_REWRITE_TAC[ineq_T];
REPEAT WEAK_STRIP_TAC;
ABBREV_TAC `ccc = (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + &0 - #0.0105256 + #0.00522841 * dih_y y1 y2 y3 y4 y5 y6 > #0.0)`;
FIRST_X_ASSUM kill;
COMMENT "make strict ineqs";
ENOUGH_TO_SHOW_TAC `ineq [(&2 * hminus, y1, &2 * hplus); (&2 ,y2, &2 * hminus); (&2,y3,sqrt8); (&2,y4,sqrt8); (&2,y5,sqrt8); (&2,y6,sqrt8)] ccc`;
REWRITE_TAC[Sphere.ineq];
BY(ASM_SIMP_TAC[arith `~(x <= y2) ==> (y2 <= x)`]);
SUBGOAL_THEN `(( y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) ==> ineq [&2 * hminus,y1,&2 * hplus; &2,y2,&2 * hminus; &2 ,y3,&2 * hminus;&2,y4,&2 * hminus; &2 ,y5,&2 * hminus; &2 ,y6,&2 * hminus] ccc) /\ (( y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) ==> ineq [&2 * hminus,y1,&2 * hplus; &2,y2,&2 * hminus; &2 ,y3,&2 * hminus;&2 * hminus,y4,sqrt8; &2 ,y5,&2 * hminus; &2 ,y6,&2 * hminus] ccc)` MP_TAC;
REWRITE_TAC[Sphere.ineq;Sphere.critical_edge_y];
FIRST_X_ASSUM_ST `~x` MP_TAC;
MP_TAC hminus_lt_hplus;
BY(REAL_ARITH_TAC);
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `~critical_edge_y y2 /\ y2 < &2 * hminus` MP_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(ASM_SIMP_TAC[ arith `~(x <= y2) ==> (y2 < x)`]);
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(REAL_ARITH_TAC);
COMMENT "split cases";
CRIT2_TAC 2 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN CRIT2_TAC 3 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN CRIT2_TAC 4 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN CRIT2_TAC 5 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN (TRY (FIRST_X_ASSUM MATCH_MP_TAC)) THEN (REPEAT (FIRST_X_ASSUM_ST `ineq` kill)) THEN ASM_REWRITE_TAC[Sphere.ineq;Sphere.wtcount6_y;Sphere.wtcount3_y] THEN REPEAT WEAK_STRIP_TAC THEN ASM_SIMP_TAC[] THEN TRY(ARITH_TAC);
REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC);
BY(MESON_TAC[]);
REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC);
BY(MESON_TAC[])
]);;
(* }}} *)
*)
(* I don't think this gets used. Feb 2013.
let QITNPEA4_3803737830_ALT = prove_by_refinement(
(mk_imp (`pack_nonlinear_non_ox3q1h`,QITNPEA4_3803737830_concl)),
(* {{{ proof *)
[
REPEAT WEAKER_STRIP_TAC;
MP_TAC QITNPEA4_3803737830;
ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h QITNPEA4_3803737830_full_hypl);
BY(DISCH_THEN (unlist REWRITE_TAC))
]);;
(* }}} *)
*)
let QITNPEA1_9063653052_concl = `!y1 y2 y3 y4 y5 y6.
ineq [(&2 * hminus, y1, &2 * hplus);
(&2 ,y2, &2 * hminus);
(&2* hminus,y3,sqrt8);
(&2,y4,sqrt8);
(&2,y5,&2 * hminus);
(&2,y6,&2 * hminus)]
(rad2_y y1 y2 y3 y4 y5 y6 < &2 /\
(&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun ) /\
(y2 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus)
==>
(gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6)
> #0.0057))`;;
let QITNPEA1_9063653052_hypl =
[
"QITNPEA1 1 0 9063653052 A";
"QITNPEA1 1 1 9063653052 A";
"QITNPEA1 1 2 9063653052 A";
"QITNPEA1 2 0 9063653052 A";
"QITNPEA1 2 1 9063653052 A";
"QITNPEA1 2 2 9063653052 A";
] ;;
let QITNPEA1_9063653052_full = add_hyp
QITNPEA1_9063653052_hypl
QITNPEA1_9063653052_concl;;
let QITNPEA_9063653052_weak = prove_by_refinement(
QITNPEA1_9063653052_full,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
COMMENT "remove rad2";
FIRST_X_ASSUM_ST `rad2_y` MP_TAC;
REWRITE_TAC[Sphere.rad2_y];
DISCH_THEN (ASSUME_TAC o (MATCH_MP (arith `x < &2 ==> ~(x > &2)`)));
REPEAT (FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]));
ASM_REWRITE_TAC[];
(COMMENT "0 < weight");
SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(ASM_REWRITE_TAC[]);
SUBGOAL_THEN `&0 < &(wtcount6_y y1 y2 y3 y4 y5 y6)` ASSUME_TAC;
REWRITE_TAC[ REAL_OF_NUM_LT];
REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
ASM_REWRITE_TAC[];
BY(ARITH_TAC);
REPEAT WEAK_STRIP_TAC;
COMMENT "fix weights";
SUBGOAL_THEN `!a w' f . ineq a (f / &w' > #0.0057) ==> ineq a (&0 <= f /\ wtcount6_y y1 y2 y3 y4 y5 y6 <= w') ==> ineq a (f / &(wtcount6_y y1 y2 y3 y4 y5 y6) > #0.0057)` MP_TAC;
REPEAT GEN_TAC;
DISCH_TAC;
MATCH_MP_TAC ineq_MP;
FIRST_X_ASSUM MP_TAC;
MATCH_MP_TAC ineq_monotone;
REPEAT WEAK_STRIP_TAC;
ENOUGH_TO_SHOW_TAC `f/ &w' <= f/ &(wtcount6_y y1 y2 y3 y4 y5 y6)`;
REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC);
BY(REAL_ARITH_TAC);
REWRITE_TAC[real_div];
GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP;
ASM_REWRITE_TAC[];
GMATCH_SIMP_TAC REAL_LE_INV2;
ASM_REWRITE_TAC[];
REWRITE_TAC[ REAL_OF_NUM_LE];
BY(ASM_REWRITE_TAC[]);
DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM_ST `ineq` (fun s -> MP_TAC(MATCH_MP t s))));
ASM_REWRITE_TAC[ineq_T];
REPEAT WEAK_STRIP_TAC;
ABBREV_TAC `ccc = (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) > #0.0057)`;
FIRST_X_ASSUM kill;
COMMENT "make strict ineqs";
ENOUGH_TO_SHOW_TAC `ineq [(&2 * hminus, y1, &2 * hplus); (&2 ,y2, &2 * hminus); (&2* hminus,y3,sqrt8); (&2,y4,sqrt8); (&2,y5,&2 * hminus); (&2,y6,&2 * hminus)] ccc`;
REWRITE_TAC[Sphere.ineq];
BY(ASM_REWRITE_TAC[]);
SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(REAL_ARITH_TAC);
SUBGOAL_THEN `!y. &2 * hplus < y ==> ~critical_edge_y y` ASSUME_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(REAL_ARITH_TAC);
SUBGOAL_THEN `~critical_edge_y y2 /\ ~critical_edge_y y5 /\ ~critical_edge_y y6` MP_TAC;
FIRST_X_ASSUM kill;
BY(ASM_MESON_TAC[]);
REPEAT STRIP_TAC;
BY(CRIT3_TAC 3 THEN REPEAT CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN TRY(CRIT4_TAC 2 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC) THEN TRY(FIRST_X_ASSUM MATCH_MP_TAC) THEN (REPEAT (FIRST_X_ASSUM_ST `ineq` kill)) THEN ASM_REWRITE_TAC[Sphere.ineq;Sphere.wtcount6_y;Sphere.wtcount3_y] THEN REPEAT WEAK_STRIP_TAC THEN ASM_SIMP_TAC[] THEN TRY(ARITH_TAC))
]);;
(* }}} *)
let QITNPEA4_9063653052_weak_ALT = prove_by_refinement(
(mk_imp (`pack_nonlinear_non_ox3q1h`,QITNPEA1_9063653052_concl)),
(* {{{ proof *)
[
REPEAT WEAKER_STRIP_TAC;
MP_TAC QITNPEA_9063653052_weak;
ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h QITNPEA1_9063653052_hypl);
BY(DISCH_THEN (unlist REWRITE_TAC))
]);;
(* }}} *)
let g_qxd_concl =
`!y1 y2 y3 y4 y5 y6.
ineq [(&2 * hminus,y1, &2 * hplus);
(&2,y2, sqrt8);
(&2,y3, sqrt8);
(&2,y4, sqrt8);
(&2,y5, sqrt8);
(&2,y6, sqrt8)
]
(#2.3 < dih_y y1 y2 y3 y4 y5 y6 ==>
#0.0057 < gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + beta_bumpA_y y1 y2 y3 y4 y5 y6)`;;
let g_qxd_hypl = [
"BIXPCGW 7080972881 a2";
"BIXPCGW 1738910218 a2";
"BIXPCGW 7274157868 a";
];;
let g_qxd_full = add_hyp g_qxd_hypl g_qxd_concl;;
let g_qxd = prove_by_refinement(
g_qxd_full,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
CRIT2_TAC 1;
CONJ2_TAC;
REPLICATE_TAC 2 (FIRST_X_ASSUM kill);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]);
REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[];
BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC);
DISCH_TAC;
CRIT2_TAC 2;
CONJ2_TAC;
REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `ineq` kill);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]);
REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[y_bounds];
FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`)));
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]);
DISCH_TAC;
CRIT2_TAC 4;
CONJ2_TAC;
REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `ineq` kill);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y5`;`y6`;`y4`;`y2`;`y3`]);
REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[y_bounds];
FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`)));
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]);
DISCH_TAC;
CRIT2_TAC 5;
CONJ2_TAC;
REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `ineq` kill);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y6`;`y5`;`y4`;`y3`;`y2`]);
REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[y_bounds];
FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`)));
BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]);
DISCH_TAC;
ASM_CASES_TAC `y4 <= &2 * hplus`;
FIRST_X_ASSUM_ST `ineq` kill;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]);
REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[y_bounds];
FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`)));
BY(MESON_TAC[]);
SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC;
BY(REWRITE_TAC[Sphere.critical_edge_y] THEN REAL_ARITH_TAC);
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC;
BY(REWRITE_TAC[Sphere.critical_edge_y] THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC);
SUBGOAL_THEN `~critical_edge_y y4` ASSUME_TAC;
BY(REWRITE_TAC[Sphere.critical_edge_y] THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC);
SUBGOAL_THEN `wtcount6_y y1 y2 y3 y4 y5 y6 = 1` SUBST1_TAC;
ASM_SIMP_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
BY(ARITH_TAC);
SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0` SUBST1_TAC;
ASM_SIMP_TAC[Sphere.beta_bumpA_y];
BY(REAL_ARITH_TAC);
REWRITE_TAC[arith `x / &1 = x /\ x + &0 = x`];
REWRITE_TAC[arith `x < y <=> y > x`];
FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]);
REWRITE_TAC[Sphere.ineq];
ASM_SIMP_TAC[y_bounds];
BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)
]);;
(* }}} *)
let g_qxd_ALT = prove_by_refinement(
(mk_imp (`pack_nonlinear_non_ox3q1h`,g_qxd_concl)),
(* {{{ proof *)
[
REPEAT WEAKER_STRIP_TAC;
MP_TAC g_qxd;
ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h g_qxd_hypl);
BY(DISCH_THEN (unlist REWRITE_TAC))
]);;
(* }}} *)
let gamma_qx_concl = `!y1 y2 y3 y4 y5 y6. ineq
[(&2 * hminus, y1, &2 * hplus);
(&2,y2,sqrt8);
(&2,y3,sqrt8);
(&2,y4,sqrt8);
(&2,y5,sqrt8);
(&2,y6,sqrt8)
]
((rad2_y y1 y2 y3 y4 y5 y6 < &2) /\
~(y2 < &2 * hminus /\ y3 < &2 * hminus /\ y4 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus)
==> (&0 < gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + beta_bumpA_y y1 y2 y3 y4 y5 y6))`;;
let gamma_qx_hypl = [
"GLFVCVK4 2477216213";
"GLFVCVK4a 8328676778";
];;
let gamma_qx_full = add_hyp gamma_qx_hypl gamma_qx_concl;;
let gamma_qx = prove_by_refinement(
gamma_qx_full,
(* {{{ proof *)
[
REPEAT WEAK_STRIP_TAC;
REWRITE_TAC[Sphere.ineq];
REPEAT WEAK_STRIP_TAC;
REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]));
REPEAT WEAK_STRIP_TAC;
SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC;
REWRITE_TAC[Sphere.critical_edge_y];
BY(ASM_SIMP_TAC[]);
SUBGOAL_THEN `&0 < &(wtcount6_y y1 y2 y3 y4 y5 y6)` ASSUME_TAC;
REWRITE_TAC[ REAL_OF_NUM_LT];
REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
ASM_REWRITE_TAC[];
BY(ARITH_TAC);
COMMENT "case wt2-beta";
ASM_CASES_TAC `y2 < &2 * hminus /\ y3 < &2 * hminus /\ critical_edge_y y4 /\ y5 < &2 * hminus /\ y6 < &2 * hminus`;
SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC;
BY(REWRITE_TAC[Sphere.critical_edge_y] THEN REAL_ARITH_TAC);
SUBGOAL_THEN `wtcount6_y y1 y2 y3 y4 y5 y6 = 2` SUBST1_TAC;
ASM_SIMP_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y];
BY(ARITH_TAC);
SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = beta_bump_force_y y1 y2 y3 y4 y5 y6` SUBST1_TAC;
ASM_SIMP_TAC[Sphere.beta_bumpA_y;Sphere.beta_bump_force_y];
BY(REAL_ARITH_TAC);
FIRST_X_ASSUM_ST `ineq` MP_TAC;
ASM_SIMP_TAC[Sphere.ineq;arith `x < y ==> x <= y`];
ASM_SIMP_TAC[GSYM Sphere.rad2_y;arith `x < y ==> ~( x > y)`];
REWRITE_TAC[arith `x > y <=> y < x`];
DISCH_THEN MATCH_MP_TAC;
BY(ASM_MESON_TAC[Sphere.critical_edge_y]);
COMMENT "beta_bumpA_y =0";
SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0` SUBST1_TAC;
REWRITE_TAC[Sphere.beta_bumpA_y];
REPEAT COND_CASES_TAC THEN TRY(REAL_ARITH_TAC);
BY(ASM_MESON_TAC[]);
REWRITE_TAC[arith `x + &0 = x`];
GMATCH_SIMP_TAC REAL_LT_DIV;
ASM_REWRITE_TAC[];
FIRST_X_ASSUM_ST `ineq` kill;
FIRST_X_ASSUM_ST `ineq` MP_TAC;
ASM_SIMP_TAC[Sphere.ineq;y_bounds];
ASM_REWRITE_TAC[GSYM Sphere.rad2_y];
SUBGOAL_THEN `~(norm2hh y1 y2 y3 y4 y5 y6 < (hplus - hminus) pow 2)` (unlist REWRITE_TAC);
DISCH_TAC;
FIRST_X_ASSUM (MP_TAC o (MATCH_MP quarter_norm2hh));
BY(ASM_MESON_TAC[]);
FIRST_X_ASSUM_ST `rad2_y` MP_TAC;
BY(REAL_ARITH_TAC)
]);;
(* }}} *)
let gamma_qx_ALT = prove_by_refinement(
(mk_imp (`pack_nonlinear_non_ox3q1h`,gamma_qx_concl)),
(* {{{ proof *)
[
REPEAT WEAKER_STRIP_TAC;
MP_TAC gamma_qx;
ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h gamma_qx_hypl);
BY(DISCH_THEN (unlist REWRITE_TAC))
]);;
(* }}} *)
end;;