(* ========================================================================== *)
(* FLYSPECK - BOOK FORMALIZATION *)
(* *)
(* Definitions: *)
(* Chapter: Local Fan *)
(* Author: Truong Nguyen Quang *)
(* Date: 2010-03 - 30 *)
(* ========================================================================== *)
(* needs "/home/user1/flyspeck/working/flyspeck_needs.hl";; *)
(* =========== snapshot 1631 ===================== *)
let build_sequence =
["general/sphere.hl";
"general/prove_by_refinement.hl";
"trigonometry/trig1.hl";
"trigonometry/trig2.hl";
"hypermap/hypermap.hl";
"fan/introduction.hl";
"fan/topology.hl"];;
map flyspeck_needs build_sequence;;
module type Wrgcvdr_cizmrrh = sig
end;;
module Wrgcvdr_cizmrrh = struct
open Sphere;;
open Trigonometry1;;
open Trigonometry2;;
open Hypermap;;
open Fan;;
open Topology;;
open Prove_by_refinement;;
let SET_TAC = let basicthms =
[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT;
IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in
let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @
[IN_ELIM_THM; IN] in
let PRESET_TAC =
TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN
REPEAT COND_CASES_TAC THEN
REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN
REWRITE_TAC allthms in
fun ths ->
PRESET_TAC THEN
(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN
MESON_TAC ths ;;
(* =========== improved SET_RULE ============= *)
let TR_SET_RULE a = fun x -> prove(x, SET_TAC a );;
let SET_RULE tm = prove(tm,SET_TAC[]);;
let all_hy_map = let t1 = CONJ dart edge_map in
let t2 = CONJ t1 node_map in
CONJ t2 face_map;;
let SPEC_HY_ELEMS = prove_by_refinement(
`! (H: (A)hypermap) . tuple_hypermap H = (D,e,n,f) <=>
dart H = D /\
edge_map H = e /\
node_map H = n /\
face_map H = f `,
[ REWRITE_TAC[dart; all_hy_map];
GEN_TAC THEN EQ_TAC;
SIMP_TAC[
FST;
SND;
PAIR];
DISCH_TAC;
PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM
PAIR] THEN
REWRITE_TAC[
PAIR_EQ] THEN ASM_SIMP_TAC[];
PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM
PAIR] THEN
REWRITE_TAC[
PAIR_EQ] THEN ASM_SIMP_TAC[];
PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM
PAIR] THEN
REWRITE_TAC[
PAIR_EQ] THEN ASM_SIMP_TAC[]]);;
(* =============================== *)
(* =============================== *)
parse_as_infix("has_orders",(12,"right"));;
parse_as_infix("cyclic_on",(13,"right"));;
let EE = new_definition` EE v S = {w | {v,w} IN S }`;;
let HYP = new_definition` HYP (x,V,E) = (darts_of_hyp E V,
ee_of_hyp (x,V,E), nn_of_hyp (x,V,E), ff_of_hyp (x,V,E)) `;;
let FST_SND_FORM_OF_4_TUPLE = GEN_ALL (
prove_by_refinement(` FST X = D /\ FST (SND X) = e /\
FST (SND (SND X)) = n /\ SND (SND (SND X)) = f <=> X = D,e,n,f `,
[EQ_TAC;
STRIP_TAC;
REPEAT (PAT_ONCE_REWRITE_TAC `\x. x = y `[GSYM PAIR] THEN
ASM_SIMP_TAC[PAIR_EQ]);
SIMP_TAC[PAIR_EQ]]));;
(* =================================================== *)
let V_IN_DARTS_IFF_SWICH_SO_DO = V_IN_DARTS_IMP_SWICH_SO_DO;;
(* removed, 2011-08-01, `fan` deprecated, thales
let fan_expand = let t1 = CONJ fan fan1 in
let t2 = CONJ fan2 t1 in
let t3 = CONJ fan3 t2 in
let t4 = CONJ fan4 t3 in
let t5 = CONJ fan5 t4 in
let t6 = CONJ fan6 t5 in
let t7 = CONJ fan7 t6 in
CONJ FAN t7;;
*)
let IN_V_OF_FAN_EXISTS_DART = GEN_ALL (
prove_by_refinement(
` UNIONS E SUBSET (V:real^3 -> bool) /\ u IN V ==>
? v. v IN V /\ (u,v) IN darts_of_hyp E V `,
[REWRITE_TAC[darts_of_hyp; IN_UNION; ord_pairs; self_pairs];
PHA THEN DAO THEN STRIP_TAC THEN ASM_CASES_TAC `?(v:real^3). {u,v} IN E `;
(* Subgoal 1 *)
FIRST_X_ASSUM CHOOSE_TAC THEN EXISTS_TAC `v:real^3 `;
ASSUME_TAC2 (prove(` UNIONS E SUBSET V /\ {(u:real^3), v} IN E ==> v IN V `,
REWRITE_TAC[ UNIONS_SUBSET] THEN
STRIP_TAC THEN
MATCH_MP_TAC (TR_SET_RULE[]` {u,v} SUBSET V ==> v IN V `) THEN
FIRST_X_ASSUM MATCH_MP_TAC THEN
ASM_SIMP_TAC[]));
ASM_REWRITE_TAC[] THEN EVERY_ASSUM (fun x -> SET_TAC[x]);
(* Subgoal 2 *)
EXISTS_TAC `u:real^3 ` THEN ASM_REWRITE_TAC[EE];
DISJ2_TAC THEN FIRST_X_ASSUM MP_TAC THEN SET_TAC[]]));;
prove(` UNIONS E SUBSET V /\ {a, b} IN E ==> a IN V /\ b IN V `,
REWRITE_TAC[UNIONS_SUBSET;
(GSYM o (TR_SET_RULE[]))` {a,b} SUBSET V <=> a IN V /\ b IN V `] THEN
MESON_TAC[]);;
let types_in_th th = let t = frees (concl (SPEC_ALL th)) in
map dest_var t;;
(* ============================ *)
(* CARD_LE_K_OF_SET_K_FIRST_ELMS
|- CARD {ITER i f x | i < k} <= k *)
let CARD_LE_K_OF_SET_K_FIRST_ELMS =
BETA_RULE (SPECL [`k: num `;`(\i. ITER i (f: A -> A) x )`]
CARD_FINITE_SERIES_LE);;
let FINITENESS_OF_K_FIRST_ELMS = prove_by_refinement(
`! k (f: num -> A). FINITE { f n | n < k }`,
[INDUCT_TAC;
REWRITE_TAC[
LT; TR_SET_RULE[]` {f n | n | F } = {} `; FINITE_RULES];
REWRITE_TAC[ARITH_RULE` n < SUC k <=> n < k \/ n = k `;
TR_SET_RULE[]` {(f: num -> A) n | n < k \/ n = k} = f k
INSERT {f n | n < k } `];
ASM_REWRITE_TAC[
FINITE_INSERT]]);;
let LT_SUC_E = ARITH_RULE` i < SUC k <=> i < k \/ i = k `;;
(* |- !k. CARD {f i | i < k} <= k *)
let CARD_K_FIRST_ELMS_LE_K =
GEN `k: num ` (SPECL [`k: num `;` f: num -> A `] CARD_FINITE_SERIES_LE);;
let REMOVE_TAC = MATCH_MP_TAC (TAUT ` a ==> b ==> a `);;
let CARD_N_FIRST_ELMS_UNDUCTIVE = prove_by_refinement(
`! k (f: num -> A ).
CARD { f n | n < k} = k <=>
CARD {f n | n < k - 1} = k - 1 /\
(!i. i < k - 1 ==> ~(f i = f ( k - 1 )))`,
[REPEAT GEN_TAC;
ASM_CASES_TAC ` k = 0 `;
ASM_SIMP_TAC[ARITH_RULE` ~( x < 0 - 1 ) `;
LT; ARITH_RULE` 0 - 1 = 0 `];
DOWN;
NHANH (ARITH_RULE` ~( k = 0 ) ==> (! n. n < k <=> n < k - 1 \/ n = k - 1 ) `);
SIMP_TAC[];
STRIP_TAC;
REWRITE_TAC[TR_SET_RULE[]` {(f:num -> A) n | n < k - 1 \/ n = k - 1}
= f ( k - 1 )
INSERT {f n | n < k - 1 }`];
MP_TAC (SPECL [` k - 1 `;` f: num -> A `]
FINITENESS_OF_K_FIRST_ELMS);
DISCH_TAC;
EQ_TAC;
(* sub 1 *)
ASM_SIMP_TAC[
CARD_CLAUSES];
COND_CASES_TAC;
(* sub 1.1 *)
MP_TAC (SPEC ` k - 1 ` CARD_K_FIRST_ELMS_LE_K);
UNDISCH_TAC ` ~( k = 0 ) `;
MESON_TAC[ARITH_RULE `~ ( ~(k = 0) /\ a <= k - 1 /\ a = k ) `];
(* sub 1.2 *)
UNDISCH_TAC ` ~( k = 0 ) `;
SIMP_TAC[ARITH_RULE ` ~( k = 0 ) ==> ( SUC x = k <=> x = k - 1 )`];
MATCH_MP_TAC (TAUT ` a ==> b ==> a `);
MATCH_MP_TAC (TAUT ` a ==> b ==> a `);
DOWN;
REWRITE_TAC[
IN_ELIM_THM];
MESON_TAC[];
(* SUB 2 *)
STRIP_TAC;
SUBGOAL_THEN ` ~( f ( k - 1 )
IN {(f: num -> A) n | n < k - 1})` ASSUME_TAC;
DOWN THEN REWRITE_TAC[
IN_ELIM_THM];
MESON_TAC[];
ASM_SIMP_TAC[
CARD_CLAUSES];
UNDISCH_TAC `~( k = 0 ) `;
ARITH_TAC]);;
let CARD_KS_EQ_K_EQ_ALL_LE = prove_by_refinement
(`! k (f: num -> A ).
CARD { f n | n < k} = k <=>
(! kk. kk <= k ==>
CARD { f n | n < kk} = kk ) `,
[REPEAT STRIP_TAC;
EQ_TAC;
REPEAT STRIP_TAC;
ASM_CASES_TAC `
CARD {(f: num -> A) n | n < kk} = kk`;
ASM_SIMP_TAC[];
ASSUME_TAC (SPEC `kk: num ` CARD_K_FIRST_ELMS_LE_K );
UNDISCH_TAC ` kk <= (k:num ) `;
NHANH (ARITH_RULE` kk <= (k:num) ==> k = kk + k - kk`);
STRIP_TAC;
UNDISCH_TAC `
CARD {(f:num -> A) n | n < k} = k`;
FIRST_ASSUM (fun x -> ONCE_REWRITE_TAC[x]);
MP_TAC (SPECL [`kk : num `;` f: num -> A `;` k - (kk: num ) `]
(GEN_ALL
CARD_LT_KT_LE_ADDT));
REPEAT STRIP_TAC;
UNDISCH_TAC `~(
CARD {(f: num -> A) n | n < kk} = kk) `;
UNDISCH_TAC `
CARD {(f: num -> A) i | i < kk} <= kk`;
PHA;
REWRITE_TAC[ARITH_RULE` a <= b /\ ~( a = b ) <=> a < (b: num) `];
DOWN THEN DOWN;
MESON_TAC[ARITH_RULE` ~( a <= b + c /\ a = kk + c /\ b < (kk: num) ) `];
(* SUB 2 *)
DISCH_THEN (MP_TAC o (SPEC `k: num `));
SIMP_TAC[
LE_REFL]]);;
(* ======================== *)
let DIH2K_IMP_PRE_SIMPLE_HYP = prove_by_refinement
(`FINITE ( dart H ) /\
dih2k (H:(A)hypermap) k /\ ~( k = 0 )
==> (! x. x
IN dart H ==> ~(
node_map H x
IN face H (x:A) )) `,
[REWRITE_TAC[ dih2k;
simple_hypermap];
STRIP_TAC;
GEN_TAC;
ASM_CASES_TAC `
node_map H x
IN face H (x:A) `;
(* subgoal 1 *)
FIRST_X_ASSUM NHANH;
LET_TAC;
STRIP_TAC;
SUBGOAL_THEN ` ~( (S: A -> bool)
INTER (
IMAGE (
node_map H) S) = {}) ` ASSUME_TAC;
ASSUME_TAC (SPEC_ALL
face_refl);
DOWN;
NHANH (ISPECL [`
node_map (H:(A) hypermap)`;`S: A -> bool `;`x:A `]
FUN_IN_IMAGE);
UNDISCH_TAC `
node_map H (x:A)
IN S`;
ASM_REWRITE_TAC[];
SET_TAC[];
ASSUME_TAC2
lemma_face_subset;
ASSUME_TAC2 (SPECL [`face H (x:A) `;` dart (H:(A) hypermap)`]
FINITE_SUBSET);
ASSUME_TAC2 (ISPECL [`
node_map (H:(A) hypermap) `;`face H (x:A) `]
FINITE_IMAGE);
REPLICATE_TAC 5 DOWN;
PHA THEN ASM_REWRITE_TAC[];
STRIP_TAC;
ASSUME_TAC2 (SPECL [`S: A -> bool `;`
IMAGE (
node_map H)
(S: A -> bool) `] (GEN_ALL
CARD_UNION_NOT_DISTJ_LT));
ASSUME_TAC2 (ISPECL [`
node_map (H:(A) hypermap)`;` S:A -> bool`]
CARD_IMAGE_LE);
ASSUME_TAC2 (SPECL [`
face_map (H:(A) hypermap)`;`k: num `]
(GEN_ALL
HAVING_ORDERS_K_IMP_CARD_ORBIT_LE_K));
DOWN;
ASM_REWRITE_TAC[GSYM face];
DISCH_THEN (MP_TAC o (SPEC `x: A`));
ASM_REWRITE_TAC[] THEN STRIP_TAC;
DOWN THEN DOWN THEN DOWN THEN PHA;
NHANH (ARITH_RULE`a < b + c /\ c <= b /\ b <= k ==> a < 2 * k `);
FIRST_ASSUM (fun x -> REWRITE_TAC[SYM x]);
STRIP_TAC;
ASM_MESON_TAC[ARITH_RULE` x = 2 * k ==> ~(x < 2 * k ) `];
(* subgoal 2 *)
ASM_REWRITE_TAC[]]);;
(* ================================ *)
let F_INVERSE_F_F = MESON[F_INVERSE_F]` f ( inverse f (f x)) = f x `;;
let INJ_IMP_INVERSE_FF = MESON[F_INVERSE_F_F]`(!y. f y = f x ==> y = x ) ==> inverse f ( f x ) = x `;;
let INVERSE_FUNCTION_OF_BIJ = prove_by_refinement(
`
BIJ (f:A -> B) S1 S2 /\ g = (\x. if x
IN S2 then (@t. t
IN S1 /\ f t = x ) else tt )
==>
BIJ g S2 S1 `,
[REWRITE_TAC[
BIJ;
INJ;
SURJ];
STRIP_TAC;
SUBGOAL_THEN `(!x. (x:B)
IN S2 ==> g x
IN (S1: A -> bool) /\ f ( g x ) = x )` ASSUME_TAC;
ASM_REWRITE_TAC[];
FIRST_X_ASSUM NHANH;
SIMP_TAC[];
MESON_TAC[];
(* ================= *)
CONJ_TAC;
ASM_MESON_TAC[];
CONJ_TAC;
FIRST_X_ASSUM NHANH;
SIMP_TAC[];
REPEAT STRIP_TAC;
EXISTS_TAC `(f:A -> B) x `;
ASM_MESON_TAC[]]);;
let TOW_BIJS_IMP_BIJ_BETWEEN_FIRST = prove_by_refinement(
`
BIJ (f:B -> A ) S1 V /\
BIJ (g:C -> A) S2 V /\
ff = (\x. if x
IN S1 then (@a. a
IN S2 /\ f x = g a) else aa)
==>
BIJ ff S1 S2 `,
[REWRITE_TAC[
BIJ;
INJ;
SURJ];
STRIP_TAC;
SUBGOAL_THEN ` (!x. (x:B)
IN S1 ==> ff x
IN (S2: C -> bool) /\ (f:B -> A) x = g ( ff x )) ` ASSUME_TAC;
ASM_REWRITE_TAC[];
SIMP_TAC[];
ASM_MESON_TAC[];
ASM_MESON_TAC[]]);;
UNDISCH_TAC ` ~(W SUBSET {p:real^3} ) `;
SIMP_TAC[azim_cycle];
DISCH_TAC;
CONV_TAC SELECT_CONV;
EXISTS_TAC `u:real^3 `;
ASM_REWRITE_TAC[];
DOWN THEN STRIP_TAC;
UNDISCH_TAC `(W:real^3 -> bool) (u:real^3) `;
UNDISCH_TAC `~( u = (p:real^3)) `;
PHA;
FIRST_X_ASSUM NHANH;
DISCH_TAC;
UNDISCH_TAC `(W:real^3 -> bool) (uu:real^3) `;
UNDISCH_TAC `~( uu = (p:real^3)) `;
PHA;
FIRST_ASSUM NHANH;
DOWN THEN STRIP_TAC;
STRIP_TAC;
ASM_REAL_ARITH_TAC;
ASM_REAL_ARITH_TAC;
STRIP_TAC;
ASM_REAL_ARITH_TAC;
UNDISCH_TAC `cyclic_set W v (w:real^3) `;
NHANH CYCLIC_SET_IMP_NOT_COLLINEAR;
REWRITE_TAC[IN];
STRIP_TAC;
UNDISCH_TAC `(W:real^3 -> bool) u `;
UNDISCH_TAC `(W:real^3 -> bool) uu `;
FIRST_ASSUM NHANH;
STRIP_TAC THEN STRIP_TAC;
MP_TAC (MESON[AZIM_EQ]`~collinear {v, w, (p:real^3)} /\
~collinear {v, w, u} /\
~collinear {v, w, uu} /\
azim v w p u = azim v w p uu
==> uu IN aff_gt {v,w} {u}`);
ANTS_TAC;
SIMP_TAC[INSERT_COMM];
CONJ_TAC;
FIRST_ASSUM ACCEPT_TAC;
CONJ_TAC;
FIRST_ASSUM ACCEPT_TAC;
CONJ_TAC;
FIRST_X_ASSUM ACCEPT_TAC;
FIRST_X_ASSUM ACCEPT_TAC;
DOWN;
NHANH (MESON[COLLINEAR_2; INSERT_INSERT; INSERT_COMM]`
~ collinear {a,b,c} ==> ~( a = b ) /\ ~( a = c )`);
REWRITE_TAC[TR_SET_RULE[]`~(u = v) /\ ~(u = w) <=> DISJOINT {v,w} {u} `];
NHANH AFF_GT_2_1;
SIMP_TAC[IN_ELIM_THM];
STRIP_TAC;
STRIP_TAC;
UNDISCH_TAC` norm (projection (w - v) (uu - v)) <= norm (projection (w - v) (u - (v:real^3))) `;
UNDISCH_TAC `norm (projection (w - v) (u - v)) <= norm (projection (w - v) (uu - (v:real^3)))`;
PHA;
REWRITE_TAC[REAL_ARITH` a <= b /\ b <= a <=> a = b `];
ASM_REWRITE_TAC[];
UNDISCH_TAC ` t1 + t2 + t3 = &1 `;
SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `;
VECTOR_ARITH` (((&1 - (t2 + t3)) % v + t2 % w + t3 % u) - v) =
t2 % ( w - v ) + t3 % ( u - v ) `];
UNDISCH_TAC ` cyclic_set W v (w:real^3) `;
REWRITE_TAC[cyclic_set];
ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> b - a = vec 0 `];
SIMP_TAC[SLIDABLE_PROJECTION; LINEAR_PROJECTION];
REWRITE_TAC[NORM_MUL; REAL_FIELD` a = x * a <=> a = &0 \/ x = &1 `];
REPEAT STRIP_TAC;
DOWN;
REWRITE_TAC[NORM_EQ_0; projection];
REWRITE_TAC[VECTOR_ARITH` u - v - x % ( w - v ) = vec 0 <=>
u = (&1 - x ) % v + x % w `];
DISCH_TAC;
SUBGOAL_THEN` (u:real^3) IN aff {v,w} ` ASSUME_TAC;
REWRITE_TAC[AFF2; IN_ELIM_THM];
DOWN;
MESON_TAC[REAL_ARITH` a = &1 - (&1 - a ) `];
UNDISCH_TAC`~(w - (v:real^3) = vec 0 ) `;
REWRITE_TAC[VECTOR_SUB_EQ];
NHANH NOT_EQ_IMP_AFF_AND_COLL3;
SIMP_TAC[INSERT_COMM];
STRIP_TAC;
FIRST_X_ASSUM SUBST_ALL_TAC;
ASM_MESON_TAC[];
ASSUME_TAC2 (SPEC `t3:real ` (GEN_ALL LT_IMP_ABS_REFL));
DOWN THEN ASM_REWRITE_TAC[];
STRIP_TAC;
SUBGOAL_THEN` uu + ( -- t1) % ( v - w ) - (u:real^3) = vec 0 ` ASSUME_TAC;
ASM_REWRITE_TAC[];
EXPAND_TAC "t3";
VECTOR_ARITH_TAC;
DOWN;
UNDISCH_TAC`(W:real^3 -> bool) uu `;
UNDISCH_TAC `(W:real^3 -> bool) u `;
PHA;
REWRITE_TAC[VECTOR_ARITH` a + b - (c:real^N) = (a + b ) - c `];
FIRST_ASSUM NHANH;
STRIP_TAC;
DOWN;
ASM_REWRITE_TAC[];
VECTOR_ARITH_TAC]);;
(* *)
let EXISTS_SMALLEST_ELMS = prove_by_refinement
(` FINITE W /\ ~(W = {} ) /\
(! x (y:A). ll x y \/ ll y x ) /\
(! x y z. ll x y /\ ll y z ==> ll x z )
==> ? v. v
IN W /\ (! w. w
IN W ==> ll v w ) `,
[WF_INDUCT_TAC `
CARD (W:A -> bool) `;
REWRITE_TAC[TR_SET_RULE[]`~( a = {}) <=> ? x. x
IN a `];
STRIP_TAC;
ASSUME_TAC2 (ISPECL [`W:A -> bool`;`x:A`]
CARD_MINUS_ONE);
DOWN;
NHANH (ARITH_RULE` a = b + 1 ==> b < a `);
FIRST_ASSUM NHANH;
UNDISCH_TAC `!(W':A -> bool).
CARD W' <
CARD (W:A -> bool)
==> FINITE W' /\
~(W' = {}) /\
(!x y. ll (x:A) (y:A) \/ ll y x) /\
(!x y z. ll x y /\ ll y z ==> ll x z)
==> (?v. v
IN W' /\ (!w. w
IN W' ==> ll v w)) `;
DISCH_TAC;
FIRST_ASSUM NHANH;
STRIP_TAC THEN DOWN;
ASM_CASES_TAC ` W = {x:A} `;
REMOVE_TAC;
EXISTS_TAC `x:A`;
ASM_SIMP_TAC[
IN_ELIM_THM;
IN_SING];
UNDISCH_TAC `! x y. (ll:A -> A -> bool) x y \/ ll y x `;
MESON_TAC[];
ASSUME_TAC2 (TR_SET_RULE[]` (x:A)
IN W /\ ~(W = {x}) ==> ~(W
DELETE x = {}) `);
ANTS_TAC;
ASM_SIMP_TAC[
FINITE_DELETE];
FIRST_X_ASSUM ACCEPT_TAC;
STRIP_TAC;
USE_FIRST `! x y. (ll: A -> A -> bool) x y \/ ll y x ` (DISJ_CASES_TAC o (SPECL[` x:A `;` v:A`]));
EXISTS_TAC `x:A`;
ASM_REWRITE_TAC[];
ASSUME_TAC2 (
TR_SET_RULE[]` x:A
IN W ==> (! a. a
IN W <=> a
IN (W
DELETE x) \/ a = x )`);
ASM_REWRITE_TAC[];
ASM_MESON_TAC[];
EXISTS_TAC `v:A`;
ASSUME_TAC2 (TR_SET_RULE[]` (v:A)
IN W
DELETE x ==> v
IN W`);
ASM_REWRITE_TAC[];
ASSUME_TAC2 (
TR_SET_RULE[]` x:A
IN W ==> (! a. a
IN W <=> a
IN (W
DELETE x) \/ a = x )`);
ASM_REWRITE_TAC[];
ASM_MESON_TAC[]]);;
let EXIS_SMALLEST_WITH_AZIM_ORD = prove_by_refinement
(`~(W
SUBSET {p}) /\ FINITE W
==> ?u.
(~(u = p) /\ W u) /\
(!q. ~(q = p) /\ W q
==>
azim v w p u <
azim v w p q \/
azim v w p u =
azim v w p q /\
norm (projection (w - v) (u - v)) <=
norm (projection (w - v) (q - v))) `,
[ABBREV_TAC ` ll (u:real^3) (q:real^3) <=>
~ (W:real^3 -> bool) u \/ W u /\ W q /\
(
azim v w p u <
azim v w p q \/
azim v w p u =
azim v w p q /\
norm (projection (w - v) (u - v)) <=
norm (projection (w - v) (q - v)))`;
STRIP_TAC;
MP_TAC (ISPECL [`(W:real^3 -> bool)
DELETE p`;` ll:real^3 -> real^3 -> bool` ] (GEN_ALL
EXISTS_SMALLEST_ELMS));
ANTS_TAC;
DOWN_TAC;
SIMP_TAC[
cyclic_set];
NHANH (TR_SET_RULE[]` ~( a
SUBSET {b}) ==> ~(a
DELETE b = {}) `);
SIMP_TAC[
FINITE_DELETE];
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
STRIP_TAC;
CONJ_TAC;
ASM_REWRITE_TAC[
REAL_LE_REFL];
GEN_TAC THEN GEN_TAC;
ASM_CASES_TAC ` ~ (W:real^3 -> bool) x `;
REPEAT DISJ1_TAC;
FIRST_ASSUM ACCEPT_TAC;
ASM_CASES_TAC ` ~ (W:real^3 -> bool) y `;
DISJ2_TAC;
DISJ1_TAC;
FIRST_ASSUM ACCEPT_TAC;
DOWN THEN DOWN THEN PHA;
SIMP_TAC[];
DISCH_TAC;
REAL_ARITH_TAC;
REPEAT GEN_TAC;
ASM_REWRITE_TAC[];
IMP_TAC THEN DISCH_TAC;
FIRST_X_ASSUM DISJ_CASES_TAC;
ASM_REWRITE_TAC[];
DISCH_TAC;
FIRST_X_ASSUM DISJ_CASES_TAC;
DOWN THEN MATCH_MP_TAC (TAUT` a ==> ~ a ==> b `);
ASM_REWRITE_TAC[];
FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC);
FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC);
DISJ2_TAC;
DOWN;
FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC);
FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC);
DOWN THEN PHA;
ASM_REWRITE_TAC[];
REAL_ARITH_TAC;
DOWN_TAC THEN ONCE_REWRITE_TAC[
EQ_SYM_EQ];
STRIP_TAC;
DOWN;
DOWN;
ASM_REWRITE_TAC[
IN_DELETE;
IN];
SIMP_TAC[
EQ_SYM_EQ];
STRIP_TAC;
STRIP_TAC;
EXISTS_TAC`v':real^3 `;
REPLICATE_TAC 3 DOWN THEN PHA;
SIMP_TAC[
CONJ_SYM];
MESON_TAC[]]);;
(* removed 2011-08-01, thales :
let azim_cycle2 = new_definition
` azim_cycle2 W v w p =
(if W SUBSET {p}
then p
else let le =
(\u q.
azim v w (CHOICE W) u < azim v w (CHOICE W) q \/
azim v w (CHOICE W) u = azim v w (CHOICE W) q /\
norm (projection (w - v) (u - v)) <=
norm (projection (w - v) (q - v))) in
@u. ~(u = p) /\
W u /\
le p u /\
(!q. ~(q = p) /\ W q /\ le p q ==> le u q) \/
~(u = p) /\ W u /\ (!q. W q ==> le u q)) `;;
let W_SUBSET_SINGLETON_IMP_IDE2 = prove(
` W SUBSET {p} ==> azim_cycle2 W v w p = p `, SIMP_TAC[azim_cycle2]);;
*)
REWRITE_TAC[REAL_ARITH`( a < b \/ a = b /\ x <= y ) /\
( b < a \/ b = a /\ y <= x ) <=> a = b /\ x = y `];
ASM_CASES_TAC ` (W:real^3 -> bool) = {} `;
ASM_REWRITE_TAC[INSERT_SUBSET; NOT_IN_EMPTY];
DOWN THEN NHANH CHOICE_DEF;
REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET];
NHANH CYCLIC_SET_IMP_NOT_COLLINEAR;
STRIP_TAC;
IMP_TAC THEN STRIP_TAC;
UNDISCH_TAC ` CHOICE (W:real^3 -> bool) IN W `;
FIRST_ASSUM NHANH;
REPEAT STRIP_TAC;
SUBGOAL_THEN ` azim v w (CHOICE W) x = azim v w (CHOICE W) y <=>
x IN aff_gt {v, w} {y}` ASSUME_TAC;
MATCH_MP_TAC AZIM_EQ_ALT;
DOWN_TAC;
SIMP_TAC[INSERT_COMM];
FIRST_X_ASSUM SUBST_ALL_TAC;
REPLICATE_TAC 3 DOWN THEN PHA;
NHANH th3b;
NHANH th3b1;
REWRITE_TAC[SET_RULE` (a /\ ~( y = w )) /\ ~( y = u) <=> a /\ DISJOINT {u,w} {y} `];
NHANH AFF_GT_2_1;
IMP_TAC THEN STRIP_TAC;
ASM_REWRITE_TAC[IN_ELIM_THM];
REWRITE_TAC[REAL_ARITH` a + b + c = d <=> c = d - a - b `];
IMP_TAC THEN STRIP_TAC;
ASM_REWRITE_TAC[];
REWRITE_TAC[VECTOR_ARITH` (t1 % v + t2 % w + (&1 - t1 - t2) % y) - v =
t2 % ( w - v ) + (&1 - t1 - t2 ) % ( y - v ) `];
UNDISCH_TAC` cyclic_set W (v:real^3) w `;
REWRITE_TAC[cyclic_set];
ONCE_REWRITE_TAC[EQ_SYM_EQ];
IMP_TAC;
PAT_ONCE_REWRITE_TAC `\x. x ==> y `[GSYM VECTOR_SUB_EQ];
NHANH (MESON[SLIDABLE_PROJECTION]` ~ ( e = vec 0) ==> (! t x. projection e
( t % e + x ) = projection e x )`);
STRIP_TAC;
ASM_REWRITE_TAC[LINEAR_PROJECTION; NORM_MUL; REAL_RING` a = b * a <=> b = &1 \/ a = &0 `];
STRIP_TAC THEN DISCH_THEN DISJ_CASES_TAC;
DOWN;
UNDISCH_TAC ` t3 = &1 - t1 - t2 `;
UNDISCH_TAC ` &0 < t3 `;
NHANH LT_IMP_ABS_REFL;
STRIP_TAC;
ONCE_REWRITE_TAC[EQ_SYM_EQ];
DISCH_TAC;
ASM_REWRITE_TAC[];
STRIP_TAC;
USE_FIRST ` (x:real^3) = t1 % v + t2 % w + t3 % y ` MP_TAC;
EXPAND_TAC "t3";
ASSUME_TAC2 (REAL_ARITH` &1 - t1 - t2 = t3 /\ &1 = t3 ==> t2 = -- t1 `);
DOWN THEN SIMP_TAC[] THEN STRIP_TAC;
REWRITE_TAC[VECTOR_ARITH` x = t1 % v + --t1 % w + &1 % y <=> y + t1 %
(v - w ) = x `];
UNDISCH_TAC` (y:real^3) IN W `;
UNDISCH_TAC` (x:real^3) IN W `;
PHA;
REWRITE_TAC[IN];
FIRST_X_ASSUM NHANH;
FIRST_X_ASSUM (SUBST1_TAC o SYM);
ASM_REWRITE_TAC[];
FIRST_X_ASSUM (SUBST1_TAC o SYM);
SIMP_TAC[EQ_SYM_EQ];
DOWN;
REWRITE_TAC[NORM_EQ_0];
NHANH PROJECT_EQ_VEC0_IMP_PARALLED;
STRIP_TAC;
DOWN;
UNDISCH_TAC ` ~( w - (v:real^3) = vec 0 ) `;
REWRITE_TAC[VECTOR_SUB_EQ];
NHANH (SPECL [`a:real^3 `;` b:real^3 `;`y:real^3 `]
(Collect_geom.NOT_TWO_EQ_IMP_COL_EQUAVALENT));
REPEAT STRIP_TAC;
SUBGOAL_THEN ` collinear {(y:real^3), w, v}` ASSUME_TAC;
ASM_REWRITE_TAC[AFF2; IN_ELIM_THM];
EXISTS_TAC `t:real `;
DOWN;
VECTOR_ARITH_TAC;
MATCH_MP_TAC (TAUT` F ==> h `);
DOWN; REWRITE_TAC[];
ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a}`];
FIRST_ASSUM ACCEPT_TAC]);;
let LE_ORD_IS_ASSYMETRY2 =
REWRITE_RULE[let_CONV (concl LE_ORD_IS_ASSYMETRY);
REAL_ARITH` ( a < b \/ a = b /\ x <= y ) /\ ( b < a \/ b = a /\ y <= x )
<=> a = b /\ x = y `]
LE_ORD_IS_ASSYMETRY;;
REWRITE_TAC[];
ASM_MESON_TAC[];
EXISTS_TAC ` y:real^3 # real^3 `;
ASM_REWRITE_TAC[];
GEN_TAC THEN COND_CASES_TAC;
DOWN;
NHANH V_IN_DARTS_IMP_SWICH_SO_DO;
ASM_MESON_TAC[];
REWRITE_TAC[]]);;
let SMOOTH_GEN_ALL t =
REWRITE_RULE[ RIGHT_FORALL_IMP_THM; TAUT ` a/\ b ==> c <=> a ==> b ==> c `] (GEN_ALL t);;
let W_SUBSET_SINGLETON_IMP_IDE =
SMOOTH_GEN_ALL (GENL [`v:real^3 `;`w:real^3`] W_SUBSET_SINGLETON_IMP_IDE);;
let PAIR_EQ2 =
MESON[PAIR; PAIR_EQ]` (a:A#B) = b <=> FST a = FST b /\ SND a = SND b `;;
let FAN_IMP_NN_OF_HYP_PERMUTES_DARTS = prove_by_refinement
(`
FAN (x,V,E) ==>
nn_of_hyp (x,V,E)
permutes darts_of_hyp E V `,
[REWRITE_TAC[
permutes];
STRIP_TAC;
CONJ_TAC;
SIMP_TAC[
nn_of_hyp2];
GEN_TAC THEN REWRITE_TAC[
EXISTS_UNIQUE];
ASM_CASES_TAC ` y
IN darts_of_hyp E (V:real^3 -> bool) `;
ASSUME_TAC2 (SMOOTH_GEN_ALL
INVERSE1_SIGMA_FAN);
FIRST_X_ASSUM (MP_TAC o SPEC `
FST (y:real^3 # real^3)`);
STRIP_TAC;
DOWN;
FIRST_X_ASSUM (MP_TAC o SPEC `
SND (y:real^3 # real^3)`);
REPEAT STRIP_TAC;
ASM_CASES_TAC ` (y:real^3 # real^3)
IN self_pairs E V `;
EXISTS_TAC `y:real^3 # real^3 `;
REWRITE_TAC[
nn_of_hyp2];
ASM_REWRITE_TAC[];
DOWN;
REWRITE_TAC[
self_pairs;
IN_ELIM_THM];
STRIP_TAC;
ASM_SIMP_TAC[
W_SUBSET_SINGLETON_IMP_IDE;
EMPTY_SUBSET];
GEN_TAC;
COND_CASES_TAC;
REWRITE_TAC[
PAIR_EQ];
DOWN;
REWRITE_TAC[
darts_of_hyp;
IN_UNION];
STRIP_TAC;
DOWN;
REWRITE_TAC[
ord_pairs;
IN_ELIM_THM];
ASSUME_TAC2 (SMOOTH_GEN_ALL
properties_of_set_of_edge_fan);
ASM_REWRITE_TAC[];
STRIP_TAC;
STRIP_TAC;
UNDISCH_TAC ` b
IN set_of_edge (a:real^3) V E`;
UNDISCH_TAC `
FAN ((x:real^3),V,E) `;
PHA;
NHANH
sigma_fan_in_set_of_edge;
NHANH
AZIM_CYCLE_EQ_SIGMA_FAN;
DOWN;
DOWN;
ASM_REWRITE_TAC[];
PHA;
IMP_TAC;
ASM_SIMP_TAC[
EMPTY_SUBSET;
W_SUBSET_SINGLETON_IMP_IDE];
IMP_TAC;
ASM_SIMP_TAC[
EMPTY_SUBSET;
W_SUBSET_SINGLETON_IMP_IDE];
ONCE_REWRITE_TAC[GSYM
PAIR];
REWRITE_TAC[
PAIR_EQ];
ASM_SIMP_TAC[];
SIMP_TAC[];
EXISTS_TAC `
FST y,
inverse1_sigma_fan x V E (
FST y) (
SND y) `;
SUBGOAL_THEN `
nn_of_hyp (x,V,E) (
FST y,
inverse1_sigma_fan x V E (
FST y) (
SND y)) = y ` ASSUME_TAC;
REWRITE_TAC[
nn_of_hyp];
UNDISCH_TAC ` y
IN darts_of_hyp E (V:real^3 -> bool) `;
PAT_REWRITE_TAC `\x. x ==> y ` [
darts_of_hyp];
ASM_REWRITE_TAC[
IN_UNION];
REWRITE_TAC[
ord_pairs;
IN_ELIM_THM];
STRIP_TAC;
SUBGOAL_THEN ` {
FST (y:real^3 # real^3),
inverse1_sigma_fan x V E (
FST y) b}
IN E ` ASSUME_TAC;
ASM_MESON_TAC[
PAIR;
PAIR_EQ];
DOWN THEN NHANH
IN_E_IMP_IMP_IN_DARTS;
STRIP_TAC THEN ASM_SIMP_TAC[];
DOWN THEN ASM_SIMP_TAC[];
STRIP_TAC;
REWRITE_TAC[
PAIR_EQ];
SUBGOAL_THEN ` (
inverse1_sigma_fan x V E a b)
IN set_of_edge a V E `
ASSUME_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL
properties_of_set_of_edge_fan);
FIRST_X_ASSUM (fun c -> REWRITE_TAC[GSYM c]);
DOWN THEN DOWN;
ASM_REWRITE_TAC[TAUT ` a ==> b ==> a `];
DOWN;
UNDISCH_TAC `
FAN (x:real^3, V, E) `;
PHA;
NHANH
AZIM_CYCLE_EQ_SIGMA_FAN;
ASM_SIMP_TAC[];
STRIP_TAC;
UNDISCH_TAC ` {
FST (y:real^3 # real^3),
SND y}
IN E
==>
sigma_fan x V E (
FST y) (
inverse1_sigma_fan x V E (
FST y) (
SND y)) =
SND y `;
ANTS_TAC;
ASM_SIMP_TAC[];
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[];
GEN_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL (GEN `y:real^3 # real^3`
IN_DARTS_IFF_NN_OF_HYP_TOO));
REWRITE_TAC[
nn_of_hyp2];
COND_CASES_TAC;
REWRITE_TAC[PAIR_EQ2];
ASM_SIMP_TAC[];
UNDISCH_TAC`
nn_of_hyp (x,V,E) (
FST y,
inverse1_sigma_fan x V E (
FST y) (
SND y)) = y `;
REWRITE_TAC[
nn_of_hyp2];
UNDISCH_TAC ` (y:real^3 # real^3)
IN darts_of_hyp E V `;
REWRITE_TAC[
darts_of_hyp;
IN_UNION];
ASM_SIMP_TAC[
IN_ORD_E_EQ_IN_E];
REWRITE_TAC[PAIR_EQ2];
REPEAT STRIP_TAC;
SUBGOAL_THEN ` (
inverse1_sigma_fan x V E (
FST y) (
SND y))
IN
set_of_edge (
FST y) V E /\
SND y'
IN set_of_edge (
FST y') V E ` MP_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL
properties_of_set_of_edge_fan);
FIRST_ASSUM (fun x -> REWRITE_TAC[GSYM x]);
CONJ_TAC;
ASM_MESON_TAC[];
UNDISCH_TAC ` y'
IN darts_of_hyp E (V:real^3 -> bool) `;
REWRITE_TAC[
darts_of_hyp;
IN_UNION];
STRIP_TAC;
DOWN;
REWRITE_TAC[
IN_ORD_E_EQ_IN_E];
DOWN;
NHANH
IN_SELF_PAIRS_IMP_EE_EMPTY;
STRIP_TAC;
FIRST_X_ASSUM SUBST_ALL_TAC;
UNDISCH_TAC `
azim_cycle {} x (
FST y') (
SND y') =
SND (y:real^3 # real^3)`;
SIMP_TAC[
W_SUBSET_SINGLETON_IMP_IDE;
EMPTY_SUBSET];
STRIP_TAC;
FIRST_X_ASSUM SUBST_ALL_TAC;
FIRST_X_ASSUM SUBST_ALL_TAC;
FIRST_X_ASSUM ACCEPT_TAC;
ASM_REWRITE_TAC[];
STRIP_TAC;
DOWN;
UNDISCH_TAC `
FAN (x:real^3, V, E) `;
PHA;
NHANH
AZIM_CYCLE_EQ_SIGMA_FAN;
STRIP_TAC;
UNDISCH_TAC `
inverse1_sigma_fan x V E (
FST y) (
SND y)
IN set_of_edge (
FST y) V E `;
UNDISCH_TAC `
FAN (x:real^3, V, E) `;
PHA;
NHANH
AZIM_CYCLE_EQ_SIGMA_FAN;
STRIP_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL
properties_of_set_of_edge_fan);
UNDISCH_TAC `
SND (y':real^3 # real^3)
IN set_of_edge (
FST (y:real^3 # real^3)) V E`;
FIRST_ASSUM (fun x -> REWRITE_TAC[ GSYM x]);
ASM_MESON_TAC[
MONO_SIGMA_FAN];
ASM_MESON_TAC[];
EXISTS_TAC ` y:real^3 # real^3 `;
ASM_REWRITE_TAC[
nn_of_hyp2];
GEN_TAC;
REWRITE_TAC[GSYM
nn_of_hyp2];
ASM_MESON_TAC[
IN_DARTS_IFF_NN_OF_HYP_TOO;
nn_of_hyp2]]);;
let FAN_IMP_FACE_MAP_PERMUTES_DARTS = prove_by_refinement
(`
FAN (x,V,E) ==>
ff_of_hyp (x,V,E)
permutes darts_of_hyp E V `,
[STRIP_TAC;
REWRITE_TAC[
permutes];
CONJ_TAC;
SIMP_TAC[
ff_of_hyp2];
GEN_TAC;
REWRITE_TAC[
EXISTS_UNIQUE];
ASM_CASES_TAC ` (y:real^3 # real^3)
IN darts_of_hyp E V `;
FIRST_ASSUM MP_TAC;
REWRITE_TAC[
darts_of_hyp;
IN_UNION];
STRIP_TAC;
DOWN THEN REWRITE_TAC[
IN_ORD_E_EQ_IN_E];
UNDISCH_TAC `
FAN (x:real^3,V,E) `;
PHA;
ONCE_REWRITE_TAC[
INSERT_COMM];
NHANH
IVS_AZIM_EQ_INVERSE_SIGMA_FAN;
STRIP_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL
INVERSE1_SIGMA_FAN);
FIRST_X_ASSUM (MP_TAC o (SPEC `
FST (y:real^3 # real^3 )`));
STRIP_TAC;
FIRST_X_ASSUM (ASSUME_TAC o (SPEC `
SND (y:real^3 # real^3 )`));
FIRST_X_ASSUM (ASSUME_TAC o (SPEC `
SND (y:real^3 # real^3 )`));
FIRST_X_ASSUM (ASSUME_TAC o (SPEC `
SND (y:real^3 # real^3 )`));
DOWN;
ANTS_TAC;
ONCE_REWRITE_TAC[
INSERT_COMM];
FIRST_X_ASSUM ACCEPT_TAC;
STRIP_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL
properties_of_set_of_edge_fan);
UNDISCH_TAC `{
SND (y:real^3 # real^3),
FST y}
IN E `;
ONCE_REWRITE_TAC[
INSERT_COMM];
FIRST_ASSUM (fun x -> REWRITE_TAC[x]);
UNDISCH_TAC `
FAN (x:real^3, V,E) `;
PHA;
NHANH
sigma_fan_in_set_of_edge;
FIRST_ASSUM (fun x -> REWRITE_TAC[GSYM x]);
REWRITE_TAC[
IN_E_IFF_IN_ORD_E];
STRIP_TAC;
EXISTS_TAC `
sigma_fan x V E (
FST y) (
SND y),
FST y `;
ASM_REWRITE_TAC[
ff_of_hyp;
darts_of_hyp;
IN_UNION];
ONCE_REWRITE_TAC[
IN_ORD_E_IFF_SWITCH_TOO];
ASM_REWRITE_TAC[];
SUBGOAL_THEN`
FST y,
ivs_azim_cycle (
EE (
FST y) E) x (
FST y) (
sigma_fan x V E (
FST y) (
SND y)) =
y ` ASSUME_TAC;
REWRITE_TAC[PAIR_EQ2];
SUBGOAL_THEN ` {
FST y,
sigma_fan x V E (
FST y) (
SND y)}
IN E ` ASSUME_TAC;
ASM_REWRITE_TAC[];
MATCH_MP_TAC
sigma_fan_in_set_of_edge;
ASM_REWRITE_TAC[];
USE_FIRST ` !v u. {v, u}
IN E <=> u
IN set_of_edge (v:real^3) V E ` (fun x -> REWRITE_TAC[GSYM x ]);
REWRITE_TAC[
IN_E_IFF_IN_ORD_E];
FIRST_X_ASSUM ACCEPT_TAC;
DOWN;
UNDISCH_TAC `
FAN (x:real^3,V,E) `;
PHA;
NHANH
IVS_AZIM_EQ_INVERSE_SIGMA_FAN;
SIMP_TAC[];
STRIP_TAC;
UNDISCH_TAC ` (y:real^3 # real^3)
IN ord_pairs E `;
REWRITE_TAC[
IN_ORD_E_EQ_IN_E];
FIRST_X_ASSUM NHANH;
FIRST_X_ASSUM NHANH;
SIMP_TAC[];
ASM_SIMP_TAC[];
GEN_TAC;
ASM_CASES_TAC ` (y':real^3 # real^3)
IN darts_of_hyp E V `;
ASM_REWRITE_TAC[
ff_of_hyp2; PAIR_EQ2];
SIMP_TAC[];
DOWN;
REWRITE_TAC[
darts_of_hyp;
IN_UNION];
STRIP_TAC;
DOWN;
REWRITE_TAC[
IN_ORD_E_EQ_IN_E];
ONCE_REWRITE_TAC[
INSERT_COMM];
UNDISCH_TAC `
FAN (x:real^3,V,E) `;
REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `];
NHANH
IVS_AZIM_EQ_INVERSE_SIGMA_FAN;
DOWN;
REWRITE_TAC[PAIR_EQ2];
REPEAT STRIP_TAC;
UNDISCH_TAC `
FST y,
sigma_fan x V E (
FST y) (
SND y)
IN ord_pairs E `;
REWRITE_TAC[
IN_ORD_E_EQ_IN_E];
UNDISCH_TAC `
FAN (x:real^3,V,E) `;
PHA;
NHANH
IVS_AZIM_EQ_INVERSE_SIGMA_FAN;
STRIP_TAC;
FIRST_X_ASSUM SUBST_ALL_TAC;
UNDISCH_TAC `
ivs_azim_cycle (
EE (
SND (y':real^3 # real^3)) E) x (
SND y')
(
FST y') =
SND (y:real^3 # real^3) `;
ASM_SIMP_TAC[];
SUBGOAL_THEN` {
FST (y:real^3 # real^3),
FST (y':real^3 # real^3)}
IN E ` ASSUME_TAC;
FIRST_X_ASSUM (SUBST1_TAC o SYM);
ASM_REWRITE_TAC[];
UNDISCH_TAC `
inverse1_sigma_fan x V E (
FST y) (
sigma_fan x V E (
FST y) (
SND y)) =
SND y `;
DOWN THEN DOWN;
UNDISCH_TAC `
FAN (x:real^3,V,E) `;
PHA;
MESON_TAC[
INVERSE1_SIG_AND_SIG];
DOWN;
REWRITE_TAC[
self_pairs;
IN_ELIM_THM];
STRIP_TAC;
ASM_REWRITE_TAC[];
UNDISCH_TAC ` (y:real^3 # real^3)
IN ord_pairs E `;
NHANH
IN_ORD_PAIRS_IMP_SND_IN_EE_FST;
STRIP_TAC THEN STRIP_TAC;
UNDISCH_TAC `
SND (y:real^3 # real^3)
IN EE (
FST y) E `;
ASM_MESON_TAC[
NOT_IN_EMPTY];
ASM_SIMP_TAC[
NOT_IN_EMPTY];
ASM_MESON_TAC[
FAN_IMP_IN_DARTS_IFF_FF_TOO];
DOWN;
REWRITE_TAC[
self_pairs;
IN_ELIM_THM;
ff_of_hyp2];
STRIP_TAC;
EXISTS_TAC ` (v,v:real^3)`;
DOWN;
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
ASM_SIMP_TAC[
ff_of_hyp2;
IVS_AZIM_EMPTY_IDE];
STRIP_TAC;
GEN_TAC;
COND_CASES_TAC;
EXPAND_TAC "y";
REWRITE_TAC[PAIR_EQ];
STRIP_TAC;
DOWN;
FIRST_X_ASSUM SUBST_ALL_TAC;
ASM_REWRITE_TAC[IVS_AZIM_EMPTY_IDE; PAIR_EQ2];
SIMP_TAC[];
REWRITE_TAC[];
EXISTS_TAC `y:real^3 # real^3 `;
ASM_REWRITE_TAC[ff_of_hyp2];
ASM_MESON_TAC[FAN_IMP_IN_DARTS_IFF_FF_TOO; ff_of_hyp2]]);;
MATCH_MP_TAC FAN_IMP_FIMITE_DARTS;
ASM_REWRITE_TAC[FAN;fan1; fan2];
EXPAND_TAC "e";
EXPAND_TAC "D";
REWRITE_TAC[EE_OF_HYP_PERMUTES_DARTS];
CONJ_TAC;
ASM_MESON_TAC[];
CONJ_TAC;
ASM_MESON_TAC[];
CONJ_TAC;
EXPAND_TAC "n";
EXPAND_TAC "f";
REWRITE_TAC[FUN_EQ_THM];
GEN_TAC;
REWRITE_TAC[o_THM; I_THM; ff_of_hyp3];
ASM_CASES_TAC ` ~(x' IN darts_of_hyp E (V:real^3 -> bool)) \/ x' IN self_pairs E V `;
ASM_SIMP_TAC[];
EXPAND_TAC "n";
REWRITE_TAC[nn_of_hyp3];
ASM_REWRITE_TAC[];
EXPAND_TAC "e";
REWRITE_TAC[ee_of_hyp2];
DOWN;
ASM_REWRITE_TAC[];
DISCH_THEN DISJ_CASES_TAC;
ASM_REWRITE_TAC[];
DOWN;
EXPAND_TAC "D";
REWRITE_TAC[darts_of_hyp; IN_UNION];
SIMP_TAC[self_pairs; IN_ELIM_THM];
STRIP_TAC;
ASM_REWRITE_TAC[];
DOWN;
SIMP_TAC[];
REWRITE_TAC[nn_of_hyp3];
SIMP_TAC[];
SUBGOAL_THEN ` FAN (x:real^3, V, E) ` ASSUME_TAC;
ASM_REWRITE_TAC[FAN;fan1;fan2];
ASSUME_TAC2 (SMOOTH_GEN_ALL (GEN `y:real^3 # real^3 ` FAN_IMP_IN_DARTS_IFF_FF_TOO));
ASSUME_TAC2 (SMOOTH_GEN_ALL (GEN `y:real^3 # real^3 ` FAN_IMP_IN_SELF_PAIRS_IFF_FF_OF_HYP));
NHANH (TAUT` ~ a ==> ~ a `);
FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC` \x. y /\ x ==> i ` [x]);
FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC` \x. y /\ x ==> i ` [x]);
IMP_TAC;
STRIP_TAC;
REWRITE_TAC[ff_of_hyp3];
ASM_REWRITE_TAC[];
EXPAND_TAC "n";
REWRITE_TAC[nn_of_hyp3];
ASM_SIMP_TAC[];
ASSUME_TAC2 (
SMOOTH_GEN_ALL (GEN `y:real^3# real^3 ` IN_DARTS_IFF_NN_OF_HYP_TOO));
NHANH (TAUT` ~ a ==> ~ a `);
EXPAND_TAC "D";
FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC` \x. y /\ x ==> i ` [x]);
REWRITE_TAC[DE_MORGAN_THM];
IMP_TAC;
SIMP_TAC[nn_of_hyp2];
EXPAND_TAC "e";
SIMP_TAC[ee_of_hyp];
REPEAT STRIP_TAC;
REWRITE_TAC[PAIR_EQ2];
SUBGOAL_THEN ` (ivs_azim_cycle (EE (SND x') E) x (SND x') (FST x')) IN
set_of_edge (SND x') V E ` ASSUME_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL (GSYM properties_of_set_of_edge_fan));
ASM_REWRITE_TAC[IN_E_IFF_IN_ORD_E];
UNDISCH_TAC ` SND x',ivs_azim_cycle (EE (SND x') E) x (SND x') (FST x') IN
darts_of_hyp E V `;
REWRITE_TAC[darts_of_hyp; IN_UNION];
ASM_REWRITE_TAC[];
DOWN;
UNDISCH_TAC `FAN (x:real^3,V,E) `;
PHA;
NHANH AZIM_CYCLE_EQ_SIGMA_FAN;
SIMP_TAC[];
STRIP_TAC;
ASSUME_TAC2 (SMOOTH_GEN_ALL (GSYM properties_of_set_of_edge_fan));
SUBGOAL_THEN ` FST (x':real^3 # real^3) IN set_of_edge (SND x') V E `
MP_TAC;
ASM_REWRITE_TAC[IN_E_IFF_IN_ORD_E];
ONCE_REWRITE_TAC[IN_ORD_E_IFF_SWITCH_TOO];
REWRITE_TAC[];
UNDISCH_TAC ` ~(~(x' IN darts_of_hyp E (V:real^3 -> bool)) \/ x' IN self_pairs E V) `;
REWRITE_TAC[DE_MORGAN_THM; darts_of_hyp; IN_UNION];
CONV_TAC TAUT;
UNDISCH_TAC ` FAN (x:real^3,V,E) `;
PHA;
NHANH IVS_AZIM_PROPERTIES;
NHANH (
SMOOTH_GEN_ALL (GEN `v:real^N ` FAN_IMP_EE_EQ_SET_OF_EDGE));
SIMP_TAC[];
REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM];
GEN_TAC;
ASM_CASES_TAC ` (x':real^3 # real^3) IN D `;
REWRITE_TAC[ee_of_hyp2];
ASM_REWRITE_TAC[];
DOWN;
EXPAND_TAC "D";
SIMP_TAC[V_IN_DARTS_IFF_SWICH_SO_DO];
ASM_REWRITE_TAC[ee_of_hyp2]]);;
let HYP_LEMMA = prove_by_refinement(
`! (x:real^3).
FAN (x,V,E) ==>
tuple_hypermap (hypermap (
HYP (x,V,E))) =
HYP (x,V,E) `,
[GEN_TAC THEN ABBREV_TAC ` D =
FST (
HYP (x,V,E)) `;
ABBREV_TAC ` e =
FST (
SND (
HYP (x,V,E))) `;
ABBREV_TAC `n =
FST (
SND (
SND (
HYP (x,V,E)))) `;
ABBREV_TAC `f =
SND (
SND (
SND (
HYP (x,V,E)))) `;
REPEAT (DOWN THEN ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b ==> a ==> c `]);
PHA;
REWRITE_TAC[FST_SND_FORM_OF_4_TUPLE];
NHANH (
FIRST_AAUHTVE);
SIMP_TAC[];
SIMP_TAC[GSYM hypermap_tybij]]);;
let ELMS_OF_HYPERMAP_HYP = prove_by_refinement
(`
FAN (x,V,E)
==> dart (hypermap (
HYP (x,V,E))) =
darts_of_hyp E V /\
edge_map (hypermap (
HYP (x,V,E))) =
ee_of_hyp (x,V,E) /\
node_map (hypermap (
HYP (x,V,E))) =
nn_of_hyp (x,V,E) /\
face_map (hypermap (
HYP (x,V,E))) =
ff_of_hyp (x,V,E)`,
REWRITE_TAC[self_pairs; IN_ELIM_THM; PAIR_EQ];
STRIP_TAC;
ASM_SIMP_TAC[W_SUBSET_SINGLETON_IMP_IDE; EMPTY_SUBSET];
SUBGOAL_THEN ` ! n . (nn_of_hyp (x,V,E) POWER n) y IN darts_of_hyp E V `
ASSUME_TAC;
INDUCT_TAC;
ASM_REWRITE_TAC[POWER; I_THM];
REWRITE_TAC[COM_POWER; o_THM];
ASM_MESON_TAC[IN_DARTS_IFF_NN_OF_HYP_TOO];
ASM_REWRITE_TAC[COM_POWER; o_THM; nn_of_hyp2]]);;
let FAN_IMP_BIJ_V_NODE_OF_HYP =
prove_by_refinement(`
FAN ((x:real^3),V,E) /\
f =
(\u. if u
IN V
then node (hypermap (
HYP (x,V,E))) (u,
choose_nd_point u E V)
else {})
==>
BIJ f V {node (hypermap (
HYP (x,V,E))) y | y | y
IN darts_of_hyp E V}`,
[STRIP_TAC;
ASM_SIMP_TAC[];
FIRST_X_ASSUM (fun x -> REWRITE_TAC[x]);
ASSUME_TAC
choose_nd_point;
REWRITE_TAC[
BIJ] THEN CONJ_TAC;
(* subgoal 1 *)
REWRITE_TAC[
INJ] THEN CONJ_TAC;
(* subgoal 1.1 *)
GEN_TAC THEN SIMP_TAC[];
UNDISCH_TAC `
FAN ((x:real^3),V,E) `;
REWRITE_TAC[
FAN] THEN REPEAT STRIP_TAC;
ASM SET_TAC[];
(* subgoal 1.2 *)
IMP_TAC THEN IMP_TAC THEN SIMP_TAC[];
NHANH (MESON[
X_IN_HYP_ORBITS] `node H (x:A) = A ==> x
IN A `);
REPEAT STRIP_TAC;
DOWN;
ASM_SIMP_TAC[node;
ELMS_OF_HYPERMAP_HYP;
orbit_map;
IN_ELIM_THM];
STRIP_TAC;
DOWN;
SUBGOAL_THEN ` y:real^3
IN V ` MP_TAC;
FIRST_ASSUM ACCEPT_TAC;
SUBGOAL_THEN `
UNIONS E
SUBSET (V:real^3 -> bool) ` MP_TAC;
UNDISCH_TAC `
FAN (x:real^3,V,E) `;
SIMP_TAC[
FAN];
ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `];
NHANH
choose_nd_point;
IMP_TAC;
REMOVE_TAC;
IMP_TAC THEN REMOVE_TAC;
SUBGOAL_THEN `
FAN (x:real^3, V,E) ` MP_TAC;
ASM_REWRITE_TAC[];
ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `];
SIMP_TAC[
N_HYP_TO_AZIM_CYCLE_LEM];
REMOVE_TAC;
SIMP_TAC[
PAIR_EQ];
(* suggoal 2 *)
REWRITE_TAC[
SURJ] THEN CONJ_TAC;
(* subgoal 2.1 *)
GEN_TAC THEN SIMP_TAC[];
UNDISCH_TAC `
FAN ((x:real^3),V,E) `;
REWRITE_TAC[
FAN] THEN REPEAT STRIP_TAC;
ASM SET_TAC[];
(* subgaol 2.2 *)
GEN_TAC;
REWRITE_TAC[
IN_ELIM_THM];
STRIP_TAC;
EXISTS_TAC `
FST (y:real^3 # real^3 )`;
UNDISCH_TAC `
FAN ((x:real^3),V,E) `;
REWRITE_TAC[
FAN] THEN STRIP_TAC;
ASSUME_TAC2 (ISPECL [`E:(real^3 -> bool) -> bool `;
` y: real^3 # real^3`;`V:real^3 -> bool `]
(GEN_ALL
IN_DARTS_HYP_IMP_FST_SND_IN_V));
ASM_SIMP_TAC[node; REWRITE_RULE[
FAN]
ELMS_OF_HYPERMAP_HYP];
MP_TAC (ISPECL [`x: real^3 `;` V:real^3 -> bool `;
` E: (real^3 -> bool) -> bool`;
`
FST (y:real^3# real^3 ) `]
XOHLED);
ANTS_TAC;
REPLICATE_TAC 5 DOWN;
PHA THEN ASM_SIMP_TAC[
FAN];
REWRITE_TAC[
orbit_map];
SUBGOAL_THEN `
FST (y:real^3#real^3)
IN V ` MP_TAC;
ASM_REWRITE_TAC[];
SUBGOAL_THEN `
UNIONS E
SUBSET (V:real^3 -> bool) ` MP_TAC;
ASM_REWRITE_TAC[];
ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `];
NHANH
choose_nd_point;
IMP_TAC;
REMOVE_TAC;
IMP_TAC THEN REMOVE_TAC;
SUBGOAL_THEN `
FAN (x:real^3, V,E) ` MP_TAC;
ASM_REWRITE_TAC[
FAN];
ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `];
SIMP_TAC[
N_HYP_TO_AZIM_CYCLE_LEM];
REMOVE_TAC;
MP_TAC (ISPEC `y: real^3#real^3` (GSYM
PAIR));
ABBREV_TAC `fy =
FST (y:real^3#real^3)`;
ABBREV_TAC `sy =
SND (y:real^3#real^3)`;
(*
e (SIMP_TAC[N_HYP_TO_AZIM_CYCLE_LEM]);;
*)
STRIP_TAC;
SUBGOAL_THEN ` (y:real^3 # real^3)
IN darts_of_hyp E V ` MP_TAC;
ASM_REWRITE_TAC[];
SUBGOAL_THEN `
FAN (x:real^3, V,E) ` MP_TAC;
ASM_REWRITE_TAC[
FAN];
ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `];
FIRST_ASSUM (fun x -> REWRITE_TAC[x]);
SIMP_TAC[
N_HYP_TO_AZIM_CYCLE_LEM];
REMOVE_TAC;
DOWN;
(* ==================================== *)
DISCH_TAC;
FIRST_X_ASSUM (MP_TAC o (SPECL [`fy: real^3 `]));
DISCH_THEN (MP_TAC o SPEC_ALL) THEN ANTS_TAC;
(* sub I *)
ASM_SIMP_TAC[];
(* sub II *)
REPEAT STRIP_TAC;
ASSUME_TAC2 (SPEC_ALL (ISPECL [`fy:real^3`] (GEN_ALL
UNI_E_IMP_EE_EQ_SET_OF_EDGE)));
FIRST_X_ASSUM (SUBST_ALL_TAC o SYM);
ASM_CASES_TAC `(y:real^3 # real^3)
IN ord_pairs E `;
ASSUME_TAC (UNDISCH (SPEC_ALL (
ISPECL [`V: real^3 -> bool `;` y:real^3 # real^3 `;` (choose_nd_point: real^3 ->
((real^3 -> bool) -> bool) ->(real^3 -> bool) -> real^3) fy E V`;`
E:(real^3 -> bool) -> bool `]
(GEN_ALL
IN_ORD_PAIRS_IMP_IMP_IN_TOO))));
DOWN;
ASM_REWRITE_TAC[];
DOWN THEN NHANH
IN_ORD_PAIRS_IMP_SND_IN_EE_FST;
ASM_REWRITE_TAC[];
REPEAT STRIP_TAC;
(*
e (DOWN_TAC THEN NHANH CYCLIC_SET_IMP_STABLE_SET);;
*)
SUBGOAL_THEN ` {fy:real^3, sy}
IN E ` MP_TAC;
UNDISCH_TAC ` (sy:real^3)
IN EE fy E `;
REWRITE_TAC[
EE;
IN_ELIM_THM];
SUBGOAL_THEN `
FAN (x:real^3,V,E) ` MP_TAC;
ASM_REWRITE_TAC[
FAN];
PHA;
NHANH
CYCLIC_SET_IMP_STABLE_SET2;
STRIP_TAC;
FIRST_ASSUM (ASSUME_TAC o (SPEC `sy:real^3 `));
FIRST_ASSUM (ASSUME_TAC o (SPEC `(choose_nd_poind: real^3 ->
((real^3 -> bool) -> bool) ->(real^3 -> bool) -> real^3) fy E V`));
DOWN THEN DOWN THEN DISCH_THEN ASSUME_TAC2;
FIRST_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC `\x. x = a ==> b ` [x]);
STRIP_TAC;
REWRITE_TAC[
EXTENSION];
GEN_TAC THEN EQ_TAC;
(* sub 2.1 *)
REWRITE_TAC[
IN_ELIM_THM; ARITH_RULE` n >= 0 `];
DISCH_THEN CHOOSE_TAC;
ASM_SIMP_TAC[
PAIR_EQ;
POWER_TO_ITER];
DOWN THEN DOWN;
SET_TAC[];
(* sub 2.2 *)
REWRITE_TAC[
IN_ELIM_THM; ARITH_RULE` n >= 0 `];
DISCH_THEN CHOOSE_TAC;
ASM_SIMP_TAC[
PAIR_EQ;
POWER_TO_ITER];
DOWN THEN DOWN;
SET_TAC[];
(* sub IIIIII *)
ASSUME_TAC2 (prove(`y
IN darts_of_hyp E (V:real^3 -> bool)
/\ ~(y
IN ord_pairs E)
==> y
IN self_pairs E V `,
REWRITE_TAC[
darts_of_hyp;
IN_UNION]
THEN CONV_TAC TAUT));
UNDISCH_TAC `fy,
choose_nd_point fy E V
IN darts_of_hyp E (V:real^3 -> bool) `;
DOWN;
EXPAND_TAC "fy";
PHA;
NHANH IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL;
STRIP_TAC;
UNDISCH_TAC `y IN darts_of_hyp E (V:real^3 -> bool) `;
UNDISCH_TAC `y IN self_pairs E (V:real^3 -> bool) `;
PHA;
UNDISCH_TAC `y = (fy:real^3), (sy: real^3 ) `;
ASM_REWRITE_TAC[];
SIMP_TAC[];
EXPAND_TAC "fy";
DISCH_THEN (fun x -> PAT_REWRITE_TAC`\x. x /\ y ==> z ` [GSYM x]);
NHANH IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL;
DOWN;
ASM_REWRITE_TAC[];
ONCE_REWRITE_TAC[EQ_SYM_EQ];
SIMP_TAC[]]);;
FIRST_X_ASSUM (fun x -> REWRITE_TAC[x]);
ASM_REWRITE_TAC[HYP]]);;
NHANH HYP_LEMMA;
REWRITE_TAC[dart];
REWRITE_TAC[GSYM hypermap_tybij; HYP];
SIMP_TAC[]]);;
USE_FIRST `dart (hypermap (HYP (vec 0,V,E))) = darts_of_hyp E (V:real^3 -> bool) `
( fun x -> REWRITE_TAC[GSYM x]);
REPLICATE_TAC 3 DOWN;
ONCE_REWRITE_TAC[EQ_SYM_EQ];
ASM_REWRITE_TAC[IN_ELIM_THM; SUBSET];
MESON_TAC[];
(* SUB 2.1 *)
CONJ_TAC;
(* sub 2.1.1 *)
REPEAT STRIP_TAC;
MP_TAC LOCAL_FAN_FINITE_FF;
ANTS_TAC THENL [
REWRITE_TAC[local_fan; dih2k] THEN
LET_TAC THEN ASM_SIMP_TAC[] THEN
ASM_MESON_TAC[];
ASM_CASES_TAC ` CARD (FF:real^3 # real^3 -> bool) = 0`];
(* sub I *)
DOWN THEN PHA;
NHANH (MESON[CARD_EQ_0]` CARD FF = 0 /\ FINITE FF ==> FF = {} `);
STRIP_TAC;
MP_TAC (ISPECL [`H: (real^3#real^3) hypermap `;` x: real^3 # real^3 `] face_refl);
DOWN;
ASM_SIMP_TAC[NOT_IN_EMPTY];
(* SUB II *)
MP_TAC (ISPECL [` CARD (FF: (real^3 # real^3 ) -> bool) `;` y: real^3 # real^3 `;
`face_map (H:(real^3 # real^3) hypermap) `;` x: real^3 # real^3 `]
(GEN_ALL HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT));
ANTS_TAC THENL [
ASM_REWRITE_TAC[GSYM face];
REWRITE_TAC[GSYM face]];
DISCH_TAC;
MP_TAC (ISPECL [` CARD (FF: (real^3 # real^3 ) -> bool) `;` x': real^3 # real^3 `;
`face_map (H:(real^3 # real^3) hypermap) `;` x: real^3 # real^3 `]
(GEN_ALL HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT));
ANTS_TAC THENL [
ASM_REWRITE_TAC[GSYM face];
ASM_REWRITE_TAC[GSYM face]];
REPEAT STRIP_TAC;
MP_TAC (ISPECL [`CARD (FF: real^3 # real^3 -> bool) `;
` H: (real^3 # real^3) hypermap `] (GEN_ALL DIH2K_IMP_SIMPLE_HYPERMAP));
ANTS_TAC;
(* SUB GOAL *)
ASM_SIMP_TAC[dih2k];
EXPAND_TAC "H";
ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^ 3 ` ELMS_OF_HYPERMAP_HYP));
MP_TAC (REWRITE_RULE[local_fan] LOCAL_IMP_FINITE_DARTS);
ANTS_TAC THENL [
LET_TAC THEN
REWRITE_TAC[dih2k] THEN
ASM_MESON_TAC[];
ASM_REWRITE_TAC[]];
(* =============== *)
(* SUB *)
NHANH lemma_simple_hypermap;
STRIP_TAC;
FIRST_ASSUM (MP_TAC o (SPEC `y: real^3 # real^3 `));
UNDISCH_TAC `node H x' = node H (y: real^3 # real^3 ) `;
DISCH_THEN (fun x -> REWRITE_TAC[SYM x]);
ASM_REWRITE_TAC[];
UNDISCH_TAC `face H x' = face H (x: real^3 # real^3 ) `;
DISCH_THEN (fun x -> REWRITE_TAC[SYM x]);
ASM_REWRITE_TAC[];
SET_TAC[];
(* ---------------------------------- *)
ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^3 ` ELMS_OF_HYPERMAP_HYP));
DOWN;
ONCE_REWRITE_TAC[EQ_SYM_EQ];
ASM_SIMP_TAC[];
STRIP_TAC;
ASSUME_TAC2 (ISPEC `H:(real^3 # real^3 ) hypermap ` lemma_face_subset);
CONJ_TAC;
STRIP_TAC THEN DOWN THEN PHA;
SET_TAC[];
REWRITE_TAC[IN_ELIM_THM];
REPEAT STRIP_TAC;
MP_TAC (ISPECL [`CARD (FF: real^3#real^3->bool) `;` H : (real^3#real^3)hypermap`]
( GEN_ALL DIH_IMP_EVERY_NODE_INTER_FACE));
ANTS_TAC THENL [
REWRITE_TAC[dih2k] THEN
ASM_SIMP_TAC[];
DISCH_THEN (MP_TAC o (SPECL [`y:real^3 # real^3 `;`x:real^3# real^3`]))];
REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET];
DISCH_THEN ASSUME_TAC2;
FIRST_X_ASSUM CHOOSE_TAC;
EXISTS_TAC `d: real^3 # real^3 `;
FIRST_X_ASSUM MP_TAC THEN NHANH lemma_node_identity;
ASM_SIMP_TAC[]]);;
(* ++++++++++++++ *)
(* +++++++++++++ *)
(* local_fan (V,E,FF) /\ f = (\y. node (hypermap (HYP (vec 0,V,E))) y)
==> BIJ f FF
{node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V}
*)
REWRITE_RULE[MESON[]` (! h. a /\ h = f ==> BIJ h S C ) <=> ( a ==> BIJ f S C ) `]
(GEN `f: real^3#real^3->real^3#real^3->bool ` LOCAL_FAN_IMP_BIJ_FF_NODES);;
(*
val it : thm =
|- local_fan (V,E,FF)
==> BIJ (\y. node (hypermap (HYP (vec 0,V,E))) y) FF
{node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V}
*)
REWRITE_RULE[MESON[]` (! h. a /\ h = f ==> BIJ h S C ) <=> ( a ==> BIJ f S C ) `]
(GEN `f: real^3->real^3#real^3->bool` FAN_IMP_BIJ_V_NODE_OF_HYP);;
FAN_IMP_BIJ_V_NODE_OF_HYP ;;
(* val it : thm =
|- FAN (x,V,E) /\
f =
(\u. if u IN V
then node (hypermap (HYP (x,V,E))) (u,choose_nd_point u E V)
else {})
==> BIJ f V
{node (hypermap (HYP (x,V,E))) y | y | y IN darts_of_hyp E V}
*)
let ITER_FIXPOINT2 =
MESON[ITER_FIXPOINT]`! f x. f x = x ==> ! n . ITER n f x = x `;;
let BIJ_BETWEEN_FF_AND_V = prove_by_refinement(
`
local_fan (V,E,
FF) /\ k = (\x.
FST x )
==>
BIJ k
FF V `,
[ABBREV_TAC ` f =
(\u. if (u:real^3)
IN V
then node (hypermap (
HYP (
vec 0,V,E))) (u,
choose_nd_point u E V)
else {}) `;
ABBREV_TAC `h = (\y. node (hypermap (
HYP (
vec 0,V,E))) y) ` ;
DOWN_TAC;
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
STRIP_TAC;
ASSUME_TAC2 (
prove(`
local_fan (V,E,
FF) /\
f =
(\u. if (u:real^3)
IN V
then node (hypermap (
HYP (
vec 0,V,E))) (u,
choose_nd_point u E V)
else {}) /\
h = (\y. node (hypermap (
HYP (
vec 0,V,E))) y)
==>
BIJ h
FF
{node (hypermap (
HYP (
vec 0,V,E))) y | y | y
IN darts_of_hyp E V} /\
BIJ f V
{node (hypermap (
HYP (
vec 0,V,E))) y | y | y
IN darts_of_hyp E V}`,
SIMP_TAC[
FAN_IMP_BIJ_V_NODE_OF_HYP ;
LOCAL_FAN_IMP_BIJ_FF_NODES] THEN
REWRITE_TAC[
local_fan] THEN LET_TAC THEN
EXPAND_TAC "H" THEN
SIMP_TAC[
FAN_IMP_BIJ_V_NODE_OF_HYP]));
DOWN;
NHANH (REWRITE_RULE[
RIGHT_FORALL_IMP_THM]
(GEN `ff: B -> C ` (REWRITE_RULE[TAUT` a/\b/\c ==> d <=>
a /\ b ==> c ==> d `]
TOW_BIJS_IMP_BIJ_BETWEEN_FIRST)));
REWRITE_TAC[MESON[]` (! x. x = a ==> P x ) <=> P a `];
ABBREV_TAC ` ff = (\x. if x
IN FF then @a. a
IN V /\
(h:real^3#real^3->real^3#real^3->bool) x = f (a:real^3) else aa) `;
STRIP_TAC;
SUBGOAL_THEN `(!x. x
IN FF ==> (ff: real^3#real^3->real^3)
x = k x ) ` ASSUME_TAC;
SUBGOAL_THEN ` (! x. (x:real^3 # real^3)
IN FF ==> ff x
IN (V:real^3 -> bool) /\
(h:real^3#real^3->real^3#real^3->bool) x = f ( ff x )) ` ASSUME_TAC;
(* SUBGOAL 1 *)
EXPAND_TAC "ff";
SIMP_TAC[];
STRIP_TAC THEN STRIP_TAC;
CONV_TAC SELECT_CONV;
DOWN_TAC;
REWRITE_TAC[BIJ; INJ; SURJ];
MESON_TAC[];
(* end 1 *)
(* sub 2 *)
FIRST_X_ASSUM NHANH;
STRIP_TAC;
STRIP_TAC;
DOWN;
ASM_REWRITE_TAC[];
STRIP_TAC;
MP_TAC (ISPECL [` hypermap (HYP (vec 0,V,E)) `;` x: real^3 # real^3 `] node_refl);
ASM_REWRITE_TAC[];
ASSUME_TAC2 LOCAL_FAN_IMP_FAN;
DOWN THEN PHA;
NHANH IN_NODE_IMP_FIRST_EQ;
EXPAND_TAC "k";
SIMP_TAC[EQ_SYM_EQ];
(* subgoal -------------------------- *)
(* oooooooooooooooooooooooooooooooooo *)
DOWN THEN DOWN;
PHA;
REWRITE_TAC[INDENT_IN_S1_IMP_BIJ ]]);;
REPLICATE_TAC 3 DOWN THEN PHA;
SIMP_TAC[];
STRIP_TAC;
REWRITE_TAC[face; IMAGE; orbit_map; IN_ELIM_THM];
SUBGOAL_THEN ` (! n. (face_map H POWER n) (x,(hro:real^3 -> real^3 ) x) =
((hro POWER n) x, (hro POWER ( n + 1 )) x )) ` ASSUME_TAC;
INDUCT_TAC;
REWRITE_TAC[POWER; I_THM; ARITH_RULE` 0 + 1 = 1`; POWER_1];
ASM_REWRITE_TAC[COM_POWER; o_THM];
DOWN THEN ONCE_REWRITE_TAC[EQ_SYM_EQ];
NHANH in_orbit_lemma;
ASSUME_TAC2 (SPEC `(vec 0):real^3 ` (GEN `x:real^3 ` ELMS_OF_HYPERMAP_HYP));
DOWN;
ASM_SIMP_TAC[FUN_EQ_THM];
STRIP_TAC;
ONCE_REWRITE_TAC[EQ_SYM_EQ];
STRIP_TAC;
SUBGOAL_THEN `ff_of_hyp (vec 0,(V:real^3 -> bool),E) ((face_map H POWER n) (x,hro x)) IN (FF: real^3 # real^3 -> bool) `
ASSUME_TAC;
ASM_SIMP_TAC[];
DOWN;
NHANH IN_ORBIT_MAP_IMP_F_Y;
REWRITE_TAC[GSYM face];
ASM_SIMP_TAC[];
(* gggggggggggggggggggg *)
DOWN;
ASM_REWRITE_TAC[];
SUBGOAL_THEN` (hro POWER n) (x:real^3),(hro POWER (n + 1)) x IN
darts_of_hyp E V ` MP_TAC;
DOWN;
REWRITE_TAC[GSYM face];
DOWN_TAC THEN NHANH lemma_face_subset;
STRIP_TAC;
SUBGOAL_THEN` (x:real^3), (hro: real^3 -> real^3) x IN dart H ` MP_TAC;
MATCH_MP_TAC (SET_RULE` face H (x':real^3 # real^3) SUBSET S/\
y IN face H (x':real^3 # real^3) ==> y IN S `);
ASM_REWRITE_TAC[];
NHANH lemma_face_subset;
STRIP_TAC;
DOWN;
DOWN_TAC THEN REWRITE_TAC[GSYM FUN_EQ_THM; ETA_AX];
STRIP_TAC;
DOWN;
ASM_REWRITE_TAC[];
MATCH_MP_TAC (SET_RULE` x IN a ==> a SUBSET b ==> x IN b `);
FIRST_X_ASSUM ACCEPT_TAC;
ASM_SIMP_TAC[ff_of_hyp];
REMOVE_TAC;
DOWN_TAC;
ONCE_REWRITE_TAC[EQ_SYM_EQ];
STRIP_TAC;
DOWN;
UNDISCH_TAC `face H (x,(hro: real^3 -> real^3) x) = face H x' `;
SIMP_TAC[];
DISCH_TAC;
UNDISCH_TAC `face H (x':real^3 # real^3 ) = FF`;
SIMP_TAC[];
FIRST_ASSUM NHANH;
REWRITE_TAC[PAIR_EQ];
SIMP_TAC[GSYM ADD1; COM_POWER; o_THM];
(* iiiiiiiiiiiiiiiiiiiiiiii *)
REWRITE_TAC[FUN_EQ_THM];
GEN_TAC THEN EQ_TAC;
REWRITE_TAC[IN_ELIM_THM];
STRIP_TAC;
DOWN;
ASM_SIMP_TAC[];
STRIP_TAC;
EXISTS_TAC `n: num `;
ASM_SIMP_TAC[];
(* ::::::::::::::::::: *)
REWRITE_TAC[IN_ELIM_THM];
STRIP_TAC;
EXISTS_TAC `(hro POWER n) (x: real^3 ), (hro POWER (n + 1)) x `;
ASM_REWRITE_TAC[];
EXISTS_TAC `n:num `;
ASM_REWRITE_TAC[]]);;
let SET_TAC =
let basicthms =
[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT;
IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in
let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @
[IN_ELIM_THM; IN] in
let PRESET_TAC =
TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN
REPEAT COND_CASES_TAC THEN
REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN
REWRITE_TAC allthms in
fun ths ->
PRESET_TAC THEN
(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN
MESON_TAC[];;
let SET_RULE tm = prove(tm,SET_TAC[]);;
(* ====================================== *)
(* ============ MFMPCVM ================ *)
(* ===================================== *)
(* ================================= *)
(* PJRIMCV *)
(* ================================= *)
(*
let wedge_fan_gt = new_definition
` wedge_fan_gt v E = wedge_in_fan_gt (v, rho_fan v) E `;;
let wedge_fan_ge = new_definition
`wedge_fan_ge v E = wedge_in_fan_ge (v, rho_fan v) E`;;
*)
(* ============================= *)
(* localization *)
(* BIFQATK *)
(* ============================= *)
let IMP_FAN_V_PRIME_E_PRIME = prove_by_refinement
(`
FAN (v, V, E) /\ (?x. x
IN dart (hypermap (
HYP (v,V,E))) /\
FF = face ( hypermap (
HYP (v, V, E))) x)
==>
FAN (v,
v_prime V
FF ,
e_prime E
FF ) `,
[REWRITE_TAC[
FAN;
v_prime;
e_prime];
STRIP_TAC;
CONJ_TAC;
REWRITE_TAC[
UNIONS_SUBSET;
IN_ELIM_THM];
REPEAT STRIP_TAC;
DOWN THEN SIMP_TAC[];
DOWN;
MP_TAC (SPEC `v: real^3 ` (GEN `x: real^3 `
ELMS_OF_HYPERMAP_HYP));
ANTS_TAC THENL [
ASM_REWRITE_TAC[
FAN];
DOWN THEN DOWN];
REWRITE_TAC[face];
SIMP_TAC[];
STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC;
NHANH_PAT `\x. x ==> y `
IN_ORBIT_MAP_IMP_F_Y;
REWRITE_TAC[
ff_of_hyp];
FIRST_ASSUM (fun x -> REWRITE_TAC[GSYM x; GSYM face]);
SUBGOAL_THEN ` x
IN dart (hypermap (
HYP ((v:real^3),V,E))) ` MP_TAC;
ASM_REWRITE_TAC[];
IMP_TAC;
NHANH
lemma_face_subset;
IMP_TAC THEN REMOVE_TAC;
ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `];
ONCE_REWRITE_TAC[SET_RULE` a
SUBSET b /\ x
IN a <=> x
IN b /\ a
SUBSET b /\ x
IN a `];
ASM_SIMP_TAC[];
IMP_TAC THEN REMOVE_TAC;
UNDISCH_TAC ` {v', (w:real^3) }
IN E `;
UNDISCH_TAC `
UNIONS E
SUBSET (V: real^3 -> bool) `;
REWRITE_TAC[
UNIONS_SUBSET];
DISCH_THEN NHANH;
SET_TAC[];
UNDISCH_TAC `
graph (E:(real^3 -> bool) -> bool) `;
REWRITE_TAC[
graph];
DISCH_TAC;
CONJ_TAC;
DOWN THEN SET_TAC[];
REWRITE_TAC[fan1; fan2; fan6; fan7];
CONJ_TAC;
DOWN_TAC;
REWRITE_TAC[fan1];
STRIP_TAC;
CONJ_TAC;
UNDISCH_TAC `FINITE (V:real^3 -> bool) `;
MATCH_MP_TAC (REWRITE_RULE[TAUT` a /\ b ==> c <=>
b ==> a ==> c `]
FINITE_SUBSET);
SET_TAC[];
DOWN THEN DOWN;
NHANH (MESON[
face_refl]`
FF = face H x ==> x
IN FF `);
REPEAT STRIP_TAC;
MP_TAC (SPEC `v:real^3 ` (GEN `x:real^3 `
ELMS_OF_HYPERMAP_HYP));
ANTS_TAC THENL [
ASM_REWRITE_TAC[
FAN;
graph; fan1];
STRIP_TAC];
UNDISCH_TAC `x
IN dart (hypermap (
HYP (v,V,E)))`;
ASM_REWRITE_TAC[];
STRIP_TAC;
ASSUME_TAC2 (
ISPEC `x:real^3#real^3 ` (GEN `y:A#A `
IN_DARTS_HYP_IMP_FST_SND_IN_V));
UNDISCH_TAC `(x:real^3 # real^3 )
IN FF `;
REWRITE_TAC[];
ONCE_REWRITE_TAC[GSYM
PAIR];
ABBREV_TAC ` fx =
FST (x:real^3 # real^3) `;
ASM SET_TAC[];
DOWN_TAC THEN REWRITE_TAC[fan1; fan2];
STRIP_TAC;
CONJ_TAC;
ASM SET_TAC[];
DOWN_TAC THEN REWRITE_TAC[fan6; fan7];
SET_TAC[]]);;
(* ================================= *)
(* definition 7.8 RTPRRJS *)
(* chapter: Local Fan *)
(* ================================= *)
open Aff_sgn_tac;;
let AFF_SGN_TRULE tm = prove (tm, AFF_SGN_TAC);;
let FAN7_SIMPLE =
prove(`!x. fan7 ((x:real^N),V,E) ==> (!a b. a
IN V /\ b
IN V
==> aff_ge {x} {a}
INTER aff_ge {x} {b} =
aff_ge {x} ({a}
INTER {b})) `,
REWRITE_TAC[fan7] THEN SET_TAC[]);;
let AFF_GE_TO_AFF_GT2_GE1 = prove_by_refinement(
` ~( u = x ) /\ ~( v = x ) ==>
aff_ge {x} {u,v} = aff_gt {x} {u,v}
UNION aff_ge {x} {u}
UNION aff_ge {x} {v} `,
[SIMP_TAC[
AFF_SGN_TRULE` ~( u = x ) /\ ~( v = x ) ==>
aff_ge {x} {u,v} = {w| ? tx tu tv. &0 <= tu /\ &0 <= tv /\
tx + tu + tv = &1 /\ w = tx % x + tu % u + tv % v } `];
SIMP_TAC[
AFF_SGN_TRULE` ~( u = x ) /\ ~( v = x ) ==>
aff_gt {x} {u,v} = {w| ? tx tu tv. &0 < tu /\ &0 < tv /\
tx + tu + tv = &1 /\ w = tx % x + tu % u + tv % v } `];
SIMP_TAC[
AFF_SGN_TRULE` ~( u = x ) ==>
aff_ge {x} {u} = {w| ? tx tu . &0 <= tu /\
tx + tu = &1 /\ w = tx % x + tu % u} `];
REWRITE_TAC[SET_RULE` a = b <=> (!x. x
IN a <=> x
IN b) `;
IN_ELIM_THM;
IN_UNION];
REPEAT STRIP_TAC;
EQ_TAC;
STRIP_TAC;
ASM_CASES_TAC ` tu = &0 `;
DISJ2_TAC THEN DISJ2_TAC;
EXISTS_TAC ` tx:
real `;
EXISTS_TAC `tv:real`;
ASM_SIMP_TAC[
VECTOR_MUL_LZERO;
VECTOR_ADD_LID];
ASM_REAL_ARITH_TAC;
(* ========= *)
ASM_CASES_TAC ` tv = &0 `;
DISJ2_TAC THEN DISJ1_TAC;
EXISTS_TAC `tx:real`;
EXISTS_TAC `tu:real`;
ASM_REWRITE_TAC[
VECTOR_MUL_LZERO;
VECTOR_ADD_RID];
ASM_REAL_ARITH_TAC;
DISJ1_TAC;
ASM_MESON_TAC[REAL_ARITH` &0 <= a /\ ~(a = &0 ) <=> &0 < a `];
(* _______________ *)
STRIP_TAC;
ASM_MESON_TAC[REAL_ARITH` &0 <= a /\ ~(a = &0 ) <=> &0 < a `];
(* iiiii *)
EXISTS_TAC `tx:real`;
EXISTS_TAC `tu:real `;
EXISTS_TAC ` &0 `;
ASM_SIMP_TAC[
VECTOR_MUL_LZERO;
VECTOR_ADD_RID;
REAL_ADD_RID];
REAL_ARITH_TAC;
(* yyyyyyyyyyyy *)
EXISTS_TAC ` tx:real `;
EXISTS_TAC ` &0 `;
EXISTS_TAC `tu:real`;
ASM_SIMP_TAC[REAL_ADD_LID;
VECTOR_MUL_LZERO;
VECTOR_ADD_LID];
REAL_ARITH_TAC]);;
let CIZMRRH = prove_by_refinement
(`
local_fan (V,E,
FF) ==>
generic V E /\ ~(circular V E \/ (? v w. lunar (v,w) V E )) \/
circular V E /\ ~(generic V E \/ (? v w. lunar (v,w) V E )) \/
(? v w. lunar (v,w) V E ) /\ ~( generic V E \/ circular V E ) `,
[ASM_CASES_TAC `(!v w u.
{(v:real^3), w}
IN E /\ u
IN V
==> aff_ge {
vec 0} {v, w}
INTER aff_lt {
vec 0} {u} = {})`;
REWRITE_TAC[
convex_local_fan; generic];
STRIP_TAC;
DISJ1_TAC;
ASM_REWRITE_TAC[circular; lunar; DE_MORGAN_THM];
CONJ_TAC;
REWRITE_TAC[
NOT_EXISTS_THM;
TAUT` ~( a /\ b /\ c) <=> a /\ b ==> ~c `];
ASM_MESON_TAC[
SET_RULE` a
INTER b = {} /\ aa
SUBSET a ==> aa
INTER b = {} `;
AFF_GT_SUBSET_AFF_GE];
REWRITE_TAC[GSYM circular;
NOT_EXISTS_THM; DE_MORGAN_THM];
REPEAT GEN_TAC THEN DISJ2_TAC;
ASM_CASES_TAC `{v:real^3, w}
SUBSET V `;
DISJ2_TAC;
REWRITE_TAC[GSYM (TAUT` ~ a ==> b <=> a \/ b `)];
DOWN_TAC;
REWRITE_TAC[
local_fan];
LET_TAC;
NHANH
FAN_IMP_NOT_EMPTY_DARTS;
NHANH
ELMS_OF_HYPERMAP_HYP;
ASM_SIMP_TAC[];
IMP_TAC;
REWRITE_TAC[TAUT`(a/\b)/\c <=> a/\b/\c`];
IMP_TAC;
IMP_TAC;
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
SIMP_TAC[];
NHANH (MESON[dih2k]` dih2k H d ==>
CARD (dart H) = 2 * d `);
MP_TAC (ISPEC `H: (real^3#real^3)hypermap `
hypermap_lemma);
REPEAT STRIP_TAC;
ASSUME_TAC2 (ISPEC `dart (H:(real^3#real^3)hypermap)`
CARD_EQ_0);
UNDISCH_TAC` ~( {} = dart (H:(real^3#real^3)hypermap)) `;
REWRITE_TAC[];
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
FIRST_X_ASSUM (SUBST1_TAC o SYM);
DOWN;
ASM_REWRITE_TAC[ARITH_RULE`2 * k = 0 <=> k = 0 `];
ONCE_REWRITE_TAC[TAUT` a ==> b <=> ~ b ==> ~ a `];
STRIP_TAC;
ASSUME_TAC2 (
ISPECL [`
CARD (FF:real^3#real^3 -> bool) `;`H:(real^3#real^3) hypermap `]
(GEN_ALL
DIH2K_IMP_NODE_MAP_X_DIFF_X));
DOWN_TAC;
REWRITE_TAC[
FAN;
INSERT_SUBSET;
EMPTY_SUBSET];
STRIP_TAC;
ASSUME_TAC2 (SPEC `v:real^3 ` IN_V_OF_FAN_EXISTS_DART);
DOWN;
ASM_REWRITE_TAC[];
FIRST_X_ASSUM NHANH;
STRIP_TAC;
DOWN THEN DOWN;
UNDISCH_TAC`
darts_of_hyp E (V:real^3 -> bool) = dart H `;
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
SIMP_TAC[];
STRIP_TAC;
REWRITE_TAC[
darts_of_hyp;
IN_UNION;
self_pairs;
IN_ELIM_THM];
ONCE_REWRITE_TAC[TAUT`a\/b <=> b\/a`];
DISCH_THEN DISJ_CASES_TAC;
DOWN THEN STRIP_TAC;
UNDISCH_TAC `
nn_of_hyp (
vec 0,(V:real^3 -> bool),E) =
node_map H`;
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
SIMP_TAC[];
STRIP_TAC;
SUBGOAL_THEN ` (v:real^3,v':real^3)
IN darts_of_hyp E V ` MP_TAC;
REWRITE_TAC[
darts_of_hyp;
IN_UNION];
DISJ2_TAC;
REWRITE_TAC[
self_pairs;
IN_ELIM_THM];
EXISTS_TAC `v'':real^3`;
ASM_REWRITE_TAC[];
SIMP_TAC[
nn_of_hyp];
REMOVE_TAC;
UNDISCH_TAC`
EE (v'':real^3) E = {} `;
DOWN THEN DOWN;
SIMP_TAC[
PAIR_EQ;
EMPTY_SUBSET;
W_SUBSET_SINGLETON_IMP_IDE];
(* --------------------------------------------------- *)
DOWN;
REWRITE_TAC[
ord_pairs;
IN_ELIM_THM;
PAIR_EQ];
STRIP_TAC;
ASM_REWRITE_TAC[];
STRIP_TAC;
UNDISCH_TAC` (w:real^3)
IN V `;
UNDISCH_TAC ` {(a:real^3),b}
IN E `;
PHA;
UNDISCH_TAC `!v w u.
{(v:real^3), w}
IN E /\ u
IN V
==> {} = aff_ge {
vec 0} {v, w}
INTER aff_lt {
vec 0} {u}`;
DISCH_TAC;
FIRST_ASSUM NHANH;
DOWN_TAC;
REWRITE_TAC[fan2];
REWRITE_TAC[SET_RULE` ~( x
IN s) <=> (!a. a
IN s ==> ~(a = x )) `];
REPLICATE_TAC 10 (IMP_TAC THEN DISCH_TAC);
FIRST_X_ASSUM NHANH;
STRIP_TAC;
REWRITE_TAC[
COLLINEAR_LEMMA; DE_MORGAN_THM];
CONJ_TAC THENL [
EXPAND_TAC "a" THEN
FIRST_ASSUM ACCEPT_TAC;
CONJ_TAC THENL [
FIRST_ASSUM ACCEPT_TAC;
REWRITE_TAC[]]];
ASSUME_TAC2 (ISPEC `
vec 0:real^3 `
FAN7_SIMPLE);
DOWN THEN PHA THEN STRIP_TAC;
STRIP_TAC;
ASM_CASES_TAC `c = &0 ` THENL [
UNDISCH_TAC `w = c % (a:real^3)` THEN
ASM_REWRITE_TAC[
VECTOR_MUL_LZERO];
ASM_CASES_TAC ` c = &1 `] THENL [
UNDISCH_TAC `w = c % (a:real^3) ` THEN
ASM_SIMP_TAC[
VECTOR_MUL_LID] THEN
EXPAND_TAC "a" THEN
FIRST_X_ASSUM ACCEPT_TAC;
ASM_CASES_TAC ` &0 < c `];
(* ---------- sub 1 ---------- *)
UNDISCH_TAC` w
IN (V:real^3 -> bool) `;
UNDISCH_TAC` v
IN (V:real^3 -> bool) `;
PHA;
FIRST_ASSUM NHANH;
UNDISCH_TAC`~(w = (v:real^3)) `;
SIMP_TAC[SET_RULE`~(a = b) <=> {a}
INTER {b} = {} `;
INTER_COMM];
REWRITE_TAC[
AFF_GE_EQ_AFFINE_HULL;
AFFINE_HULL_SING];
ASSUME_TAC2 (AFF_SGN_TRULE`!v. ~((v:real^3) =
vec 0) ==>
aff_ge {
vec 0} {v} = { x| ?t0 tv. &0 <= tv /\ t0 + tv = &1 /\
x = t0 % (
vec 0) + tv % v } `);
ASSUME_TAC2 (SPEC `w:real^3` (AFF_SGN_TRULE`!v. ~((v:real^3) =
vec 0) ==>
aff_ge {
vec 0} {v} = { x| ?t0 tv. &0 <= tv /\ t0 + tv = &1 /\
x = t0 % (
vec 0) + tv % v } `));
DOWN THEN DOWN THEN PHA THEN SIMP_TAC[];
REPEAT STRIP_TAC;
DOWN;
UNDISCH_TAC ` ~((w:real^3) =
vec 0) `;
PHA;
MATCH_MP_TAC (SET_RULE` a
IN S ==> ~(~(a = x ) /\ S = {x}) `);
REWRITE_TAC[
IN_INTER;
IN_ELIM_THM];
CONJ_TAC;
EXISTS_TAC` &1 - c `;
EXISTS_TAC `c:real`;
UNDISCH_TAC `&0 < c `;
SIMP_TAC[REAL_ARITH` &0 < a ==> &0 <= a `;
REAL_ARITH` &1 - c + c = &1 `;
VECTOR_MUL_RZERO;
VECTOR_ADD_LID];
ASM_REWRITE_TAC[];
(* ============================ *)
EXISTS_TAC `&0 `;
EXISTS_TAC `&1 `;
SIMP_TAC[
VECTOR_MUL_LID;
VECTOR_MUL_RZERO;
VECTOR_ADD_LID];
REAL_ARITH_TAC;
UNDISCH_TAC ` ~(c = &0 ) `;
DOWN;
PHA;
REWRITE_TAC[REAL_ARITH` ~(&0 < c) /\ ~(c = &0) <=> c < &0 `];
STRIP_TAC;
UNDISCH_TAC` {} = aff_ge {
vec 0} {a, b}
INTER aff_lt {
vec 0} {(w:real^3)}`;
EXPAND_TAC "a";
EXPAND_TAC "b";
ASSUME_TAC2 (AFF_SGN_TRULE` ~((w:real^3) = vec 0) ==>
aff_lt {vec 0} {w} = {x | ? t0 tw . tw < &0 /\ t0 + tw = &1 /\
x = t0 % (vec 0) + tw % w }`);
ASSUME_TAC2 (
AFF_SGN_TRULE` ~((v:real^3) = vec 0) /\ ~( v' = vec 0) ==>
aff_ge {vec 0} {v,v'} = {x | ? t0 tv tv' . &0 <= tv /\
&0 <= tv' /\ t0 + tv + tv' = &1 /\
x = t0 % (vec 0) + tv % v + tv' % v' }`);
MATCH_MP_TAC (
SET_RULE` -- (w:real^3) IN S ==> {} = S ==> F `);
DOWN THEN DOWN THEN PHA THEN SIMP_TAC[];
REMOVE_TAC;
REWRITE_TAC[IN_INTER; IN_ELIM_THM];
CONJ_TAC;
EXISTS_TAC` &1 + c `;
EXISTS_TAC ` -- (c:real) `;
EXISTS_TAC `&0 `;
ASM_REWRITE_TAC[VECTOR_MUL_LNEG; VECTOR_MUL_RZERO; VECTOR_MUL_LZERO;
VECTOR_ADD_RID; VECTOR_ADD_LID];
DOWN THEN REAL_ARITH_TAC;
(* =================== *)
EXISTS_TAC `&2 `;
EXISTS_TAC ` -- &1 `;
REWRITE_TAC[VECTOR_MUL_LNEG; VECTOR_MUL_LID; VECTOR_MUL_RZERO; VECTOR_ADD_LID];
REAL_ARITH_TAC;
(* +++++++++++++++++++++++++++++++++++++++++++++++++ *)
(* ================================================= *)
ASM_SIMP_TAC[];
(* ************************************************* *)
(* ================================================= *)
DOWN;
REWRITE_TAC[NOT_FORALL_THM; TAUT` ~( a ==> b) <=> a /\ ~ b `;
local_fan];
LET_TAC;
REPEAT STRIP_TAC;
DOWN_TAC;
NHANH FAN_IMP_DIFF;
STRIP_TAC;
SUBGOAL_THEN ` (v:real^3) IN UNIONS E /\ w IN UNIONS E ` ASSUME_TAC
THENL [REWRITE_TAC[IN_UNIONS] THEN
ASM_MESON_TAC[SET_RULE` a IN {a,b} /\ b IN {a,b} `];
DOWN_TAC];
REWRITE_TAC[MESON[]`(!x. P x \/ Q x ==> R x) <=>
(! x. P x ==> R x ) /\ (!x. Q x ==> R x ) `];
STRIP_TAC;
DOWN THEN DOWN;
FIRST_X_ASSUM NHANH;
UNDISCH_TAC `(u:real^3) IN V `;
FIRST_ASSUM NHANH;
REPEAT STRIP_TAC;
ASSUME_TAC2 (
AFF_SGN_TRULE` ~((v:real^3) = vec 0 ) /\ ~(w = vec 0 ) ==>
aff_ge {vec 0} {v, w} = {x | ? t0 tv tw. &0 <= tv /\ &0 <= tw /\
t0 + tv + tw = &1 /\ x = t0 % (vec 0) + tv % v + tw % w } `);
ASSUME_TAC2 (
ISPECL [`(vec 0):real^3 `;`u:real^3`] (REWRITE_RULE[DISJOINT;
SET_RULE` {a} INTER {b} = {} <=> ~( b = a )`] AFF_LT_1_1));
SUBGOAL_THEN` ~ (generic (V:real^3 -> bool) E )` ASSUME_TAC
THENL [REWRITE_TAC[generic] THEN
ASM_MESON_TAC[];
UNDISCH_TAC `~(aff_ge {vec 0} {(v:real^3), w} INTER
aff_lt {vec 0} {u} = {})`];
ASSUME_TAC2 (
ISPECL [` v:real^3 `;` (vec 0): real^3 `;` w:real^3 `]
(GEN_ALL AFF_GE_TO_AFF_GT2_GE1));
DOWN THEN SIMP_TAC[];
STRIP_TAC;
REWRITE_TAC[SET_RULE`( a UNION b ) INTER c = {} <=> a INTER c = {} /\
b INTER c = {} `];
STRIP_TAC;
ASM_SIMP_TAC[];
DOWN THEN REWRITE_TAC[DE_MORGAN_THM];
DISCH_TAC;
ASM_CASES_TAC ` circular (V:real^3 -> bool) E ` THENL [
ASM_SIMP_TAC[lunar];
DISJ2_TAC];
ASM_SIMP_TAC[lunar];
DOWN THEN DOWN THEN STRIP_TAC;
(* there are three subgoal here *)
(* -------- sub 1 -------------- *)
REWRITE_TAC[circular];
ASM_MESON_TAC[];
(* --------- sub 2 -------------- *)
DISCH_TAC;
EXISTS_TAC `v:real^3`;
EXISTS_TAC `u:real^3 `;
ASSUME_TAC2 AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL;
DOWN;
ASM_SIMP_TAC[INSERT_COMM; INSERT_SUBSET; EMPTY_SUBSET];
DISCH_TAC;
MATCH_MP_TAC (SET_RULE`v IN UNIONS E /\ UNIONS E SUBSET V ==> v IN V `);
DOWN_TAC;
SIMP_TAC[FAN];
(* -------------- sub 3 ------------- *)
DISCH_TAC;
EXISTS_TAC `u:real^3 `;
EXISTS_TAC `w:real^3 `;
ASSUME_TAC2 (
SPEC `w:real^3 ` (GEN `v:real^3 ` AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL));
ASM_SIMP_TAC[];
ASM_SIMP_TAC[INSERT_COMM; INSERT_SUBSET; EMPTY_SUBSET];
MATCH_MP_TAC (SET_RULE`v IN UNIONS E /\ UNIONS E SUBSET V ==> v IN V `);
DOWN_TAC;
SIMP_TAC[FAN]]);;
end;;