(* ========================================================================== *)
(* 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 ===================== *)
module Wrgcvdr (* : Trigonometry2_type *) = struct
let build_sequence =
["general/sphere.hl";
"general/prove_by_refinement.hl";
(* "leg/geomdetail.hl";
"leg/affprops.hl";
"leg/cayleyR_def.hl";
"leg/collect_geom.hl";
(* flyspeck_needs "leg/collect_geom2.hl";*) (* slow and rarely needed *)
"nonlinear/ineq.hl";
"nonlinear/ineqdata3q1h.hl"; *)
"trigonometry/trig1.hl";
"trigonometry/trig2.hl";
(* "trigonometry/trigonometry.hl";
"volume/vol1.hl"; *)
"hypermap/hypermap.hl";
"fan/fan.hl"];;
map flyspeck_needs build_sequence;;
open Sphere;;
open Trigonometry1;;
open Trigonometry2;;
open Hypermap;;
open Fan;;
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 SET_RULE a = fun x -> prove(x, SET_TAC a );;
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 }`;;
(* this is the first assertion of AAUHTVE *)
let FIRST_AAUHTVE = new_axiom
`FAN (x,V,E) /\ HYP (x,V,E) = D,e,n,f
==> FINITE D /\
e permutes D /\
n permutes D /\
f permutes D /\
e o n o f = I /\
e o e = I `;;
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 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 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;;
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 (SET_RULE[]` {u,v} SUBSET V ==> v IN V `) THEN
FIRST_X_ASSUM MATCH_MP_TAC THEN
ASM_SIMP_TAC[]);;
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 (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[]]));;
(* ======================================================== *)
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))) =
e_of_hyp /\
node_map (hypermap (
HYP (x,V,E))) =
n_of_hyp (x,V,E) /\
face_map (hypermap (
HYP (x,V,E))) =
f_of_hyp (x,V,E)`,
prove(` UNIONS E SUBSET V /\ {a, b} IN E ==> a IN V /\ b IN V `,
REWRITE_TAC[UNIONS_SUBSET;
(GSYM o (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;;
(* John is helping me in this lemma *)
let CYCLIC_SET_IMP_STABLE_SET = new_axiom
`cyclic_set (W:real^3 -> bool) v w ==>
(! x. x IN W ==> W = { y | ? n. y = ITER n (azim_cycle W v w) x})`;;
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 THEN REWRITE_TAC[
N_HYP_TO_AZIM_CYCLE_LEM];
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;
N_HYP_TO_AZIM_CYCLE_LEM];
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)`;
SIMP_TAC[
N_HYP_TO_AZIM_CYCLE_LEM];
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;
DOWN_TAC THEN NHANH CYCLIC_SET_IMP_STABLE_SET;
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[]]);;
(* 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; SET_RULE[]` {f n | n | F } = {} `; FINITE_RULES];
REWRITE_TAC[ARITH_RULE` n < SUC k <=> n < k \/ n = k `;
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[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[]]);;
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 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[]]);;
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 `f_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[f_of_hyp];
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 ================ *)
(* ===================================== *)
let rho_fan = new_specification ["rho_fan"]
(MATCH_MP
(MESON[]`(! a b c d e. P a b c d e) ==> ? e. ! a b c d. P a b c d e `)
(GEN_ALL WRGCVDR));;
rho_fan;;
(* ================================= *)
(* PJRIMCV *)
(* ================================= *)
(* ============================= *)
(* 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[
f_of_hyp];
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 `
n_of_hyp (
vec 0,(V:real^3 -> bool),E) =
node_map H`;
ONCE_REWRITE_TAC[
EQ_SYM_EQ];
SIMP_TAC[];
STRIP_TAC;
REWRITE_TAC[
n_of_hyp];
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;;