3 Proof of the Jordan curve theorem
4 Format: HOL-LIGHT (OCaml version 2003)
5 File started April 20, 2004
6 Completed January 19, 2005
7 Author: Thomas C. Hales
11 "The Jordan-Schoenflies theorem and the classification of
13 American Math Monthly 99 (1992) 116 - 130.
15 There is one major difference from Thomassen's proof.
16 He uses general polygonal jordan curves in the "easy" case of the
17 Jordan curve theorem. This file restricts the "easy" case
18 even further to jordan curves that are made of horizontal
19 and vertical segments with integer length.
21 Thomassen shows finite planar graphs admit polygonal
22 embeddings. This file shows that finite planar graphs such
23 that every vertex has degree at most 4 admit
24 embeddings with edges that are piecewise horizontal and
25 vertical segments of integer length.
29 1. I'm still a novice and haven't settled on a style. The
30 entire proof is a clumsy experiment.
31 2. The lemmas have been ordered by my stream of consciousness.
32 The file is long, the dependencies are nontrivial, and reordering
33 is best accomplished by an automated tool.
38 let jordan_def = local_definition "jordan";;
39 mk_local_interface "jordan";;
42 let basic_rewrite_bak = basic_rewrites();;
43 let basic_net_bak = basic_net();;
44 let PARTIAL_REWRITE_CONV thl =
45 GENERAL_REWRITE_CONV true TOP_DEPTH_CONV (basic_net_bak) thl;;
46 let PARTIAL_REWRITE_TAC thl = CONV_TAC(PARTIAL_REWRITE_CONV thl);;
48 let reset() = (set_basic_rewrites basic_rewrite_bak);;
63 (* EMPTY_EXISTS; *) (* leave EMPTY EXISTS out next time *)
68 (* SUBSET_EMPTY; *) (* leave out *)
78 let DISCH_THEN_REWRITE = (DISCH_THEN (fun t -> REWRITE_TAC[t]));;
79 let ISUBSET = INR SUBSET;;
81 (* ------------------------------------------------------------------ *)
82 (* Logic, Sets, Metric Space Material *)
83 (* ------------------------------------------------------------------ *)
89 let PAIR_LEMMAv2 = prove_by_refinement(
90 `!x (i:A) (j:B). (x = (i,j)) <=> ((FST x = i) /\ (SND x = j))` ,
93 MESON_TAC[FST;SND;PAIR];
97 let PAIR_SPLIT = prove_by_refinement(
98 `!x (y:A#B). (x = y) <=> ((FST x = FST y) /\ (SND x = SND y))` ,
101 MESON_TAC[FST;SND;PAIR];
105 let single_inter = prove_by_refinement(
106 `!(a:A) U. ( ~({a} INTER U = EMPTY) <=> U a)`,
110 REWRITE_TAC[INSERT;INTER;EMPTY_EXISTS ];
115 let inters_inter = prove_by_refinement(
116 `!(X:A->bool) Y. (X INTER Y) = (INTERS {X,Y})`,
120 TYPE_THEN `{X,Y} Y` SUBGOAL_TAC;
121 REWRITE_TAC[INSERT ];
123 USE 0 (MATCH_MP delete_inters);
124 ASM_REWRITE_TAC[DELETE_INSERT; ];
126 ASM_REWRITE_TAC[INTER;];
131 let unions_delete_choice = prove_by_refinement(
132 `!(A:(A->bool)->bool). ~(A =EMPTY) ==>
133 (UNIONS A = (UNIONS (A DELETE CHOICE A)) UNION (CHOICE A))`,
138 REWRITE_TAC[UNIONS;UNION;DELETE ];
139 IMATCH_MP_TAC EQ_EXT;
142 TYPE_THEN `A (CHOICE A)` SUBGOAL_TAC;
143 IMATCH_MP_TAC (INR CHOICE_DEF );
149 let image_delete_choice = prove_by_refinement(
150 `!(A:(A->bool)) (f:A->B). ~(A= EMPTY) ==>
152 ((IMAGE f (A DELETE CHOICE A)) UNION {(f (CHOICE A))}))`,
157 REWRITE_TAC[IMAGE;UNION;DELETE];
158 IMATCH_MP_TAC EQ_EXT;
160 REWRITE_TAC[INSERT ];
161 TYPE_THEN `A (CHOICE A)` SUBGOAL_TAC;
162 IMATCH_MP_TAC (INR CHOICE_DEF );
168 let UNIONS_UNION = prove_by_refinement(
169 `!(A:(A->bool)->bool) B.
170 UNIONS (A UNION B) = (UNIONS A) UNION (UNIONS B)`,
174 REWRITE_TAC[UNIONS;UNION];
175 IMATCH_MP_TAC EQ_EXT;
184 let half_pos = prove_by_refinement(
185 `!x. (&.0 < x) ==> (&.0 < x/(&.2)) /\ (x/(&.2)) < x`,
188 MESON_TAC[REAL_LT_HALF2;REAL_LT_HALF1];
193 let convex_inter = prove_by_refinement(
194 `!S T. (convex S) /\ (convex T) ==> (convex (S INTER T))`,
198 REWRITE_TAC[convex;mk_segment;INTER;SUBSET_INTER ];
201 TYPEL_THEN [`x`;`y`] (USE 0 o ISPECL);
203 TYPEL_THEN [`x`;`y`] (USE 1 o ISPECL);
209 let closed_inter2 = prove_by_refinement(
210 `!U (A:A->bool) B. (topology_ U) /\ (closed_ U A) /\ (closed_ U B) ==>
211 (closed_ U (A INTER B))`,
215 REWRITE_TAC[inters_inter];
216 IMATCH_MP_TAC closed_inter ;
217 ASM_REWRITE_TAC[INR INSERT;EMPTY_EXISTS ];
222 let closure_univ = prove_by_refinement(
223 `!U (X:A->bool). ~(X SUBSET UNIONS U) ==> (closure U X = UNIV)`,
228 REWRITE_TAC[closure;closed];
229 TYPE_THEN `{B | (B SUBSET UNIONS U /\ open_ U (UNIONS U DIFF B)) /\ X SUBSET B} = EMPTY ` SUBGOAL_TAC;
231 USE 1 (REWRITE_RULE[EMPTY_EXISTS ]);
233 ASM_MESON_TAC[SUBSET_TRANS];
239 let closure_inter = prove_by_refinement(
242 ==> ((closure U (X INTER Y) SUBSET
243 (closure U X) INTER closure U Y))`,
248 TYPE_THEN `X SUBSET UNIONS U` ASM_CASES_TAC THEN (TYPE_THEN `Y SUBSET UNIONS U` ASM_CASES_TAC) THEN TRY(IMP_RES_THEN (fun t -> REWRITE_TAC[t]) closure_univ) THEN ( IMATCH_MP_TAC closure_subset );
251 IMATCH_MP_TAC closed_inter2;
252 ASM_SIMP_TAC[closure_closed ];
253 REWRITE_TAC[INTER;ISUBSET ];
254 ASM_MESON_TAC[subset_closure;ISUBSET];
255 ASM_MESON_TAC[closure_closed;INTER_SUBSET; SUBSET_TRANS ;subset_closure ];
256 ASM_MESON_TAC[closure_closed;INTER_SUBSET; SUBSET_TRANS ;subset_closure ];
261 let closure_open_ball = prove_by_refinement(
263 ((metric_space(X,d)) /\ (Z SUBSET X)) ==>
264 (({a | !r. (&.0 < r) ==> (?z. (Z z /\ open_ball(X,d) a r z))}
265 = closure (top_of_metric(X,d)) Z))`,
269 TYPE_THEN `topology_ (top_of_metric(X,d)) /\ (Z SUBSET (UNIONS (top_of_metric (X,d))))` SUBGOAL_TAC;
270 ASM_SIMP_TAC[top_of_metric_top;GSYM top_of_metric_unions];
272 USE 2 (MATCH_MP closure_open);
273 TYPE_THEN `{a | !r. (&.0 < r) ==> (?z. (Z z /\ open_ball(X,d) a r z))}` (USE 2 o SPEC);
275 CONJ_TAC; (* 1st prong *)
276 REWRITE_TAC[ISUBSET;];
280 TYPE_THEN `x` EXISTS_TAC;
281 ASM_MESON_TAC[SUBSET;IN;INR open_ball_nonempty];
283 REWRITE_TAC[closed;open_DEF ];
284 ASM_SIMP_TAC[GSYM top_of_metric_unions];
286 REWRITE_TAC[SUBSET;IN;IN_ELIM_THM';open_ball ;];
288 TYPE_THEN `&.1` (USE 3 o SPEC);
291 DISCH_THEN (CHOOSE_THEN MP_TAC);
293 ASM_SIMP_TAC[top_of_metric_nbd];
294 REWRITE_TAC[IN;DIFF; ISUBSET ];
300 USE 4 (REWRITE_RULE[NOT_IMP]);
301 TYPE_THEN `r` EXISTS_TAC;
303 ASM_REWRITE_TAC[NOT_IMP];
308 REWRITE_TAC[open_ball; ];
313 USE 0 (MATCH_MP (INR open_ball_center));
315 TYPE_THEN `r'` EXISTS_TAC;
318 MESON_TAC[SUBSET;IN];
321 ONCE_REWRITE_TAC[TAUT (`a /\ b ==> e <=> (a /\ ~e ==> ~b)`)];
322 REWRITE_TAC[open_DEF;EMPTY_EXISTS ];
325 USE 4 (REWRITE_RULE[INTER ]);
328 ASM_SIMP_TAC[top_of_metric_nbd;];
336 TYPE_THEN `z` EXISTS_TAC;
338 ASM_MESON_TAC[ISUBSET];
342 let closed_union = prove_by_refinement(
343 `!U (A:A->bool) B. (topology_ U) /\ (closed_ U A) /\ (closed_ U B) ==>
344 (closed_ U (A UNION B))`,
347 REWRITE_TAC[closed;open_DEF;union_subset ];
350 TYPE_THEN `UNIONS U DIFF (A UNION B) = (UNIONS U DIFF A) INTER (UNIONS U DIFF B)` SUBGOAL_TAC;
351 REWRITE_TAC[DIFF;UNION;IN;INTER;IN_ELIM_THM'];
352 IMATCH_MP_TAC EQ_EXT;
353 GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM'];
354 ASM_MESON_TAC[SUBSET;IN];
355 DISCH_THEN (fun t->REWRITE_TAC[t]);
356 ASM_MESON_TAC[top_inter];
361 let euclid_scale0 = prove_by_refinement(
362 `!x. (&.0 *# x) = (euclid0)`,
365 REWRITE_TAC[euclid_scale;euclid0];
370 let euclid_minus0 = prove_by_refinement(
371 `!x. (x - euclid0) = x`,
374 REWRITE_TAC[euclid0;euclid_minus];
376 (*** Changed by JRH since MESON no longer automatically applies extensionality
379 REWRITE_TAC[FUN_EQ_THM]
383 let norm_scale2 = prove_by_refinement(
384 `!t x. (euclidean x) ==> (norm (t *# x) = abs(t) * norm x)`,
388 USE 0 (MATCH_MP norm_scale);
389 TYPEL_THEN [`t`;`&.0`] (USE 0 o ISPECL);
390 USE 0 (REWRITE_RULE[euclid_scale0;d_euclid;euclid_minus0]);
397 (* ------------------------------------------------------------------ *)
399 (* ------------------------------------------------------------------ *)
401 let closed_half_space = jordan_def `closed_half_space n v b =
402 {z | (euclid n z) /\ (dot v z <=. b) }`;;
404 let open_half_space = jordan_def `open_half_space n v b =
405 {z | (euclid n z) /\ (dot v z <. b) }`;;
407 let hyperplane = jordan_def `hyperplane n v b =
408 {z | (euclid n z) /\ (dot v z = b) }`;;
410 let closed_half_space_euclid = prove_by_refinement(
411 `!n v b. (closed_half_space n v b SUBSET euclid n)`,
414 REWRITE_TAC[closed_half_space;SUBSET;IN;IN_ELIM_THM' ];
419 let open_half_space_euclid = prove_by_refinement(
420 `!n v b. (open_half_space n v b SUBSET euclid n)`,
423 REWRITE_TAC[open_half_space;SUBSET;IN;IN_ELIM_THM' ];
428 let hyperplane_euclid = prove_by_refinement(
429 `!n v b. (hyperplane n v b SUBSET euclid n)`,
432 REWRITE_TAC[hyperplane;SUBSET;IN;IN_ELIM_THM' ];
437 let closed_half_space_scale = prove_by_refinement(
438 `!n v b r. ( &.0 < r) /\ (euclid n v) ==>
439 (closed_half_space n (r *# v) (r * b) = closed_half_space n v b)`,
443 REWRITE_TAC[closed_half_space];
444 IMATCH_MP_TAC EQ_EXT ;
445 GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM'];
446 IMATCH_MP_TAC (TAUT `(C ==> (a <=> b)) ==> ((C /\ a) <=> (C /\ b))`);
449 USE 1 (MATCH_MP dot_scale);
451 ASM_SIMP_TAC[dot_scale];
452 IMATCH_MP_TAC REAL_LE_LMUL_EQ;
457 let open_half_space_scale = prove_by_refinement(
458 `!n v b r. ( &.0 < r) /\ (euclid n v) ==>
459 (open_half_space n (r *# v) (r * b) = open_half_space n v b)`,
463 REWRITE_TAC[open_half_space];
464 IMATCH_MP_TAC EQ_EXT ;
465 GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM'];
466 IMATCH_MP_TAC (TAUT `(C ==> (a <=> b)) ==> ((C /\ a) <=> (C /\ b))`);
469 USE 1 (MATCH_MP dot_scale);
471 ASM_SIMP_TAC[dot_scale];
472 IMATCH_MP_TAC REAL_LT_LMUL_EQ;
477 let hyperplane_scale = prove_by_refinement(
478 `!n v b r. ~( r = &.0) /\ (euclid n v) ==>
479 (hyperplane n (r *# v) (r * b)= hyperplane n v b)`,
483 REWRITE_TAC[hyperplane];
484 IMATCH_MP_TAC EQ_EXT ;
485 GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM'];
486 IMATCH_MP_TAC (TAUT `(C ==> (a <=> b)) ==> ((C /\ a) <=> (C /\ b))`);
489 USE 1 (MATCH_MP dot_scale);
490 ASM_REWRITE_TAC[REAL_EQ_MUL_LCANCEL ];
494 let open_half_space_diff = prove_by_refinement(
495 `!n v b. (euclid n v) ==>
496 ((euclid n) DIFF (open_half_space n v b) =
497 (closed_half_space n (-- v) (--. b)))`,
501 REWRITE_TAC[open_half_space;closed_half_space;DIFF ];
502 REWRITE_TAC[IN; IN_ELIM_THM'];
503 IMATCH_MP_TAC EQ_EXT;
504 REWRITE_TAC[IN_ELIM_THM;dot_neg ];
506 IMATCH_MP_TAC (TAUT `(C ==> (a <=> b)) ==> ((C /\ a) <=> (C /\ b))`);
513 let closed_half_space_diff = prove_by_refinement(
514 `!n v b. (euclid n v) ==>
515 ((euclid n) DIFF (closed_half_space n v b) =
516 (open_half_space n (-- v) (--. b)))`,
520 REWRITE_TAC[open_half_space;closed_half_space;DIFF ];
521 REWRITE_TAC[IN; IN_ELIM_THM'];
522 IMATCH_MP_TAC EQ_EXT;
523 REWRITE_TAC[IN_ELIM_THM;dot_neg ];
525 IMATCH_MP_TAC (TAUT `(C ==> (a <=> b)) ==> ((C /\ a) <=> (C /\ b))`);
532 let closed_half_space_inter = prove_by_refinement(
533 `!n v b. (euclid n v) ==>
534 (closed_half_space n v b INTER closed_half_space n (-- v) (--b) =
539 REWRITE_TAC[closed_half_space;INTER;IN;hyperplane;IN_ELIM_THM' ];
540 IMATCH_MP_TAC EQ_EXT;
542 REWRITE_TAC[IN_ELIM_THM'];
543 REWRITE_TAC[GSYM CONJ_ASSOC ];
544 IMATCH_MP_TAC (TAUT `(C ==> (a <=> b)) ==> ((C /\ a) <=> (C /\ b))`);
546 ASM_REWRITE_TAC[dot_neg ];
551 let open_half_space_convex = prove_by_refinement(
552 `!n v b. (euclid n v) ==> (convex (open_half_space n v b))`,
556 REWRITE_TAC[convex;open_half_space;mk_segment;IN_ELIM_THM';SUBSET;IN ];
564 ASM_SIMP_TAC[euclid_add_closure;euclid_scale_closure;];
565 TYPE_THEN `dot v (euclid_plus (a *# x) ((&1 - a) *# y)) = a * (dot v x) + (&1 - a)* (dot v y)` SUBGOAL_TAC;
566 ASM_MESON_TAC[euclid_add_closure;euclid_scale_closure;dot_linear2;dot_scale2 ];
567 DISCH_THEN (fun t -> REWRITE_TAC[t]);
568 ASM_CASES_TAC `&.0 = a`;
572 GEN_REWRITE_TAC (RAND_CONV)[REAL_ARITH `b = a * b + ((&.1)* b - a* b)`];
573 IMATCH_MP_TAC REAL_LTE_ADD2;
575 MP_TAC (REAL_ARITH `~(&.0 = a) /\ (&.0 <= a) ==> (&.0 < a)`);
577 ASM_MESON_TAC[REAL_LT_LMUL_EQ];
578 REWRITE_TAC[GSYM REAL_SUB_RDISTRIB];
579 IMATCH_MP_TAC REAL_LE_LMUL;
586 let closed_half_space_convex = prove_by_refinement(
587 `!n v b. (euclid n v) ==> (convex (closed_half_space n v b))`,
591 REWRITE_TAC[convex;closed_half_space;mk_segment;IN_ELIM_THM';SUBSET;IN];
599 ASM_SIMP_TAC[euclid_add_closure;euclid_scale_closure;];
600 TYPE_THEN `dot v (euclid_plus (a *# x) ((&1 - a) *# y)) = a * (dot v x) + (&1 - a)* (dot v y)` SUBGOAL_TAC;
601 ASM_MESON_TAC[euclid_add_closure;euclid_scale_closure;dot_linear2;dot_scale2 ];
602 DISCH_THEN (fun t -> REWRITE_TAC[t]);
603 GEN_REWRITE_TAC (RAND_CONV)[REAL_ARITH `b = a * b + ((&.1)* b - a* b)`];
604 IMATCH_MP_TAC REAL_LE_ADD2;
605 REWRITE_TAC[GSYM REAL_SUB_RDISTRIB];
606 USE 6 (MATCH_MP (REAL_ARITH `(a <= &.1) ==> (&.0 <= (&1-a))`));
607 CONJ_TAC THEN (IMATCH_MP_TAC REAL_LE_LMUL) THEN ASM_REWRITE_TAC[];
611 let hyperplane_convex = prove_by_refinement(
612 `!n v b. (euclid n v) ==> convex(hyperplane n v b)`,
617 ASM_SIMP_TAC[GSYM closed_half_space_inter];
618 IMATCH_MP_TAC convex_inter;
619 ASM_MESON_TAC[closed_half_space_convex;neg_dim ];
624 let open_half_space_open = prove_by_refinement(
625 `!n v b. (euclid n v) ==>
626 (top_of_metric(euclid n,d_euclid)) (open_half_space n v b)`,
631 ASM_SIMP_TAC[top_of_metric_nbd;metric_euclid;SUBSET;IN;IN_ELIM_THM' ];
632 REWRITE_TAC[open_half_space;open_ball;IN_ELIM_THM' ];
636 ASM_CASES_TAC `v = euclid0`;
638 ASM_REWRITE_TAC[dot_lzero];
640 TYPE_THEN `(b - (dot v a))/(norm v)` EXISTS_TAC;
641 TYPE_THEN `&.0 < (norm v)` SUBGOAL_TAC;
642 IMATCH_MP_TAC (REAL_ARITH `&0 <= x /\ (~(x = &.0)) ==> (&.0 < x)`);
643 ASM_MESON_TAC[norm;norm_nonneg;dot_nonneg;SQRT_EQ_0;dot_zero];
646 ASM_SIMP_TAC[REAL_LT_RDIV_0];
652 TYPE_THEN `(x:num->real) = a + (x - a)` SUBGOAL_TAC;
653 REWRITE_TAC[euclid_plus;euclid_minus];
654 IMATCH_MP_TAC EQ_EXT;
655 GEN_TAC THEN BETA_TAC;
657 DISCH_THEN (fun t -> ONCE_REWRITE_TAC[t]);
658 TYPE_THEN `dot v (a + (x - a)) = (dot v a) + (dot v (x-a))` SUBGOAL_TAC;
659 IMATCH_MP_TAC dot_linear2;
660 TYPE_THEN `n` EXISTS_TAC;
661 ASM_SIMP_TAC[euclid_sub_closure];
662 DISCH_THEN (fun t -> REWRITE_TAC[t]);
663 IMATCH_MP_TAC (REAL_ARITH `(?d. (b<=d) /\ d < C - a) ==> a +b < C`);
664 TYPE_THEN `(norm v)*. (d_euclid a x)` EXISTS_TAC;
666 ASSUME_TAC metric_euclid;
667 TYPE_THEN `n` (USE 9 o SPEC);
671 USE 6 (MATCH_MP metric_space_symm);
673 REWRITE_TAC[d_euclid];
674 IMATCH_MP_TAC (REAL_ARITH `||. u <=. C ==> (u <=. C)`);
675 IMATCH_MP_TAC cauchy_schwartz;
676 ASM_MESON_TAC[euclidean;euclid_sub_closure];
678 ASM_SIMP_TAC[REAL_LT_RDIV_EQ];
684 let closed_half_space_closed = prove_by_refinement(
685 `!n v b. (euclid n v) ==>
686 closed_ (top_of_metric(euclid n,d_euclid))
687 (closed_half_space n v b)`,
690 REWRITE_TAC[closed;open_DEF ];
692 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid;closed_half_space_diff;open_half_space_open;euclid_neg_closure ];
693 REWRITE_TAC[closed_half_space;SUBSET;IN;IN_ELIM_THM' ];
698 let hyperplane_closed = prove_by_refinement(
699 `!n v b. (euclid n v) ==>
700 closed_ (top_of_metric(euclid n,d_euclid))
705 ASM_SIMP_TAC[GSYM closed_half_space_inter];
706 IMATCH_MP_TAC closed_inter2;
707 ASM_MESON_TAC[euclid_neg_closure;top_of_metric_top ;metric_euclid ;closed_half_space_closed;];
711 let closure_half_space = prove_by_refinement(
712 `!n v b. (euclid n v) /\ (~(v = euclid0)) ==>
713 ((closure (top_of_metric(euclid n,d_euclid))
714 (open_half_space n v b)) = (closed_half_space n v b))`,
719 IMATCH_MP_TAC SUBSET_ANTISYM;
721 IMATCH_MP_TAC closure_subset;
722 ASM_SIMP_TAC [top_of_metric_top;metric_euclid];
723 ASM_SIMP_TAC[GSYM closure_open_ball;metric_euclid;closed_half_space_closed];
724 REWRITE_TAC[SUBSET;IN;closed_half_space;open_half_space;IN_ELIM_THM' ];
725 MESON_TAC[REAL_ARITH `a < b ==> a <=. b`];
726 ASM_SIMP_TAC[GSYM closure_open_ball;metric_euclid;open_half_space_euclid];
727 REWRITE_TAC[open_half_space;closed_half_space;SUBSET;IN;IN_ELIM_THM'];
730 TYPE_THEN `t = ((r/(&.2))/(norm v ))` ABBREV_TAC;
731 TYPE_THEN `u = x - (t)*# v` ABBREV_TAC;
732 TYPE_THEN `u` EXISTS_TAC;
733 TYPE_THEN `&.0 < (dot v v)` SUBGOAL_TAC;
734 IMATCH_MP_TAC (REAL_ARITH `~(x = &.0) /\ (&.0 <=. x) ==> (&.0 < x)`);
735 REWRITE_TAC[dot_nonneg];
736 ASM_MESON_TAC[euclidean;dot_zero_euclidean ];
738 TYPE_THEN `&.0 < t` SUBGOAL_TAC;
740 IMATCH_MP_TAC REAL_LT_DIV;
741 ASM_REWRITE_TAC[REAL_LT_HALF1];
743 IMATCH_MP_TAC SQRT_POS_LT;
748 ASM_MESON_TAC[euclid_sub_closure ;euclid_scale_closure ];
749 TYPE_THEN `dot v u = (dot v x - t* (dot v v))` SUBGOAL_TAC;
751 ASM_MESON_TAC[dot_minus_linear2;dot_scale2;euclid_sub_closure;euclid_scale_closure];
752 DISCH_THEN (fun t->REWRITE_TAC[t]);
753 IMATCH_MP_TAC (REAL_ARITH `(a <= b) /\ (&.0 < C) ==> (a - C < b)`);
755 IMATCH_MP_TAC REAL_LT_MUL;
758 ASM_REWRITE_TAC[open_ball;IN_ELIM_THM' ];
760 REWRITE_TAC[d_euclid];
761 TYPE_THEN `euclid_minus x (euclid_minus x (t *# v)) = ( t) *# v` SUBGOAL_TAC;
762 REWRITE_TAC[euclid_minus;euclid_scale];
763 IMATCH_MP_TAC EQ_EXT;
764 GEN_TAC THEN BETA_TAC;
766 DISCH_THEN (fun t-> REWRITE_TAC[t]);
767 TYPE_THEN `norm (t *# v) = t * norm v` SUBGOAL_TAC;
768 ASM_MESON_TAC[euclidean;norm_scale2;ABS_REFL;REAL_ARITH `&.0 < t ==> &.0 <= t`];
769 DISCH_THEN (fun t -> REWRITE_TAC[t]);
771 TYPE_THEN `((r / &2) / norm v) * norm v = r/(&.2)` SUBGOAL_TAC;
772 IMATCH_MP_TAC REAL_DIV_RMUL;
774 ASM_MESON_TAC[SQRT_POS_LT;REAL_ARITH `&.0 < x ==> ~(x = &.0)`];
775 DISCH_THEN (fun t-> REWRITE_TAC[t]);
776 ASM_MESON_TAC[half_pos];
782 let subset_of_closure = prove_by_refinement(
783 `!(A:A->bool) B U. (topology_ U) /\ (A SUBSET B) ==>
784 (closure U A SUBSET closure U B)`,
788 TYPE_THEN `(A SUBSET (UNIONS U))` ASM_CASES_TAC;
789 TYPE_THEN `(B SUBSET (UNIONS U))` ASM_CASES_TAC;
790 IMATCH_MP_TAC closure_subset;
792 WITH 0 (MATCH_MP subset_closure);
793 USE 4 (ISPEC `B:A->bool`);
795 USE 1 (MATCH_MP SUBSET_TRANS);
797 ASM_MESON_TAC [closure_closed;];
798 USE 3 (MATCH_MP closure_univ);
800 TYPE_THEN `~(B SUBSET UNIONS U)` SUBGOAL_TAC;
803 REWRITE_TAC[ISUBSET];
806 USE 2 (MATCH_MP closure_univ);
807 USE 3 (MATCH_MP closure_univ);
812 let closure_union = prove_by_refinement(
813 `!(A:A->bool) B U. (topology_ U) ==>
814 (closure U (A UNION B) = (closure U A) UNION (closure U B))`,
818 TYPE_THEN `A SUBSET UNIONS U` ASM_CASES_TAC THEN (TYPE_THEN `B SUBSET UNIONS U` ASM_CASES_TAC ) THEN TRY(IMP_RES_THEN (fun t -> REWRITE_TAC[t;UNION_UNIV;SUBSET_UNIV;INTER_UNIV]) closure_univ) THEN TRY (IMATCH_MP_TAC closure_univ) THEN TRY (UNDISCH_FIND_TAC `(~)`);
819 IMATCH_MP_TAC SUBSET_ANTISYM;
821 IMATCH_MP_TAC closure_subset;
824 ASM_MESON_TAC[closed_union; closure_closed];
825 REWRITE_TAC[union_subset];
826 TYPE_THEN `(A SUBSET closure U A) /\ (B SUBSET closure U B)` SUBGOAL_TAC;
827 ASM_SIMP_TAC[subset_closure];
828 REWRITE_TAC[UNION;ISUBSET ];
830 REWRITE_TAC[union_subset];
831 CONJ_TAC THEN IMATCH_MP_TAC subset_of_closure THEN ASM_REWRITE_TAC[ISUBSET;UNION ] THEN (MESON_TAC []);
832 REWRITE_TAC [UNION;SUBSET; ];
834 REWRITE_TAC[UNION;SUBSET];
836 REWRITE_TAC[UNION;SUBSET];
841 let closure_empty = prove_by_refinement(
842 `!U. (topology_ U) ==> (closure U (EMPTY:A->bool) = EMPTY)`,
846 IMATCH_MP_TAC SUBSET_ANTISYM;
847 ASM_MESON_TAC[SUBSET_EMPTY;closure_subset;empty_closed];
851 let closure_unions = prove_by_refinement(
852 `!(A:(A->bool)->bool) U. (topology_ U) /\ (FINITE A) ==>
853 (closure U (UNIONS A) = UNIONS (IMAGE (closure U) A))`,
857 TYPE_THEN `n = CARD A` ABBREV_TAC;
859 TYPE_THEN `A` (fun t-> SPEC_TAC (t,t));
860 TYPE_THEN `n` (fun t-> SPEC_TAC (t,t));
863 TYPE_THEN `A HAS_SIZE 0` SUBGOAL_TAC;
864 ASM_REWRITE_TAC[HAS_SIZE];
865 ASM_REWRITE_TAC[HAS_SIZE_0];
867 ASM_SIMP_TAC [closure_empty;IMAGE_CLAUSES];
869 TYPE_THEN `~(A HAS_SIZE 0)` SUBGOAL_TAC;
870 ASM_REWRITE_TAC[HAS_SIZE];
872 TYPE_THEN `A` (MP_TAC o ((C ISPEC) CARD_DELETE_CHOICE));
873 REWRITE_TAC[HAS_SIZE_0];
876 USE 5 (CONV_RULE REDUCE_CONV );
877 TYPE_THEN `(A DELETE CHOICE A)` (USE 0 o ISPEC);
878 USE 0 (REWRITE_RULE[FINITE_DELETE]);
880 TYPE_THEN `A (CHOICE A)` SUBGOAL_TAC;
881 IMATCH_MP_TAC (INR CHOICE_DEF);
884 TYPE_THEN `UNIONS A = (UNIONS (A DELETE CHOICE A)) UNION (CHOICE A)` SUBGOAL_TAC;
885 IMATCH_MP_TAC unions_delete_choice;
888 TYPE_THEN `(IMAGE (closure U) A) = (IMAGE (closure U) (A DELETE CHOICE A) UNION {(closure U (CHOICE A))})` SUBGOAL_TAC;
889 IMATCH_MP_TAC image_delete_choice ;
892 ASM_SIMP_TAC[closure_union];
893 REWRITE_TAC[UNIONS_UNION];
897 let metric_space_zero2 = prove_by_refinement(
898 `!X d (x:A) y. (metric_space(X,d) /\ (X x) /\ (X y)) ==>
899 ((d x y = &.0) <=> (x = y))`,
903 USE 0 (REWRITE_RULE[metric_space]);
904 TYPEL_THEN [`x`;`y`;`x`] (USE 0 o ISPECL);
909 let d_euclid_zero = prove_by_refinement(
910 `!n x y. (euclid n x) /\ (euclid n y) ==>
911 ((d_euclid x y = &.0) <=> (x = y))`,
915 TYPEL_THEN [`euclid n`;`d_euclid`;`x`;`y`] (ASSUME_TAC o (C ISPECL) metric_space_zero2);
916 ASM_MESON_TAC[metric_euclid];
920 let d_euclid_pos2 = prove_by_refinement(
921 `!x y n. ~(x = y) /\ euclid n x /\ euclid n y ==> &0 <. d_euclid x y`,
925 IMATCH_MP_TAC (REAL_ARITH `&.0 <= x /\ ~(x = &.0) ==> (&.0 < x)`);
926 ASM_MESON_TAC[d_euclid_pos;d_euclid_zero];
930 let euclid_segment = prove_by_refinement(
931 `!n x y. (euclid n x) /\
932 (!t. (&.0 <. t) /\ (t <=. &.1) ==>
933 (euclid n (t *# x + (&.1 - t)*# y)))
939 TYPE_THEN `t = &.1/(&.2)` ABBREV_TAC;
940 TYPE_THEN `y = ((&.2) *# ((t *# x) + (&.1 - t)*# y)) - x` SUBGOAL_TAC;
941 REWRITE_TAC[euclid_minus;euclid_scale;euclid_plus];
942 IMATCH_MP_TAC EQ_EXT;
943 GEN_TAC THEN BETA_TAC ;
944 REWRITE_TAC[REAL_ADD_LDISTRIB];
945 REWRITE_TAC[REAL_MUL_ASSOC;REAL_SUB_LDISTRIB ];
947 SIMP_TAC[REAL_DIV_LMUL;REAL_ARITH `~(&.2 = &.0)`];
949 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
950 TYPE_THEN `t` (USE 1 o SPEC);
951 TYPE_THEN `v = (euclid_plus (t *# x) ((&1 - t) *# y))` ABBREV_TAC;
953 TYPE_THEN `&0 < t /\ t <= &1` SUBGOAL_TAC;
956 IMATCH_MP_TAC REAL_LT_DIV;
958 IMATCH_MP_TAC REAL_LE_LDIV;
962 ASM_SIMP_TAC[euclid_sub_closure;euclid_scale_closure];
966 let euclid_xy = prove_by_refinement(
967 `!n x y. (!t . (&.0 < t) /\ (t < &.1) ==>
968 (euclid n (t *# x + (&.1-t)*# y))) ==> (euclid n x) /\ (euclid n y)`,
973 TYPE_THEN `u = (&.1/(&.3))*# x + (&.1 - (&.1/(&.3))) *# y` ABBREV_TAC;
974 TYPE_THEN `v = (&.2/(&.3))*# x + (&.1 - (&.2/(&.3))) *# y` ABBREV_TAC;
975 TYPE_THEN `euclid n u` SUBGOAL_TAC;
978 DISCH_THEN IMATCH_MP_TAC ;
979 CONV_TAC REAL_RAT_REDUCE_CONV;
981 TYPE_THEN `euclid n v` SUBGOAL_TAC;
984 DISCH_THEN IMATCH_MP_TAC ;
985 CONV_TAC REAL_RAT_REDUCE_CONV;
987 TYPE_THEN `x = (&.2)*# v - (&.1) *# u` SUBGOAL_TAC;
990 REWRITE_TAC[euclid_minus;euclid_plus;euclid_scale];
991 IMATCH_MP_TAC EQ_EXT;
994 TYPE_THEN `a = x x'` ABBREV_TAC ;
995 TYPE_THEN `b= y x'` ABBREV_TAC ;
998 ASM_SIMP_TAC[euclid_scale_closure;euclid_sub_closure];
999 TYPE_THEN `y = (&.2)*# u - (&.1) *# v` SUBGOAL_TAC;
1002 REWRITE_TAC[euclid_minus;euclid_plus;euclid_scale];
1003 IMATCH_MP_TAC EQ_EXT;
1006 TYPE_THEN `a = x x'` ABBREV_TAC ;
1007 TYPE_THEN `b= y x'` ABBREV_TAC ;
1010 ASM_SIMP_TAC[euclid_scale_closure;euclid_sub_closure];
1015 let closure_segment = prove_by_refinement(
1016 `!C n x y. (C SUBSET (euclid n)) /\
1017 (!t. (&.0 < t) /\ (t < &.1) ==> (C (t *# x + (&.1-t)*# y))) ==>
1018 (closure (top_of_metric(euclid n,d_euclid)) C y)`,
1023 TYPE_THEN `euclid n x /\ (euclid n y)` SUBGOAL_TAC;
1024 IMATCH_MP_TAC euclid_xy;
1025 ASM_MESON_TAC[ISUBSET];
1028 TYPE_THEN `x = y` ASM_CASES_TAC ;
1029 TYPE_THEN `C SUBSET (closure (top_of_metric (euclid n,d_euclid)) C)` SUBGOAL_TAC ;
1030 IMATCH_MP_TAC subset_closure;
1031 ASM_SIMP_TAC [top_of_metric_top;metric_euclid];
1032 REWRITE_TAC[ISUBSET];
1033 TYPE_THEN `C x` SUBGOAL_TAC;
1035 USE 1 (REWRITE_RULE[trivial_lin_combo]);
1036 TSPEC `&.1/(&.2)` 1;
1037 USE 1 (CONV_RULE (REAL_RAT_REDUCE_CONV));
1041 TYPE_THEN `&.0 < d_euclid x y` SUBGOAL_TAC;
1042 ASM_MESON_TAC[d_euclid_pos2];
1044 ASM_SIMP_TAC[GSYM closure_open_ball;metric_euclid];
1046 REWRITE_TAC[open_ball];
1048 TYPE_THEN `?t. (&.0 <. t) /\ (t <. &.1) /\ (t *. (d_euclid x y) <. r)` SUBGOAL_TAC;
1049 TYPE_THEN `(&.1/(&.2))*. d_euclid x y < r` ASM_CASES_TAC;
1050 TYPE_THEN `(&.1/(&.2))` EXISTS_TAC;
1051 CONV_TAC (REAL_RAT_REDUCE_CONV);
1053 TYPE_THEN `(r/(&.2))/(d_euclid x y)` EXISTS_TAC;
1054 ASM_SIMP_TAC[REAL_LT_DIV;REAL_LT_HALF1];
1056 ASM_SIMP_TAC[REAL_LT_LDIV_EQ];
1058 TYPE_THEN `s = d_euclid x y ` ABBREV_TAC;
1059 ineq_lt_tac `r/(&.2) + ( (&1/(&2))*s - r)*(&1/(&2)) + (s)*(&3/(&4)) = s`;
1060 ASM_SIMP_TAC[GSYM REAL_LT_RDIV_EQ;REAL_LT_RDIV;half_pos];
1063 TYPE_THEN `t` (USE 1 o SPEC);
1065 TYPE_THEN `z = (euclid_plus (t *# x) ((&1 - t) *# y))` ABBREV_TAC ;
1066 TYPE_THEN `z` EXISTS_TAC;
1070 ASM_SIMP_TAC[euclid_add_closure;euclid_scale_closure];
1072 TYPE_THEN `y = (t *# y) + ((&.1 - t)*# y)` SUBGOAL_TAC;
1073 ASM_MESON_TAC[trivial_lin_combo];
1074 DISCH_THEN (fun t-> ONCE_REWRITE_TAC [t]);
1076 TYPE_THEN `euclid n (t*# y) /\ (euclid n (t *# x)) /\ (euclid n ((&.1-t)*# y))` SUBGOAL_TAC;
1077 ASM_SIMP_TAC[euclid_add_closure;euclid_scale_closure];
1079 USE 10 (MATCH_MP metric_translate);
1082 TYPE_THEN `d_euclid (t *# y) (t *# x) = d_euclid (t *# x) (t *# y)` SUBGOAL_TAC;
1083 ASM_MESON_TAC [ISPEC `euclid n` metric_space_symm; euclid_scale_closure;metric_euclid];
1084 DISCH_THEN (fun t-> ONCE_REWRITE_TAC [t]);
1086 USE 2 (MATCH_MP norm_scale_vec);
1090 USE 7 (MATCH_MP (REAL_ARITH `&.0 < t ==> (&.0 <=. t)`));
1091 USE 7 (REWRITE_RULE[GSYM ABS_REFL]);
1099 (* ------------------------------------------------------------------ *)
1101 (* ------------------------------------------------------------------ *)
1104 let point = jordan_def `point z =
1105 (FST z) *# (dirac_delta 0) + (SND z) *# (dirac_delta 1)`;;
1107 let dest_pt = jordan_def `dest_pt p =
1110 let point_xy = prove_by_refinement(
1111 `!x y. point(x,y) = x *# (dirac_delta 0) + y *# (dirac_delta 1)`,
1114 REWRITE_TAC[point;];
1118 let coord01 = prove_by_refinement(
1119 `!p. (point p 0 = FST p) /\ (point p 1 = SND p)`,
1122 REWRITE_TAC[point;euclid_plus;euclid_scale ];
1123 REWRITE_TAC[dirac_delta;ARITH_RULE `~(1=0) /\ ~(0=1)`];
1128 let euclid_point = prove_by_refinement(
1129 `!p. euclid 2 (point p)`,
1132 REWRITE_TAC[point;euclid];
1133 REWRITE_TAC[point;euclid_plus;euclid_scale;dirac_delta ];
1135 USE 0 (MATCH_MP (ARITH_RULE `(2 <=| m) ==> (~(0=m) /\ (~(1=m)))`));
1141 let point_inj = prove_by_refinement(
1142 `!p q. (point p = point q) <=> (p = q)`,
1149 WITH 0 (fun t -> AP_THM t `0`);
1150 USE 0 (fun t-> AP_THM t `1`);
1153 REWRITE_TAC[coord01;];
1154 ASM_MESON_TAC[PAIR];
1160 let point_onto = prove_by_refinement(
1161 `!v. (euclid 2 v) ==> ?p. (v = point p)`,
1165 TYPE_THEN `(v 0 ,v 1)` EXISTS_TAC;
1166 IMATCH_MP_TAC EQ_EXT ;
1168 REWRITE_TAC[point;euclid_plus;euclid_scale;dirac_delta];
1169 MP_TAC (ARITH_RULE `(0 = x) \/ ( 1 = x) \/ (2 <= x)`);
1171 WITH 1 (MATCH_MP (ARITH_RULE `(0=x) ==> ~(1=x)`));
1175 WITH 1 (MATCH_MP (ARITH_RULE `(1=x) ==> ~(0=x)`));
1179 WITH 1 (MATCH_MP (ARITH_RULE `(2 <=| x) ==> (~(0=x)/\ ~(1=x))`));
1182 ASM_MESON_TAC[euclid];
1186 let dest_pt_point = prove_by_refinement(
1187 `!p. dest_pt(point p) = p`,
1190 REWRITE_TAC[dest_pt];
1193 ASM_MESON_TAC[point_inj];
1198 let point_dest_pt = prove_by_refinement(
1199 `!v. (euclid 2 v) <=> (point (dest_pt v) = v)`,
1204 REWRITE_TAC[dest_pt];
1208 ASM_MESON_TAC[point_onto];
1209 ASM_MESON_TAC[euclid_point];
1213 let Q_POINT = prove_by_refinement(
1214 `!Q z. (?u v. (point z = point (u,v)) /\ (Q z u v)) <=> (Q z (FST z) (SND z))`,
1218 REWRITE_TAC[point_inj];
1226 TYPE_THEN `FST z` EXISTS_TAC;
1227 TYPE_THEN `SND z` EXISTS_TAC;
1232 let pointI = jordan_def `pointI p =
1233 point(real_of_int (FST p),real_of_int (SND p))`;;
1235 let convex_pointI = prove_by_refinement(
1236 `!p. (convex {(pointI p)})`,
1240 REWRITE_TAC[convex;mk_segment;INSERT;IN_ELIM_THM';SUBSET; ];
1241 REWRITE_TAC[IN;EMPTY];
1243 ASM_REWRITE_TAC[trivial_lin_combo];
1251 let point_closure = prove_by_refinement(
1252 `!p q a b. (?r. (a *# (point p) + (b *# (point q)) = (point r)))`,
1256 TYPE_THEN `euclid 2 (a *# (point p) + (b *# (point q)))` SUBGOAL_TAC;
1257 IMATCH_MP_TAC euclid_add_closure;
1258 CONJ_TAC THEN (IMATCH_MP_TAC euclid_scale_closure) THEN REWRITE_TAC [euclid_point];
1259 MESON_TAC[point_onto];
1263 let point_scale = prove_by_refinement(
1264 `!a u v. a *# (point (u,v)) = point(a* u,a* v)`,
1267 REWRITE_TAC[point;euclid_scale;euclid_plus ];
1269 IMATCH_MP_TAC EQ_EXT;
1270 GEN_TAC THEN BETA_TAC;
1275 let point_add = prove_by_refinement(
1276 `!u v u' v'. (point(u,v))+(point(u',v')) = (point(u+u',v+v'))`,
1279 REWRITE_TAC[point;euclid_plus;euclid_scale];
1281 IMATCH_MP_TAC EQ_EXT;
1282 GEN_TAC THEN BETA_TAC;
1289 (* ------------------------------------------------------------------ *)
1290 (* the FLOOR function *)
1291 (* ------------------------------------------------------------------ *)
1294 let floor = jordan_def `floor x =
1295 @m. (real_of_int m <=. x /\ (x < (real_of_int (m + &:1))))`;;
1297 let int_suc = prove_by_refinement(
1298 `!m. (real_of_int (m + &:1) = real_of_int m + &.1)`,
1301 REWRITE_TAC[int_add_th;INT_NUM_REAL ];
1305 let floor_ineq = prove_by_refinement(
1306 `!x. (real_of_int (floor x) <=. x) /\ (x <. (real_of_int (floor x)) + &.1)`,
1312 REWRITE_TAC[int_suc];
1313 MP_TAC (SPEC `&.1` REAL_ARCH_LEAST);
1316 ASM_CASES_TAC `&.0 <= x`;
1322 USE 0 (REWRITE_RULE[INT_NUM_REAL;int_add_th;REAL_OF_NUM_ADD ]);
1326 IMP_REAL `~(&.0 <=. x) ==> (&.0 <=. (-- x))` 2;
1330 ASM_CASES_TAC `&.n = --x`;
1332 USE 0 (REWRITE_RULE[int_neg_th;int_add_th ;INT_NUM_REAL;REAL_OF_NUM_ADD]);
1334 USE 0 (REWRITE_RULE[ GSYM REAL_OF_NUM_ADD]);
1339 TSPEC `--: (&:(n+| 1))` 0;
1341 USE 0 (REWRITE_RULE[int_neg_th;int_add_th ;INT_NUM_REAL; GSYM REAL_OF_NUM_ADD;]);
1349 let int_arch = prove_by_refinement(
1350 `!m n. (n <=: m) /\ (m <: (n +: (&:1))) <=> (n = m)`,
1353 REWRITE_TAC[int_lt;int_le;int_eq ;int_add_th;int_of_num_th ];
1356 MP_TAC (SPEC `m:int` dest_int_rep);
1357 DISCH_THEN (CHOOSE_THEN MP_TAC);
1358 MP_TAC (SPEC `n:int` dest_int_rep);
1359 DISCH_THEN (CHOOSE_THEN MP_TAC);
1360 REPEAT (DISCH_THEN (REPEAT_TCL DISJ_CASES_THEN ASSUME_TAC)) THEN ((UNDISCH_FIND_TAC `(/\)`)) THEN ( ASM_REWRITE_TAC[int_add_th;int_of_num_th ]) THEN REDUCE_TAC THEN TRY ARITH_TAC;
1365 let floor_int = prove_by_refinement(
1366 `!m. (floor (real_of_int m) = m)`,
1370 TYPE_THEN `floor (real_of_int m) <=: m /\ (m <: (floor (real_of_int m)) + (&:1))` SUBGOAL_TAC;
1371 REWRITE_TAC[int_le;int_lt;int_add_th ;int_of_num_th;floor_ineq ];
1372 REWRITE_TAC[int_arch ];
1376 let int_lt_suc_le = prove_by_refinement(
1377 `!m n. m <: n + &:1 <=> m <=: n`,
1382 MP_TAC (SPEC `m:int` dest_int_rep);
1383 DISCH_THEN (CHOOSE_THEN MP_TAC);
1384 MP_TAC (SPEC `n:int` dest_int_rep);
1385 DISCH_THEN (CHOOSE_THEN MP_TAC);
1386 REPEAT (DISCH_THEN (REPEAT_TCL DISJ_CASES_THEN ASSUME_TAC)) THEN ((UNDISCH_FIND_TAC `(+:)`)) THEN ( ASM_REWRITE_TAC[int_add_th;int_of_num_th ]) THEN REDUCE_TAC THEN TRY ARITH_TAC;
1387 REWRITE_TAC[int_le;int_lt;int_add_th;int_of_num_th];
1392 let floor_le = prove_by_refinement(
1393 `!m x. (real_of_int m <=. x) <=> (m <=: (floor x))`,
1399 REWRITE_TAC[int_le];
1400 REWRITE_TAC[GSYM int_le ;GSYM int_lt_suc_le;];
1401 REWRITE_TAC[int_lt ;int_add_th;int_of_num_th;];
1402 ASM_MESON_TAC[floor_ineq; REAL_LET_TRANS];
1403 REWRITE_TAC[int_le];
1404 MP_TAC (SPEC `x:real` floor_ineq);
1409 let floor_lt = prove_by_refinement(
1410 `!m x. (x < real_of_int m + &.1) <=> (floor x <=: m)`,
1416 REWRITE_TAC[GSYM int_lt_suc_le ;];
1417 REWRITE_TAC[int_lt;int_add_th;int_of_num_th;];
1419 MP_TAC (SPEC `x:real` floor_ineq);
1421 REWRITE_TAC[int_le;];
1422 MP_TAC (SPEC `x:real` floor_ineq);
1427 let floor_mono = prove_by_refinement(
1428 `!x y. (x <=. y) ==> (floor x <=: floor y)`,
1431 REWRITE_TAC[GSYM floor_le];
1433 MP_TAC (SPEC `x:real` floor_ineq);
1438 let floor_level = prove_by_refinement(
1439 `!m x. ((&.0 <=. x) /\ (x <. &.1)) ==> (floor (real_of_int(m) + x) = m)`,
1443 SUBGOAL_TAC `!a b. (b <=: a /\ ~(b <: a)) ==> (a = b)`;
1444 REWRITE_TAC[int_le;int_lt;int_eq];
1446 DISCH_THEN IMATCH_MP_TAC ;
1448 REWRITE_TAC[GSYM floor_le];
1453 USE 3 (REWRITE_RULE[]);
1454 USE 3 (ONCE_REWRITE_RULE[GSYM INT_LT_RADD ]);
1455 USE 3 (GEN `z:int`);
1457 USE 3 (REWRITE_RULE [int_lt_suc_le ;]);
1458 MP_TAC (SPEC `real_of_int m + x` floor_ineq);
1461 REWRITE_TAC[int_add_th;int_le;int_of_num_th];
1467 let floor_range = prove_by_refinement(
1468 `!x m. (floor x = m) <=> (real_of_int m <=. x /\ x <. real_of_int m +. &.1)`,
1473 DISCH_THEN (fun t -> REWRITE_TAC[GSYM t;floor_ineq]);
1475 ASM_REWRITE_TAC[GSYM INT_LE_ANTISYM;GSYM floor_lt;GSYM floor_le;];
1480 (* ------------------------------------------------------------------ *)
1481 (* edges and squares *)
1482 (* ------------------------------------------------------------------ *)
1485 let h_edge = jordan_def `h_edge p =
1486 { Z | ?u v. (Z = point(u,v)) /\
1487 (real_of_int (FST p) <. u) /\ (u <. (real_of_int ((FST p)+: (&:1)))) /\
1488 (v = real_of_int (SND p)) }`;;
1490 let v_edge = jordan_def `v_edge p =
1491 { Z | ?u v. (Z = point(u,v)) /\
1492 (real_of_int (SND p) <. v) /\ (v <. (real_of_int ((SND p) +: (&:1)))) /\
1493 (u = real_of_int (FST p)) }`;;
1495 let squ = jordan_def `squ p =
1496 {Z | ?u v. (Z = point(u,v)) /\
1497 (real_of_int (FST p) <. u) /\ (u <. (real_of_int ((FST p) +: (&:1)))) /\
1498 (real_of_int (SND p) <. v) /\ (v <. (real_of_int ((SND p) +: (&:1)))) }`;;
1500 let row = jordan_def `row k = {Z | ?u . (Z = point(u,real_of_int k))}`;;
1502 let col = jordan_def `col k = {Z | ?v . (Z = point(real_of_int k ,v))}`;;
1505 let pointI_inj = prove_by_refinement(
1506 `!p q. (pointI p = pointI q) <=> (p = q) `,
1509 REWRITE_TAC[pointI;point_inj;PAIR_EQ;GSYM int_eq ];
1510 MESON_TAC[PAIR;PAIR_EQ];
1514 let h_edge_row = prove_by_refinement(
1515 `!p . h_edge p SUBSET row (SND p) `,
1518 REWRITE_TAC[SUBSET;IN;h_edge;row;IN_ELIM_THM';];
1522 TYPE_THEN `u` EXISTS_TAC;
1527 let h_edge_floor = prove_by_refinement(
1528 `!p. h_edge p SUBSET { z | floor (z 0) = FST p }`,
1531 REWRITE_TAC[SUBSET;IN;h_edge;IN_ELIM_THM';int_of_num_th;int_add_th;];
1535 ASM_REWRITE_TAC[coord01;floor_range];
1541 let row_disj = prove_by_refinement(
1542 `!a b. ~((row a) INTER (row b) = EMPTY) <=> (a = b)`,
1546 REWRITE_TAC[EMPTY_EXISTS;IN;INTER;row;IN_ELIM_THM' ];
1553 REWRITE_TAC[int_eq];
1556 USE 1 (REWRITE_RULE [point_inj;PAIR_EQ ]);
1558 DISCH_THEN (fun t-> REWRITE_TAC [t]);
1563 let h_edge_disj = prove_by_refinement(
1564 `!p q. ~(h_edge p INTER h_edge q = EMPTY) <=> (p = q)`,
1568 REWRITE_TAC[EMPTY_EXISTS;IN;INTER;IN_ELIM_THM'];
1572 ONCE_REWRITE_TAC [GSYM PAIR];
1573 REWRITE_TAC[PAIR_EQ];
1575 MP_TAC h_edge_floor;
1576 REWRITE_TAC[SUBSET;IN;IN_ELIM_THM'];
1580 REWRITE_TAC[SUBSET;INTER;IN;IN_ELIM_THM';EMPTY_EXISTS;];
1582 REWRITE_TAC[h_edge;IN_ELIM_THM' ];
1583 DISCH_THEN (fun t -> REWRITE_TAC[t;int_add_th ;int_of_num_th;]);
1586 TYPE_THEN `?x. (&.0 < x ) /\ (x < &.1)` SUBGOAL_TAC;
1587 TYPE_THEN `&.1/(&.2)` EXISTS_TAC;
1588 IMATCH_MP_TAC half_pos;
1590 DISCH_THEN CHOOSE_TAC;
1591 TYPE_THEN `real_of_int (FST q) + x` EXISTS_TAC;
1593 TYPE_THEN `real_of_int (SND q)` EXISTS_TAC ;
1594 TYPE_THEN `point (real_of_int (FST q) + x,real_of_int (SND q))` EXISTS_TAC;
1601 let h_edge_pointI = prove_by_refinement(
1602 `!p q. ~(h_edge p (pointI q))`,
1606 REWRITE_TAC[pointI;h_edge;IN_ELIM_THM' ];
1608 USE 0 (REWRITE_RULE[]);
1613 USE 0 (REWRITE_RULE[point_inj;PAIR_EQ ]);
1617 USE 2 (REWRITE_RULE[GSYM int_lt ;int_lt_suc_le ]);
1618 USE 2 (REWRITE_RULE[int_le]);
1625 let v_edge_col = prove_by_refinement(
1626 `!p . v_edge p SUBSET col (FST p) `,
1629 REWRITE_TAC[SUBSET;IN;v_edge;col;IN_ELIM_THM';];
1633 TYPE_THEN `v` EXISTS_TAC;
1638 let v_edge_floor = prove_by_refinement(
1639 `!p. v_edge p SUBSET { z | floor (z 1) = SND p }`,
1642 REWRITE_TAC[SUBSET;IN;v_edge;IN_ELIM_THM';int_of_num_th;int_add_th;];
1646 ASM_REWRITE_TAC[coord01;floor_range];
1652 let col_disj = prove_by_refinement(
1653 `!a b. ~((col a) INTER (col b) = EMPTY) <=> (a = b)`,
1657 REWRITE_TAC[EMPTY_EXISTS;IN;INTER;col;IN_ELIM_THM' ];
1664 REWRITE_TAC[int_eq];
1667 USE 1 (REWRITE_RULE [point_inj;PAIR_EQ ]);
1669 DISCH_THEN (fun t-> REWRITE_TAC [t]);
1674 let v_edge_disj = prove_by_refinement(
1675 `!p q. ~(v_edge p INTER v_edge q = EMPTY) <=> (p = q)`,
1679 REWRITE_TAC[EMPTY_EXISTS;IN;INTER;IN_ELIM_THM'];
1683 ONCE_REWRITE_TAC [GSYM PAIR];
1684 REWRITE_TAC[PAIR_EQ];
1685 IMATCH_MP_TAC (TAUT `a /\ b ==> b/\ a`);
1687 MP_TAC v_edge_floor;
1688 REWRITE_TAC[SUBSET;IN;IN_ELIM_THM'];
1692 REWRITE_TAC[SUBSET;INTER;IN;IN_ELIM_THM';EMPTY_EXISTS;];
1694 REWRITE_TAC[v_edge;IN_ELIM_THM' ];
1695 DISCH_THEN (fun t -> REWRITE_TAC[t;int_add_th ;int_of_num_th;]);
1698 TYPE_THEN `?x. (&.0 < x ) /\ (x < &.1)` SUBGOAL_TAC;
1699 TYPE_THEN `&.1/(&.2)` EXISTS_TAC;
1700 IMATCH_MP_TAC half_pos;
1702 DISCH_THEN CHOOSE_TAC;
1705 TYPE_THEN `real_of_int (SND q) + x` EXISTS_TAC;
1706 TYPE_THEN `real_of_int (FST q)` EXISTS_TAC ;
1707 TYPE_THEN `point (real_of_int (FST q),real_of_int (SND q) +x)` EXISTS_TAC;
1714 let v_edge_pointI = prove_by_refinement(
1715 `!p q. ~(v_edge p (pointI q))`,
1719 REWRITE_TAC[pointI;v_edge;IN_ELIM_THM' ];
1721 USE 0 (REWRITE_RULE[]);
1726 USE 0 (REWRITE_RULE[point_inj;PAIR_EQ ]);
1730 USE 2 (REWRITE_RULE[GSYM int_lt ;int_lt_suc_le ]);
1731 USE 2 (REWRITE_RULE[int_le]);
1738 let row_col = prove_by_refinement(
1739 `!a b. (row b INTER col a) = { (pointI(a,b)) }`,
1743 REWRITE_TAC[col;row;INTER;IN;IN_ELIM_THM';pointI];
1744 IMATCH_MP_TAC EQ_EXT;
1745 REWRITE_TAC[IN_ELIM_THM';INSERT;NOT_IN_EMPTY ];
1747 ASM_MESON_TAC[PAIR_EQ ;point_inj];
1751 let hv_edge = prove_by_refinement(
1752 `!p q. h_edge p INTER v_edge q = EMPTY`,
1756 TYPE_THEN `h_edge p INTER v_edge q SUBSET (row (SND p)) INTER (col (FST q))` SUBGOAL_TAC;
1757 REWRITE_TAC[SUBSET_INTER;];
1758 MESON_TAC[h_edge_row;v_edge_col;SUB_IMP_INTER ];
1759 REWRITE_TAC[row_col];
1762 USE 1 (REWRITE_RULE[EMPTY_EXISTS;IN ]);
1764 USE 0 (REWRITE_RULE[SUBSET;IN;IN_ELIM_THM';INSERT;EMPTY ]);
1768 USE 1 (REWRITE_RULE[INTER;IN;IN_ELIM_THM';h_edge_pointI]);
1773 let square_col = prove_by_refinement(
1774 `!p a. (squ p INTER col a) = EMPTY `,
1778 REWRITE_TAC[squ;col];
1781 USE 0 (REWRITE_RULE[EMPTY_EXISTS;IN ]);
1783 USE 0 (REWRITE_RULE[INTER;IN;IN_ELIM_THM']);
1791 USE 0 (REWRITE_RULE[point_inj;PAIR_EQ]);
1794 USE 3 (REWRITE_RULE[GSYM int_lt; int_lt_suc_le ;]);
1795 USE 3 (REWRITE_RULE[ int_le;]);
1803 let square_row = prove_by_refinement(
1804 `!p a. (squ p INTER row a) = EMPTY `,
1807 REWRITE_TAC[squ;row];
1810 USE 0 (REWRITE_RULE[EMPTY_EXISTS;IN ]);
1812 USE 0 (REWRITE_RULE[INTER;IN;IN_ELIM_THM']);
1820 USE 0 (REWRITE_RULE[point_inj;PAIR_EQ]);
1823 USE 5 (REWRITE_RULE[GSYM int_lt; int_lt_suc_le ;]);
1824 USE 5 (REWRITE_RULE[ int_le;]);
1831 let pointI_row = prove_by_refinement(
1832 `!p. (row (SND p)) (pointI p)`,
1836 REWRITE_TAC[row;pointI;IN_ELIM_THM' ];
1841 let pointI_col = prove_by_refinement(
1842 `!p. (col (FST p)) (pointI p)`,
1846 REWRITE_TAC[col;pointI;IN_ELIM_THM' ];
1851 let square_v_edge = prove_by_refinement(
1852 `!p q. (squ p INTER v_edge q = EMPTY)`,
1856 TYPE_THEN `squ p INTER v_edge q SUBSET squ p INTER col (FST q)` SUBGOAL_TAC;
1857 REWRITE_TAC[SUBSET_INTER];
1858 MESON_TAC[SUB_IMP_INTER;v_edge_col;SUBSET_REFL];
1859 REWRITE_TAC[square_col;SUBSET_EMPTY ];
1863 let square_h_edge = prove_by_refinement(
1864 `!p q. (squ p INTER h_edge q = EMPTY)`,
1868 TYPE_THEN `squ p INTER h_edge q SUBSET squ p INTER row (SND q)` SUBGOAL_TAC;
1869 REWRITE_TAC[SUBSET_INTER];
1870 MESON_TAC[SUB_IMP_INTER;h_edge_row;SUBSET_REFL];
1871 REWRITE_TAC[square_row;SUBSET_EMPTY ];
1875 let square_pointI = prove_by_refinement(
1876 `!p q. ~(squ p (pointI q))`,
1880 TYPE_THEN `q` (fun t -> ASSUME_TAC (SPEC t pointI_col));
1881 TYPEL_THEN [`p`;`FST q`] (fun t -> MP_TAC (SPECL t square_col));
1882 REWRITE_TAC[INTER;IN;];
1883 IMATCH_MP_TAC (TAUT `(a ==> ~b) ==> (b ==> ~ a)`);
1885 REWRITE_TAC[EMPTY_EXISTS;IN ];
1886 TYPE_THEN `pointI q` EXISTS_TAC;
1887 ASM_REWRITE_TAC[IN_ELIM_THM'];
1891 let square_floor0 = prove_by_refinement(
1892 `!p. (squ p SUBSET { z | (floor (z 0)) = (FST p) })`,
1896 REWRITE_TAC[SUBSET;IN;IN_ELIM_THM';squ];
1902 ASM_REWRITE_TAC[coord01;floor_range];
1905 REWRITE_TAC[int_add_th;int_of_num_th];
1910 let square_floor1 = prove_by_refinement(
1911 `!p. (squ p SUBSET { z | (floor (z 1)) = (SND p) })`,
1915 REWRITE_TAC[SUBSET;IN;IN_ELIM_THM';squ];
1921 ASM_REWRITE_TAC[coord01;floor_range];
1924 REWRITE_TAC[int_add_th;int_of_num_th];
1929 let square_square = prove_by_refinement(
1930 `!p q. ~(squ p INTER squ q = {}) ==> (squ p = squ q)`,
1933 MP_TAC square_floor0;
1934 MP_TAC square_floor1;
1935 REWRITE_TAC[SUBSET;IN;IN_ELIM_THM';INTER;EMPTY_EXISTS ];
1938 DISCH_THEN CHOOSE_TAC;
1939 TYPE_THEN `p = q` SUBGOAL_TAC;
1940 ONCE_REWRITE_TAC [GSYM PAIR];
1941 REWRITE_TAC[PAIR_EQ];
1947 let square_disj = prove_by_refinement(
1948 `!p q. ~(squ p INTER squ q = EMPTY) <=> (p = q)`,
1951 MP_TAC square_floor0;
1952 MP_TAC square_floor1;
1953 REWRITE_TAC[SUBSET;IN;IN_ELIM_THM';INTER;EMPTY_EXISTS ];
1957 DISCH_THEN CHOOSE_TAC;
1958 ONCE_REWRITE_TAC [GSYM PAIR];
1959 REWRITE_TAC[PAIR_EQ];
1964 CONV_TAC (dropq_conv "u''");
1965 TYPE_THEN `real_of_int (FST q) + (&.1/(&.2))` EXISTS_TAC;
1966 TYPE_THEN `real_of_int (SND q) + (&.1/(&.2))` EXISTS_TAC;
1967 REWRITE_TAC[int_suc];
1968 TYPE_THEN `a = real_of_int(FST q)` ABBREV_TAC;
1969 (*** Modified by JRH since ABBREV_TAC now forbids existing variables
1970 TYPE_THEN `a = real_of_int(SND q)` ABBREV_TAC;
1972 TYPE_THEN `a' = real_of_int(SND q)` ABBREV_TAC;
1973 MP_TAC (REAL_RAT_REDUCE_CONV `&.0 < &.1/(&.2) /\ (&.1/(&.2)) < &.1`);
1979 (* ------------------------------------------------------------------ *)
1981 (* ------------------------------------------------------------------ *)
1984 let cell = jordan_def `cell =
1985 {z | (?p. (z = { (pointI p) }) \/ (z = h_edge p) \/
1986 (z = v_edge p) \/ (z = squ p))}`;;
1988 let cell_rules = prove_by_refinement(
1989 `!p. cell {(pointI p)} /\ (cell (h_edge p)) /\
1990 (cell (v_edge p)) /\ (cell (squ p))`,
1993 REWRITE_TAC[cell;IN_ELIM_THM';];
1998 let cell_mem = prove_by_refinement(
1999 `!C. (cell C) <=> (?p. C = ({(pointI p)})) \/ (?p. C = h_edge p) \/
2000 (?p. C = v_edge p) \/ (?p. C = squ p)`,
2003 REWRITE_TAC[cell;IN_ELIM_THM'];
2008 let square_domain = prove_by_refinement(
2009 `!z. (let (p = (floor(FST z),floor(SND z))) in
2010 (({(pointI p)} UNION
2013 (squ p) ))) (point z) `,
2018 REWRITE_TAC[UNION;IN;IN_ELIM_THM' ];
2019 REWRITE_TAC[pointI;h_edge;v_edge;squ;int_add_th;int_of_num_th;IN_ELIM_THM';INSERT;EMPTY;point_inj;Q_POINT ];
2020 ASSUME_TAC floor_ineq;
2021 TYPE_THEN `FST z` (WITH 0 o SPEC);
2025 REWRITE_TAC[PAIR_LEMMAv2];
2026 REWRITE_TAC[REAL_ARITH `(a <= b) <=> ((a = b) \/ (a < b))`];
2031 let square_cell = prove_by_refinement(
2032 `!z. (let (p = (floor(FST z),floor(SND z))) in
2033 (({(pointI p)} UNION
2036 (squ p) ))) SUBSET (UNIONS cell) `,
2041 REWRITE_TAC[union_subset];
2042 REPEAT CONJ_TAC THEN (IMATCH_MP_TAC sub_union) THEN (REWRITE_TAC[cell_rules]);
2046 let cell_unions = prove_by_refinement(
2047 `!z. (UNIONS cell (point z))`,
2051 ASM_MESON_TAC[square_cell;square_domain;SUBSET;IN];
2055 let cell_partition = prove_by_refinement(
2056 `!C D. (cell C) /\ (cell D) /\ ~(C INTER D = EMPTY) ==> (C = D)`,
2058 let revr = PURE_ONCE_REWRITE_RULE [INTER_COMM] in
2060 PARTIAL_REWRITE_TAC[cell_mem;];
2061 PARTIAL_REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR ];
2063 PARTIAL_REWRITE_TAC[TAUT `((a \/ b ==> C)) <=> ((a ==> C) /\ (b ==> C))`];
2064 PARTIAL_REWRITE_TAC[TAUT `((a /\ b) ==> C) <=> (a ==> b ==> C)`];
2065 REPEAT CONJ_TAC THEN (REPEAT (DISCH_THEN CHOOSE_TAC)) THEN (TRY (UNDISCH_FIND_TAC `(INTER)`)) THEN (ASM PARTIAL_REWRITE_TAC[]) THEN ASM PARTIAL_REWRITE_TAC[square_h_edge;square_v_edge;revr square_h_edge;revr square_v_edge;v_edge_disj;h_edge_disj;hv_edge;revr hv_edge;revr single_inter; single_inter;square_pointI;v_edge_pointI;h_edge_pointI; square_square;INR NOT_IN_EMPTY;INR IN_SING ] THEN (DISCH_THEN (fun t-> REWRITE_TAC[t]));
2069 (* ------------------------------------------------------------------ *)
2070 (* adjacency, closure, convexity, AND strict dominance on cells. *)
2071 (* ------------------------------------------------------------------ *)
2074 let top2 = jordan_def `top2 = top_of_metric (euclid 2,d_euclid)`;;
2076 let adj = jordan_def `adj X Y <=> (~(X = Y) /\
2077 ~(closure top2 X INTER (closure top2 Y) = EMPTY))`;;
2079 let strict_dom = jordan_def `strict_dom X Y <=> (cell X) /\ (cell Y) /\
2080 (closure top2 Y PSUBSET (closure top2 X))`;;
2082 let adj_symm = prove_by_refinement(
2083 `!X Y. (adj X Y) <=> (adj Y X)`,
2088 GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [INTER_COMM];
2093 let adj_irrefl = prove_by_refinement(
2101 let strict_dom_trans = prove_by_refinement(
2102 `!X Y Z. (strict_dom X Y) /\ (strict_dom Y Z) ==> (strict_dom X Z)`,
2105 REWRITE_TAC[strict_dom];
2106 MESON_TAC[PSUBSET_TRANS];
2110 let strict_dom_irrefl = prove_by_refinement(
2111 `!X. ~(strict_dom X X)`,
2114 REWRITE_TAC[strict_dom;PSUBSET_IRREFL ];
2118 let dot_point = prove_by_refinement(
2119 `!p q . (dot (point p) (point q)) = (FST p)*(FST q) + (SND p)*(SND q)`,
2123 TYPE_THEN `dot (point p) (point q) = sum (0,2) (\i. (point p i)*(point q i))` SUBGOAL_TAC;
2124 IMATCH_MP_TAC dot_euclid;
2125 ASM_SIMP_TAC[euclid_point];
2127 REWRITE_TAC[ARITH_RULE `2 = SUC 1`];
2129 REWRITE_TAC[ARITH_RULE `1 = SUC 0`];
2132 REWRITE_TAC[ARITH_RULE `SUC 0 = 1`;coord01];
2137 (* 2d half planes *)
2138 let open_half_plane2D_FLT = prove_by_refinement(
2139 `!r. { z | ?p. ((z = point p) /\ (FST p <. r)) } =
2140 open_half_space 2 (point (&.1,&.0)) r `,
2145 IMATCH_MP_TAC EQ_EXT;
2147 REWRITE_TAC[open_half_space ];
2151 ASM_REWRITE_TAC[dot_point;euclid_point;];
2155 USE 0 (MATCH_MP point_onto);
2158 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2159 USE 1 (CONV_RULE REDUCE_CONV);
2165 let open_half_plane2D_LTF = prove_by_refinement(
2166 `!r. { z | ?p. ((z = point p) /\ (r <. FST p )) } =
2167 open_half_space 2 (point (--. (&.1),&.0)) (--. r) `,
2171 IMATCH_MP_TAC EQ_EXT;
2173 REWRITE_TAC[open_half_space ];
2177 ASM_REWRITE_TAC[dot_point;euclid_point;];
2181 USE 0 (MATCH_MP point_onto);
2184 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2185 USE 1 (CONV_RULE REDUCE_CONV);
2190 let open_half_plane2D_SLT = prove_by_refinement(
2191 `!r. { z | ?p. ((z = point p) /\ (SND p <. r )) } =
2192 open_half_space 2 (point (&.0,&.1)) ( r) `,
2196 IMATCH_MP_TAC EQ_EXT;
2198 REWRITE_TAC[open_half_space ];
2202 ASM_REWRITE_TAC[dot_point;euclid_point;];
2206 USE 0 (MATCH_MP point_onto);
2209 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2210 USE 1 (CONV_RULE REDUCE_CONV);
2215 let open_half_plane2D_LTS = prove_by_refinement(
2216 `!r. { z | ?p. ((z = point p) /\ (r <. SND p )) } =
2217 open_half_space 2 (point (&.0,--.(&.1))) (--. r) `,
2221 IMATCH_MP_TAC EQ_EXT;
2223 REWRITE_TAC[open_half_space ];
2227 ASM_REWRITE_TAC[dot_point;euclid_point;];
2231 USE 0 (MATCH_MP point_onto);
2234 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2235 USE 1 (CONV_RULE REDUCE_CONV);
2240 let closed_half_plane2D_FLE = prove_by_refinement(
2241 `!r. { z | ?p. ((z = point p) /\ (FST p <=. r)) } =
2242 closed_half_space 2 (point (&.1,&.0)) r `,
2246 IMATCH_MP_TAC EQ_EXT;
2248 REWRITE_TAC[open_half_space;hyperplane;closed_half_space ];
2252 ASM_REWRITE_TAC[dot_point;euclid_point;];
2256 USE 0 (MATCH_MP point_onto);
2259 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2260 USE 1 (CONV_RULE REDUCE_CONV);
2265 let closed_half_plane2D_LEF = prove_by_refinement(
2266 `!r. { z | ?p. ((z = point p) /\ (r <=. FST p)) } =
2267 closed_half_space 2 (point (--.(&.1),&.0)) (--. r) `,
2271 IMATCH_MP_TAC EQ_EXT;
2273 REWRITE_TAC[open_half_space;hyperplane;closed_half_space ];
2277 ASM_REWRITE_TAC[dot_point;euclid_point;];
2281 USE 0 (MATCH_MP point_onto);
2284 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2285 USE 1 (CONV_RULE REDUCE_CONV);
2290 let closed_half_plane2D_SLE = prove_by_refinement(
2291 `!r. { z | ?p. ((z = point p) /\ (SND p <=. r)) } =
2292 closed_half_space 2 (point (&.0,&.1)) r `,
2296 IMATCH_MP_TAC EQ_EXT;
2298 REWRITE_TAC[open_half_space;hyperplane;closed_half_space ];
2302 ASM_REWRITE_TAC[dot_point;euclid_point;];
2306 USE 0 (MATCH_MP point_onto);
2309 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2310 USE 1 (CONV_RULE REDUCE_CONV);
2315 let closed_half_plane2D_LES = prove_by_refinement(
2316 `!r. { z | ?p. ((z = point p) /\ (r <=. SND p )) } =
2317 closed_half_space 2 (point (&.0,(--. (&.1)))) (--. r) `,
2321 IMATCH_MP_TAC EQ_EXT;
2323 REWRITE_TAC[open_half_space;hyperplane;closed_half_space ];
2327 ASM_REWRITE_TAC[dot_point;euclid_point;];
2331 USE 0 (MATCH_MP point_onto);
2334 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2335 USE 1 (CONV_RULE REDUCE_CONV);
2340 let line2D_F = prove_by_refinement(
2341 `!r. { z | ?p. ((z = point p) /\ (FST p = r)) } =
2342 hyperplane 2 (point (&.1,&.0)) r `,
2346 IMATCH_MP_TAC EQ_EXT;
2348 REWRITE_TAC[open_half_space;hyperplane;closed_half_space ];
2352 ASM_REWRITE_TAC[dot_point;euclid_point;];
2356 USE 0 (MATCH_MP point_onto);
2359 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2360 USE 1 (CONV_RULE REDUCE_CONV);
2365 let line2D_S = prove_by_refinement(
2366 `!r. { z | ?p. ((z = point p) /\ (SND p = r)) } =
2367 hyperplane 2 (point (&.0,&.1)) r `,
2371 IMATCH_MP_TAC EQ_EXT;
2373 REWRITE_TAC[open_half_space;hyperplane;closed_half_space ];
2377 ASM_REWRITE_TAC[dot_point;euclid_point;];
2381 USE 0 (MATCH_MP point_onto);
2384 USE 1 (REWRITE_RULE[dot_point;euclid_point]);
2385 USE 1 (CONV_RULE REDUCE_CONV);
2390 let open_half_plane2D_FLT_open = prove_by_refinement(
2391 `!r. top2 { z | ?p. ((z = point p) /\ (FST p <. r)) }`,
2395 REWRITE_TAC[open_half_plane2D_FLT;top2];
2396 SIMP_TAC[open_half_space_open;euclid_point];
2400 let open_half_plane2D_LTF_open = prove_by_refinement(
2401 `!r. top2 { z | ?p. ((z = point p) /\ (r <. FST p )) }`,
2405 REWRITE_TAC[open_half_plane2D_LTF;top2];
2406 SIMP_TAC[open_half_space_open;euclid_point];
2410 let open_half_plane2D_SLT_open = prove_by_refinement(
2411 `!r. top2 { z | ?p. ((z = point p) /\ (SND p <. r )) }`,
2415 REWRITE_TAC[open_half_plane2D_SLT;top2];
2416 SIMP_TAC[open_half_space_open;euclid_point];
2420 let open_half_plane2D_LTS_open = prove_by_refinement(
2421 `!r. top2 { z | ?p. ((z = point p) /\ (r <. SND p )) }`,
2425 REWRITE_TAC[open_half_plane2D_LTS;top2];
2426 SIMP_TAC[open_half_space_open;euclid_point];
2430 let closed_half_plane2D_FLT_closed = prove_by_refinement(
2431 `!r. closed_ top2 { z | ?p. ((z = point p) /\ (FST p <=. r)) }`,
2435 REWRITE_TAC[closed_half_plane2D_FLE;top2];
2436 SIMP_TAC[closed_half_space_closed;euclid_point];
2440 let closed_half_plane2D_LTF_closed = prove_by_refinement(
2441 `!r. closed_ top2 { z | ?p. ((z = point p) /\ (r <=. FST p )) }`,
2445 REWRITE_TAC[closed_half_plane2D_LEF;top2];
2446 SIMP_TAC[closed_half_space_closed;euclid_point];
2450 let closed_half_plane2D_SLT_closed = prove_by_refinement(
2451 `!r. closed_ top2 { z | ?p. ((z = point p) /\ (SND p <=. r )) }`,
2455 REWRITE_TAC[closed_half_plane2D_SLE;top2];
2456 SIMP_TAC[closed_half_space_closed;euclid_point];
2460 let closed_half_plane2D_LTS_closed = prove_by_refinement(
2461 `!r. closed_ top2 { z | ?p. ((z = point p) /\ (r <=. SND p )) }`,
2465 REWRITE_TAC[closed_half_plane2D_LES;top2];
2466 SIMP_TAC[closed_half_space_closed;euclid_point];
2470 let line2D_F_closed = prove_by_refinement(
2471 `!r. closed_ top2 { z | ?p. ((z = point p) /\ (FST p = r)) }`,
2475 REWRITE_TAC[line2D_F;top2];
2476 SIMP_TAC[hyperplane_closed;euclid_point];
2480 let line2D_S_closed = prove_by_refinement(
2481 `!r. closed_ top2 { z | ?p. ((z = point p) /\ (SND p = r)) }`,
2485 REWRITE_TAC[line2D_S;top2];
2486 SIMP_TAC[hyperplane_closed;euclid_point];
2490 let open_half_plane2D_FLT_convex = prove_by_refinement(
2491 `!r. convex { z | ?p. ((z = point p) /\ (FST p <. r)) }`,
2495 REWRITE_TAC[open_half_plane2D_FLT;];
2496 SIMP_TAC[open_half_space_convex;euclid_point];
2500 let open_half_plane2D_LTF_convex = prove_by_refinement(
2501 `!r. convex { z | ?p. ((z = point p) /\ (r <. FST p )) }`,
2505 REWRITE_TAC[open_half_plane2D_LTF;];
2506 SIMP_TAC[open_half_space_convex;euclid_point];
2510 let open_half_plane2D_SLT_convex = prove_by_refinement(
2511 `!r. convex { z | ?p. ((z = point p) /\ (SND p <. r)) }`,
2515 REWRITE_TAC[open_half_plane2D_SLT;];
2516 SIMP_TAC[open_half_space_convex;euclid_point];
2520 let open_half_plane2D_LTS_convex = prove_by_refinement(
2521 `!r. convex { z | ?p. ((z = point p) /\ (r <. SND p )) }`,
2525 REWRITE_TAC[open_half_plane2D_LTS;];
2526 SIMP_TAC[open_half_space_convex;euclid_point];
2530 let closed_half_plane2D_FLT_convex = prove_by_refinement(
2531 `!r. convex { z | ?p. ((z = point p) /\ (FST p <=. r)) }`,
2535 REWRITE_TAC[closed_half_plane2D_FLE;];
2536 SIMP_TAC[closed_half_space_convex;euclid_point];
2540 let closed_half_plane2D_LTF_convex = prove_by_refinement(
2541 `!r. convex { z | ?p. ((z = point p) /\ (r <=. FST p )) }`,
2545 REWRITE_TAC[closed_half_plane2D_LEF;];
2546 SIMP_TAC[closed_half_space_convex;euclid_point];
2550 let closed_half_plane2D_SLT_convex = prove_by_refinement(
2551 `!r. convex { z | ?p. ((z = point p) /\ (SND p <=. r)) }`,
2555 REWRITE_TAC[closed_half_plane2D_SLE;];
2556 SIMP_TAC[closed_half_space_convex;euclid_point];
2560 let closed_half_plane2D_LTS_convex = prove_by_refinement(
2561 `!r. convex { z | ?p. ((z = point p) /\ (r <=. SND p )) }`,
2565 REWRITE_TAC[closed_half_plane2D_LES;];
2566 SIMP_TAC[closed_half_space_convex;euclid_point];
2570 let line2D_F_convex = prove_by_refinement(
2571 `!r. convex { z | ?p. ((z = point p) /\ ( FST p = r )) }`,
2575 REWRITE_TAC[line2D_F;];
2576 SIMP_TAC[hyperplane_convex;euclid_point];
2580 let line2D_S_convex = prove_by_refinement(
2581 `!r. convex { z | ?p. ((z = point p) /\ (SND p = r)) }`,
2585 REWRITE_TAC[line2D_S;];
2586 SIMP_TAC[hyperplane_convex;euclid_point];
2590 let closure_FLT = prove_by_refinement(
2591 `!r. (closure top2 { z | ?p. ((z = point p) /\ (FST p <. r)) } =
2592 { z | ?p. ((z = point p) /\ (FST p <=. r)) })`,
2597 REWRITE_TAC[open_half_plane2D_FLT;closed_half_plane2D_FLE;top2];
2598 TYPE_THEN `~(point(&.1,&.0) = euclid0)` SUBGOAL_TAC;
2600 USE 0(REWRITE_RULE[]);
2601 USE 0 (fun t -> AP_THM t `0`);
2602 USE 0 (REWRITE_RULE[coord01;euclid0;REAL_ARITH `~(&.1= &.0)`]);
2604 SIMP_TAC[closure_half_space;euclid_point];
2609 let closure_LTF = prove_by_refinement(
2610 `!r. (closure top2 { z | ?p. ((z = point p) /\ (r <. FST p)) } =
2611 { z | ?p. ((z = point p) /\ (r <=. FST p )) })`,
2616 REWRITE_TAC[open_half_plane2D_LTF;closed_half_plane2D_LEF;top2];
2617 TYPE_THEN `~(point(--. (&.1),&.0) = euclid0)` SUBGOAL_TAC;
2619 USE 0(REWRITE_RULE[]);
2620 USE 0 (fun t -> AP_THM t `0`);
2621 USE 0 (REWRITE_RULE[coord01;euclid0;REAL_ARITH `~(--. (&.1)= &.0)`]);
2623 SIMP_TAC[closure_half_space;euclid_point];
2628 let closure_SLT = prove_by_refinement(
2629 `!r. (closure top2 { z | ?p. ((z = point p) /\ (SND p <. r)) } =
2630 { z | ?p. ((z = point p) /\ (SND p <=. r)) })`,
2635 REWRITE_TAC[open_half_plane2D_SLT;closed_half_plane2D_SLE;top2];
2636 TYPE_THEN `~(point(&.0,&.1) = euclid0)` SUBGOAL_TAC;
2638 USE 0(REWRITE_RULE[]);
2639 USE 0 (fun t -> AP_THM t `1`);
2640 USE 0 (REWRITE_RULE[coord01;euclid0;REAL_ARITH `~(&.1= &.0)`]);
2642 SIMP_TAC[closure_half_space;euclid_point];
2647 let closure_LTS = prove_by_refinement(
2648 `!r. (closure top2 { z | ?p. ((z = point p) /\ (r <. SND p)) } =
2649 { z | ?p. ((z = point p) /\ (r <=. SND p )) })`,
2654 REWRITE_TAC[open_half_plane2D_LTS;closed_half_plane2D_LES;top2];
2655 TYPE_THEN `~(point(&.0, --. (&.1)) = euclid0)` SUBGOAL_TAC;
2657 USE 0(REWRITE_RULE[]);
2658 USE 0 (fun t -> AP_THM t `1`);
2659 USE 0 (REWRITE_RULE[coord01;euclid0;REAL_ARITH `~(--. (&.1)= &.0)`]);
2661 SIMP_TAC[closure_half_space;euclid_point];
2668 (* ------------------------------------------------------------------ *)
2670 (* ------------------------------------------------------------------ *)
2673 let single_subset = prove_by_refinement(
2674 `!(x:A) A. ({x} SUBSET A) <=> (A x)`,
2677 REWRITE_TAC[SUBSET;INSERT];
2682 let top2_top = prove_by_refinement(
2686 ASM_SIMP_TAC [top2;top_of_metric_top;metric_euclid];
2691 (* ------------------------------------------------------------------ *)
2692 (* H_edge & v_edge, convexity, closure, closed, adj, etc. *)
2693 (* ------------------------------------------------------------------ *)
2695 let e1 = jordan_def `e1 = point(&.1,&.0)`;;
2696 let e2 = jordan_def `e2 = point(&.0,&.1)`;;
2698 let hc_edge = jordan_def `hc_edge m =
2699 (h_edge m) UNION {(pointI m)} UNION {(pointI m + e1)}`;;
2701 let vc_edge = jordan_def `vc_edge m =
2702 (v_edge m) UNION {(pointI m)} UNION {(pointI m + e2)}`;;
2707 let h_edge_inter = prove_by_refinement(
2709 ({z | ?p. (z = point p) /\ (real_of_int (FST m) <. FST p)}
2710 INTER {z | ?p. (z = point p) /\ (FST p <. real_of_int(FST m +: &:1))}
2711 INTER {z | ?p. (z = point p) /\ (SND p = real_of_int(SND m))})`,
2716 REWRITE_TAC[INTER;h_edge];
2717 IMATCH_MP_TAC EQ_EXT;
2724 ASM_REWRITE_TAC[point_inj];
2725 REPEAT CONJ_TAC THEN (TYPE_THEN `(u,real_of_int(SND m))` EXISTS_TAC) THEN ASM_REWRITE_TAC[PAIR_SPLIT];
2730 TYPE_THEN `FST p` EXISTS_TAC;
2731 TYPE_THEN `SND p` EXISTS_TAC;
2734 USE 2 (REWRITE_RULE[point_inj]);
2735 USE 1 (REWRITE_RULE[point_inj]);
2744 let h_edge_convex = prove_by_refinement(
2745 `!m. (convex (h_edge m))`,
2749 REWRITE_TAC[h_edge_inter;];
2750 IMATCH_MP_TAC convex_inter;
2752 REWRITE_TAC [open_half_plane2D_LTF_convex;];
2753 IMATCH_MP_TAC convex_inter;
2754 REWRITE_TAC[open_half_plane2D_FLT_convex;line2D_S_convex];
2758 let hc_edge_inter = prove_by_refinement(
2760 ({z | ?p. (z = point p) /\ (real_of_int (FST m) <=. FST p)}
2761 INTER {z | ?p. (z = point p) /\ (FST p <=. real_of_int(FST m +: &:1))}
2762 INTER {z | ?p. (z = point p) /\ (SND p = real_of_int(SND m))})`,
2766 REWRITE_TAC[hc_edge;e1];
2767 IMATCH_MP_TAC SUBSET_ANTISYM;
2769 REWRITE_TAC[union_subset];
2771 REWRITE_TAC[h_edge_inter];
2772 REWRITE_TAC[SUBSET;INTER];
2773 ASM_MESON_TAC[REAL_ARITH `a < b ==> a <=. b`];
2774 REWRITE_TAC[single_subset;INTER;pointI;point_inj;PAIR_SPLIT ; int_suc];
2775 REPEAT (CONJ_TAC) THEN (TYPE_THEN `(real_of_int(FST m),real_of_int(SND m))` EXISTS_TAC) THEN REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_LE_REFL;REAL_ARITH `x <=. x+ &.1`];
2776 REWRITE_TAC[single_subset;INTER;pointI;point_inj;PAIR_SPLIT ; point_add;int_suc];
2778 REPEAT (CONJ_TAC) THEN (TYPE_THEN `(real_of_int(FST m) + &.1,real_of_int(SND m))` EXISTS_TAC) THEN REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_LE_REFL;REAL_ARITH `x <=. x+ &.1`];
2779 REWRITE_TAC[INTER;SUBSET;UNION;e1;h_edge;pointI;point_add;point_inj;INR IN_SING ;int_suc ];
2785 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT ];
2786 REWRITE_TAC[prove_by_refinement( `!P x y. (?u v. (((x:A) = u) /\ ((y:B) = v)) /\ P u v) <=> (P x y)`,[MESON_TAC[]])];
2789 REWRITE_TAC[point_inj;];
2790 REWRITE_TAC[prove_by_refinement (`!Q p. (?p'. ((p:A) = p') /\ (Q p')) <=> (Q p)`,[MESON_TAC[]])];
2797 let hc_edge_closed = prove_by_refinement(
2798 `!m. (closed_ top2 (hc_edge m))`,
2801 REWRITE_TAC[hc_edge_inter];
2803 IMATCH_MP_TAC closed_inter2;
2804 REWRITE_TAC[top2_top;closed_half_plane2D_LTF_closed];
2805 IMATCH_MP_TAC closed_inter2;
2806 REWRITE_TAC[top2_top;closed_half_plane2D_FLT_closed;line2D_S_closed;];
2810 let hc_edge_convex = prove_by_refinement(
2811 `!m. (convex (hc_edge m))`,
2814 REWRITE_TAC[hc_edge_inter];
2816 IMATCH_MP_TAC convex_inter;
2817 REWRITE_TAC[closed_half_plane2D_LTF_convex];
2818 IMATCH_MP_TAC convex_inter;
2819 REWRITE_TAC[closed_half_plane2D_FLT_convex;line2D_S_convex;];
2823 let h_edge_subset = prove_by_refinement(
2824 `!m. (h_edge m SUBSET hc_edge m)`,
2827 REWRITE_TAC[hc_edge;SUBSET;UNION;];
2832 let h_edge_euclid = prove_by_refinement(
2833 `!m. (h_edge m) SUBSET (euclid 2)`,
2836 REWRITE_TAC[SUBSET;h_edge];
2837 MESON_TAC[euclid_point];
2841 let h_edge_closure = prove_by_refinement(
2842 `!m. (closure top2 (h_edge m)) = hc_edge m`,
2846 IMATCH_MP_TAC SUBSET_ANTISYM;
2848 IMATCH_MP_TAC closure_subset;
2849 REWRITE_TAC[h_edge_subset;top2_top;hc_edge_closed];
2850 REWRITE_TAC[hc_edge];
2851 REWRITE_TAC[union_subset;e1;pointI;single_subset;point_add];
2853 IMATCH_MP_TAC subset_closure;
2854 REWRITE_TAC[top2_top];
2856 SUBGOAL_TAC `!t u. t*u +. (&.1- t)*u = u` ;
2857 REWRITE_TAC[GSYM REAL_RDISTRIB];
2860 CONJ_TAC THEN (IMATCH_MP_TAC closure_segment) THEN REWRITE_TAC[h_edge_euclid];
2861 TYPE_THEN `(pointI m)+point(&.1,&.0)` EXISTS_TAC;
2863 ASM_REWRITE_TAC[h_edge;pointI;point_add;point_scale;PAIR_SPLIT;point_inj;];
2864 CONV_TAC (dropq_conv "u");
2865 CONV_TAC (dropq_conv "v");
2867 ASM_REWRITE_TAC[int_suc];
2868 TYPE_THEN `a = real_of_int(FST m)` ABBREV_TAC;
2872 TYPE_THEN `pointI m` EXISTS_TAC;
2874 ASM_REWRITE_TAC[h_edge;pointI;point_add;point_scale;PAIR_SPLIT;point_inj;];
2875 CONV_TAC (dropq_conv "u");
2876 CONV_TAC (dropq_conv "v");
2878 ASM_REWRITE_TAC[int_suc];
2879 TYPE_THEN `a = real_of_int(FST m)` ABBREV_TAC;
2888 let point_split = prove_by_refinement(
2889 `!z u v. (z = point(u,v)) <=> (u = z 0) /\ (v = z 1) /\ (euclid 2 z)`,
2895 REWRITE_TAC[coord01;euclid_point];
2897 IMATCH_MP_TAC EQ_EXT;
2899 DISJ_CASES_TAC (ARITH_RULE `(x = 0) \/ (x = 1) \/ (2 <= x)`);
2900 ASM_REWRITE_TAC[coord01];
2902 DISCH_THEN DISJ_CASES_TAC;
2903 ASM_REWRITE_TAC[coord01];
2904 ASM_MESON_TAC[euclid;euclid_point]
2910 let v_edge_inter = prove_by_refinement(
2912 ({z | ?p. (z = point p) /\ (real_of_int (SND m) <. SND p)}
2913 INTER {z | ?p. (z = point p) /\ (SND p <. real_of_int(SND m +: &:1))}
2914 INTER {z | ?p. (z = point p) /\ (FST p = real_of_int(FST m))})`,
2918 REWRITE_TAC[INTER;v_edge;int_suc ];
2919 IMATCH_MP_TAC EQ_EXT;
2926 ASM_REWRITE_TAC[point_inj];
2927 CONV_TAC (dropq_conv "p");
2929 CONV_TAC (dropq_conv "p");
2930 CONV_TAC (dropq_conv "p'");
2933 CONV_TAC (dropq_conv "u");
2934 REWRITE_TAC[point_split;];
2935 CONV_TAC (dropq_conv "v");
2936 ASM_MESON_TAC[FST;SND;PAIR;coord01;euclid_point;point_onto];
2940 let v_edge_convex = prove_by_refinement(
2941 `!m. (convex (v_edge m))`,
2945 REWRITE_TAC[v_edge_inter;];
2946 IMATCH_MP_TAC convex_inter;
2948 REWRITE_TAC [open_half_plane2D_LTS_convex;];
2949 IMATCH_MP_TAC convex_inter;
2950 REWRITE_TAC[open_half_plane2D_SLT_convex;line2D_F_convex];
2954 let vc_edge_inter = prove_by_refinement(
2956 ({z | ?p. (z = point p) /\ (real_of_int (SND m) <=. SND p)}
2957 INTER {z | ?p. (z = point p) /\ (SND p <=. real_of_int(SND m +: &:1))}
2958 INTER {z | ?p. (z = point p) /\ (FST p = real_of_int(FST m))})`,
2962 REWRITE_TAC[vc_edge;e2];
2963 IMATCH_MP_TAC SUBSET_ANTISYM;
2965 REWRITE_TAC[union_subset];
2967 REWRITE_TAC[v_edge_inter];
2968 REWRITE_TAC[SUBSET;INTER];
2969 ASM_MESON_TAC[REAL_ARITH `a < b ==> a <=. b`];
2970 REWRITE_TAC[single_subset;INTER;pointI;point_inj;PAIR_SPLIT ; int_suc];
2971 REPEAT (CONJ_TAC) THEN (TYPE_THEN `(real_of_int(FST m),real_of_int(SND m))` EXISTS_TAC) THEN REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_LE_REFL;REAL_ARITH `x <=. x+ &.1`];
2972 REWRITE_TAC[single_subset;INTER;pointI;point_inj;PAIR_SPLIT ; point_add;int_suc];
2974 REPEAT (CONJ_TAC) THEN (TYPE_THEN `(real_of_int(FST m) ,real_of_int(SND m) + &.1)` EXISTS_TAC) THEN REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_LE_REFL;REAL_ARITH `x <=. x+ &.1`];
2975 REWRITE_TAC[INTER;SUBSET;UNION;e2;v_edge;pointI;point_add;point_inj;INR IN_SING ;int_suc ];
2981 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT ];
2982 REWRITE_TAC[prove_by_refinement( `!P x y. (?u v. (((x:A) = u) /\ ((y:B) = v)) /\ P u v) <=> (P x y)`,[MESON_TAC[]])];
2985 REWRITE_TAC[point_inj;];
2986 REWRITE_TAC[prove_by_refinement (`!Q p. (?p'. ((p:A) = p') /\ (Q p')) <=> (Q p)`,[MESON_TAC[]])];
2993 let vc_edge_closed = prove_by_refinement(
2994 `!m. (closed_ top2 (vc_edge m))`,
2997 REWRITE_TAC[vc_edge_inter];
2999 IMATCH_MP_TAC closed_inter2;
3000 REWRITE_TAC[top2_top;closed_half_plane2D_LTS_closed];
3001 IMATCH_MP_TAC closed_inter2;
3002 REWRITE_TAC[top2_top;closed_half_plane2D_SLT_closed;line2D_F_closed;];
3006 let vc_edge_convex = prove_by_refinement(
3007 `!m. (convex (vc_edge m))`,
3010 REWRITE_TAC[vc_edge_inter];
3012 IMATCH_MP_TAC convex_inter;
3013 REWRITE_TAC[closed_half_plane2D_LTS_convex];
3014 IMATCH_MP_TAC convex_inter;
3015 REWRITE_TAC[closed_half_plane2D_SLT_convex;line2D_F_convex;];
3019 let v_edge_subset = prove_by_refinement(
3020 `!m. (v_edge m SUBSET vc_edge m)`,
3023 REWRITE_TAC[vc_edge;SUBSET;UNION;];
3028 let v_edge_euclid = prove_by_refinement(
3029 `!m. (v_edge m) SUBSET (euclid 2)`,
3032 REWRITE_TAC[SUBSET;v_edge];
3033 MESON_TAC[euclid_point];
3037 let v_edge_closure = prove_by_refinement(
3038 `!m. (closure top2 (v_edge m)) = vc_edge m`,
3042 IMATCH_MP_TAC SUBSET_ANTISYM;
3044 IMATCH_MP_TAC closure_subset;
3045 REWRITE_TAC[v_edge_subset;top2_top;vc_edge_closed];
3046 REWRITE_TAC[vc_edge];
3047 REWRITE_TAC[union_subset;e2;pointI;single_subset;point_add];
3049 IMATCH_MP_TAC subset_closure;
3050 REWRITE_TAC[top2_top];
3052 SUBGOAL_TAC `!t u. t*u +. (&.1- t)*u = u` ;
3053 REWRITE_TAC[GSYM REAL_RDISTRIB];
3056 CONJ_TAC THEN (IMATCH_MP_TAC closure_segment) THEN REWRITE_TAC[v_edge_euclid];
3057 TYPE_THEN `(pointI m)+point(&.0,&.1)` EXISTS_TAC;
3059 ASM_REWRITE_TAC[v_edge;pointI;point_add;point_scale;PAIR_SPLIT;point_inj;];
3060 CONV_TAC (dropq_conv "u");
3061 CONV_TAC (dropq_conv "v");
3063 ASM_REWRITE_TAC[int_suc];
3064 TYPE_THEN `a = real_of_int(FST m)` ABBREV_TAC;
3068 TYPE_THEN `pointI m` EXISTS_TAC;
3070 ASM_REWRITE_TAC[v_edge;pointI;point_add;point_scale;PAIR_SPLIT;point_inj;];
3071 CONV_TAC (dropq_conv "u");
3072 CONV_TAC (dropq_conv "v");
3074 ASM_REWRITE_TAC[int_suc];
3075 TYPE_THEN `a = real_of_int(FST m)` ABBREV_TAC;
3083 let squ_euclid = prove_by_refinement(
3084 `!m. (squ m) SUBSET (euclid 2)`,
3087 REWRITE_TAC[SUBSET;squ];
3088 MESON_TAC[euclid_point];
3092 let cell_euclid = prove_by_refinement(
3093 `!X. (cell X) ==> (X SUBSET euclid 2)`,
3098 DISCH_THEN (CHOOSE_THEN MP_TAC);
3099 REP_CASES_TAC THEN ASM_REWRITE_TAC[h_edge_euclid;squ_euclid;v_edge_euclid];
3100 REWRITE_TAC[ISUBSET;INR IN_SING;pointI;euclid_point];
3101 ASM_MESON_TAC[euclid_point];
3105 let edge = jordan_def `edge C <=> ?m. ((C = v_edge m) \/ (C = h_edge m))`;;
3107 let edge_v = prove_by_refinement(
3108 `!m. edge (v_edge m)`,
3111 ASM_MESON_TAC[edge];
3115 let edge_h = prove_by_refinement(
3116 `!m. edge (h_edge m)`,
3119 ASM_MESON_TAC[edge];
3123 let num_closure = jordan_def `num_closure G x =
3124 CARD { C | (G C) /\ (closure top2 C x) }`;;
3126 let num_lower = jordan_def `num_lower G n =
3127 CARD { m | (G (h_edge m)) /\ (FST m = FST n) /\ (SND m <=: SND n) }`;;
3129 let set_lower = jordan_def `set_lower G n =
3130 { m | (G (h_edge m)) /\ (FST m = FST n) /\ (SND m <=: SND n) }`;;
3132 let num_lower_set = prove_by_refinement(
3133 `!G n. num_lower G n = CARD (set_lower G n)`,
3136 REWRITE_TAC[num_lower;set_lower];
3140 let even_cell = jordan_def `even_cell G C <=>
3141 (?m. (C = {(pointI m)}) /\ (EVEN (num_lower G m))) \/
3142 (?m. (C = h_edge m) /\ (EVEN (num_lower G m))) \/
3143 (?m. (C = v_edge m) /\ (EVEN (num_lower G m))) \/
3144 (?m. (C = squ m) /\ (EVEN (num_lower G m)))`;;
3147 let eq_sing = prove_by_refinement(
3148 (*** Parens added by JRH; parser no longer hacks "=" specially
3149 so it is really right associative
3150 `!X (y:A). X = {y} = ((X y) /\ (!u. (X u) ==> (u=y)))`,
3152 `!X (y:A). (X = {y}) <=> ((X y) /\ (!u. (X u) ==> (u=y)))`,
3155 REWRITE_TAC[INSERT ;];
3160 IMATCH_MP_TAC EQ_EXT;
3166 let h_edge_pointIv2 = prove_by_refinement(
3167 `!p q. ~(h_edge p = {(pointI q)})`,
3170 REWRITE_TAC[eq_sing;h_edge_pointI];
3174 let v_edge_pointIv2 = prove_by_refinement(
3175 `!p q. ~(v_edge p = {(pointI q)})`,
3178 REWRITE_TAC[eq_sing;v_edge_pointI];
3182 let square_pointIv2 = prove_by_refinement(
3183 `!p q. ~(squ p = {(pointI q)})`,
3186 REWRITE_TAC[eq_sing;square_pointI];
3190 let cell_nonempty = prove_by_refinement(
3191 `!z. (cell z) ==> ~(z = EMPTY)`,
3194 REWRITE_TAC[cell_mem];
3198 USE 1( REWRITE_RULE [eq_sing]);
3199 ASM_MESON_TAC[EMPTY];
3201 ASM_MESON_TAC[h_edge_disj;INTER_EMPTY];
3203 ASM_MESON_TAC[v_edge_disj;INTER_EMPTY];
3205 ASM_MESON_TAC[square_disj;INTER_EMPTY];
3209 let hv_edgeV2 = prove_by_refinement(
3210 `!p q. ~(h_edge p = v_edge q)`,
3213 ASM_MESON_TAC[cell_rules;cell_nonempty;hv_edge;INTER_IDEMPOT];
3217 let square_v_edgeV2 = prove_by_refinement(
3218 `!p q. ~(squ p = v_edge q)`,
3221 ASM_MESON_TAC[cell_rules;cell_nonempty;square_v_edge;INTER_IDEMPOT];
3225 let square_h_edgeV2 = prove_by_refinement(
3226 `!p q. ~(squ p = h_edge q)`,
3229 ASM_MESON_TAC[cell_rules;cell_nonempty;square_h_edge;INTER_IDEMPOT];
3233 let h_edge_inj = prove_by_refinement(
3234 `!p q . (h_edge p = h_edge q) <=> (p = q)`,
3237 ASM_MESON_TAC[cell_rules;cell_nonempty;h_edge_disj;INTER_IDEMPOT];
3241 let v_edge_inj = prove_by_refinement(
3242 `!p q . (v_edge p = v_edge q) <=> (p = q)`,
3245 ASM_MESON_TAC[cell_rules;cell_nonempty;v_edge_disj;INTER_IDEMPOT];
3249 let squ_inj = prove_by_refinement(
3250 `!p q . (squ p = squ q) <=> (p = q)`,
3253 ASM_MESON_TAC[cell_rules;cell_nonempty;square_disj;INTER_IDEMPOT];
3257 let finite_set_lower = prove_by_refinement(
3258 `!G n. (FINITE G) ==> (FINITE (set_lower G n))`,
3262 TYPE_THEN `INJ h_edge (set_lower G n) G` SUBGOAL_TAC;
3263 REWRITE_TAC[INJ;set_lower;h_edge_inj];
3267 USE 0 (MATCH_MP FINITE_INJ);
3272 let even_cell_point = prove_by_refinement(
3273 `!G m. even_cell G {(pointI m)} <=> EVEN(num_lower G m)`,
3276 REWRITE_TAC[even_cell;square_pointIv2;v_edge_pointIv2;h_edge_pointIv2];
3277 REWRITE_TAC[pointI_inj;INSERT;eq_sing];
3282 let even_cell_h_edge = prove_by_refinement(
3283 `!G m. even_cell G (h_edge m) <=> EVEN(num_lower G m)`,
3286 REWRITE_TAC[even_cell;h_edge_pointIv2];
3287 REWRITE_TAC[pointI_inj;INSERT;h_edge_inj;GSYM square_h_edgeV2;hv_edgeV2;eq_sing];
3292 let even_cell_v_edge = prove_by_refinement(
3293 `!G m. even_cell G (v_edge m) <=> EVEN(num_lower G m)`,
3296 REWRITE_TAC[even_cell;v_edge_pointIv2];
3297 REWRITE_TAC[pointI_inj;INSERT;v_edge_inj;GSYM square_v_edgeV2;hv_edgeV2;eq_sing];
3302 let even_cell_squ = prove_by_refinement(
3303 `!G m. even_cell G (squ m) <=> EVEN(num_lower G m)`,
3306 REWRITE_TAC[even_cell;v_edge_pointIv2];
3307 REWRITE_TAC[pointI_inj;INSERT;squ_inj;GSYM square_v_edgeV2;GSYM square_h_edgeV2;square_pointI;eq_sing];
3312 let h_edge_squ_parity = prove_by_refinement(
3313 `!G m. even_cell G (h_edge m) <=> even_cell G (squ m)`,
3316 REWRITE_TAC[even_cell_squ;even_cell_h_edge;num_lower];
3320 let up = jordan_def `up (m:int#int) = (FST m,SND m +: (&:1))`;;
3321 let down = jordan_def `down (m:int#int) = (FST m,SND m -: (&:1))`;;
3322 let left = jordan_def `left (m:int#int) = (FST m -: (&:1),SND m)`;;
3323 let right = jordan_def `right (m:int#int) = (FST m +: (&:1),SND m)`;;
3325 let set_lower_delete = prove_by_refinement(
3326 `!G n. set_lower G (down n) = (set_lower G n) DELETE n`,
3329 REWRITE_TAC[set_lower;down;DELETE ];
3331 IMATCH_MP_TAC EQ_EXT;
3333 REWRITE_TAC[PAIR_SPLIT;INT_LE_SUB_LADD;GSYM INT_LT_DISCRETE;];
3334 REWRITE_TAC[int_le;int_lt;];
3335 REWRITE_TAC[ (ARITH_RULE `! x y. (x <. y) <=> ((x <= y) /\ ~(x = y))`)];
3336 REWRITE_TAC[GSYM int_eq];
3341 let set_lower_n = prove_by_refinement(
3342 `!G n. set_lower G n n = (G (h_edge n))`,
3345 REWRITE_TAC[set_lower;int_le ; REAL_LE_REFL];
3350 let CARD_SUC_DELETE = prove_by_refinement(
3351 `!(x:A) s. FINITE s /\ s x ==>
3352 ((SUC (CARD (s DELETE x))) = CARD s)`,
3356 TYPE_THEN `s = (x INSERT (s DELETE x))` SUBGOAL_TAC;
3357 ASM_MESON_TAC[INR INSERT_DELETE];
3358 USE 0 (ONCE_REWRITE_RULE[GSYM FINITE_DELETE]);
3359 TYPE_THEN `b = s DELETE x` ABBREV_TAC ;
3361 ASM_SIMP_TAC [INR CARD_CLAUSES];
3363 ASM_MESON_TAC[INR IN_DELETE];
3368 let even_delete = prove_by_refinement(
3369 `!(x:A) s. FINITE s ==>
3370 ((EVEN (CARD (s DELETE x)) <=> EVEN (CARD s)) <=> ~(s x))`,
3374 TYPE_THEN `s x` ASM_CASES_TAC ;
3375 ASM_MESON_TAC[CARD_SUC_DELETE;EVEN ];
3376 ASM_SIMP_TAC[CARD_DELETE];
3380 let num_lower_down = prove_by_refinement(
3381 `!G m. (FINITE G) ==>
3382 ((EVEN (num_lower G (down m)) <=> EVEN (num_lower G m)) <=>
3383 ~(set_lower G m m))`,
3387 REWRITE_TAC[num_lower_set;set_lower_delete];
3388 IMATCH_MP_TAC even_delete;
3389 REWRITE_TAC[even_cell_squ;even_cell_h_edge;num_lower;down];
3390 ASM_MESON_TAC[finite_set_lower];
3394 let squ_down = prove_by_refinement(
3395 `!G m. (FINITE G) ==>
3396 ((even_cell G (squ (down m)) <=> even_cell G (squ m)) <=>
3397 ~(set_lower G m m))`,
3400 REWRITE_TAC[even_cell_squ;num_lower_down];
3404 (* ------------------------------------------------------------------ *)
3405 (* edge combinatorics *)
3406 (* ------------------------------------------------------------------ *)
3408 let pair_size_2 = prove_by_refinement(
3409 `!(a:A) b. ~(a= b) ==> ({a, b} HAS_SIZE 2)`,
3413 REWRITE_TAC[HAS_SIZE];
3414 ASM_SIMP_TAC[FINITE_SING;CARD_CLAUSES;INR IN_SING ];
3416 REWRITE_TAC[FINITE_INSERT;FINITE_RULES];
3417 REWRITE_TAC[ARITH_RULE `2 = SUC 1`;SUC_INJ;];
3418 MESON_TAC[SING;CARD_SING];
3422 let has_size2 = prove_by_refinement(
3423 `!u. (u HAS_SIZE 2) <=> (?(a:A) b. (u = {a , b}) /\ ~(a=b))`,
3428 REWRITE_TAC[HAS_SIZE];
3430 TYPE_THEN `~(u = EMPTY)` SUBGOAL_TAC;
3434 USE 1 (REWRITE_RULE[CARD_CLAUSES]);
3441 USE 0 (MATCH_MP CARD_DELETE_CHOICE);
3442 TYPE_THEN `CARD (u DELETE CHOICE u) = 1` SUBGOAL_TAC;
3443 ONCE_REWRITE_TAC [GSYM SUC_INJ];
3447 TYPE_THEN `u DELETE CHOICE u HAS_SIZE 1` SUBGOAL_TAC;
3448 REWRITE_TAC[HAS_SIZE];
3449 ASM_REWRITE_TAC[FINITE_DELETE];
3451 USE 5 (MATCH_MP CARD_SING_CONV);
3452 USE 5 (REWRITE_RULE [SING]);
3454 TYPE_THEN `CHOICE u` EXISTS_TAC;
3455 TYPE_THEN `x` EXISTS_TAC;
3458 USE 4 (MATCH_MP CHOICE_DEF);
3459 ASM_SIMP_TAC[INSERT_DELETE];
3460 TYPE_THEN `(u DELETE (CHOICE u)) x` SUBGOAL_TAC;
3462 ASM_REWRITE_TAC[INR IN_SING ];
3464 TYPE_THEN `~((u DELETE CHOICE u) (CHOICE u))` SUBGOAL_TAC;
3465 REWRITE_TAC[INR IN_DELETE];
3471 ASM_MESON_TAC[pair_size_2];
3475 let in_pair = prove_by_refinement(
3476 `!(a:A) b t. {a , b} t <=> (t = b) \/ (t = a)`,
3479 REWRITE_TAC[INSERT];
3483 let pair_swap_select =
3484 jordan_def `pair_swap u (x:A) = @y. ~(x = y) /\ (u y)`;;
3486 let pair_swap_pair = prove_by_refinement(
3487 `!(a:A) b. ~(a = b) ==>
3488 (pair_swap {a,b} a = b) /\ (pair_swap {a,b} b = a)`,
3492 REWRITE_TAC[pair_swap_select];
3493 REWRITE_TAC[in_pair];
3494 CONJ_TAC THEN SELECT_TAC THEN (ASM_MESON_TAC[]);
3498 let pair_swap = prove_by_refinement(
3499 `!u (x:A). (u HAS_SIZE 2)/\ (u x) ==>
3500 (~(pair_swap u x = x)) /\ (u (pair_swap u x))`,
3503 REWRITE_TAC[has_size2];
3509 USE 1 (REWRITE_RULE[in_pair]);
3511 ASM_MESON_TAC[pair_swap_pair];
3513 DISCH_THEN (DISJ_CASES_TAC) THEN ASM_SIMP_TAC [pair_swap_pair] THEN REWRITE_TAC[INSERT];
3517 let pair_swap_invol = prove_by_refinement(
3518 `!u (x:A). (u HAS_SIZE 2) /\ (u x) ==>
3519 (pair_swap u (pair_swap u x) = x)`,
3522 REWRITE_TAC[has_size2];
3528 USE 1 (REWRITE_RULE[in_pair]);
3530 DISCH_THEN (DISJ_CASES_TAC);
3531 ASM_SIMP_TAC [pair_swap_pair];
3532 ASM_SIMP_TAC [pair_swap_pair];
3538 (* ------------------------------------------------------------------ *)
3540 (* ------------------------------------------------------------------ *)
3542 (* ------------------------------------------------------------------ *)
3544 (* ------------------------------------------------------------------ *)
3546 let rectagon = jordan_def `rectagon G <=>
3547 (FINITE G) /\ ~(G = EMPTY ) /\ (G SUBSET edge) /\
3548 (!m . ({0,2} (num_closure G (pointI m)))) /\
3549 (!S. ((S SUBSET G) /\ ~(S = EMPTY) /\
3550 (!C C'. (S C) /\ (G C') /\ (adj C C') ==> (S C'))) ==>
3553 let segment = jordan_def `segment G <=>
3554 (FINITE G) /\ ~(G = EMPTY ) /\ (G SUBSET edge) /\
3555 (!m . ({0,1,2} (num_closure G (pointI m)))) /\
3556 (!S. ((S SUBSET G) /\ ~(S = EMPTY) /\
3557 (!C C'. (S C) /\ (G C') /\ (adj C C') ==> (S C'))) ==>
3560 let psegment = jordan_def `psegment G <=>
3561 segment G /\ ~(rectagon G)`;;
3563 let rectagon_segment = prove_by_refinement(
3564 `!G. (rectagon G ) ==> (segment G)`,
3567 REWRITE_TAC[segment;rectagon;INSERT ];
3572 let endpoint = jordan_def `endpoint G m <=>
3573 (num_closure G (pointI m) = 1)`;;
3575 let midpoint = jordan_def `midpoint G m <=>
3576 (num_closure G (pointI m) = 2)`;;
3578 let psegment_endpoint = prove_by_refinement(
3579 `!G. (psegment G) ==> (?m. (endpoint G m))`,
3582 REWRITE_TAC[psegment;rectagon;segment;endpoint];
3590 USE 3 (REWRITE_RULE[INSERT]);
3591 USE 5 (REWRITE_RULE[INSERT]);
3596 let rectagon_endpoint = prove_by_refinement(
3597 `!G. (rectagon G) ==> ~(?m. (endpoint G m))`,
3600 REWRITE_TAC[rectagon;endpoint;INSERT ];
3603 ASM_MESON_TAC[ARITH_RULE `(~(1=2)) /\ ~(1=0)` ];
3607 let num_closure_mono = prove_by_refinement(
3608 `!G G' x. (FINITE G') /\ (G SUBSET G') ==>
3609 (num_closure G x <= num_closure G' x)`,
3612 REWRITE_TAC[num_closure];
3614 IMATCH_MP_TAC CARD_SUBSET ;
3615 REWRITE_TAC[ISUBSET];
3617 ASM_MESON_TAC[ISUBSET];
3618 IMATCH_MP_TAC FINITE_SUBSET;
3619 TYPE_THEN `G'` EXISTS_TAC;
3620 ASM_REWRITE_TAC[ISUBSET];
3625 let endpoint_psegment = prove_by_refinement(
3626 `!G. (?m. (endpoint G m)) /\ (segment G) ==> (psegment G)`,
3629 ASM_MESON_TAC [psegment;rectagon_endpoint];
3633 let num_closure_size = prove_by_refinement(
3635 ({C | G C /\ closure top2 C x} HAS_SIZE (num_closure G x) )`,
3638 REWRITE_TAC[HAS_SIZE;num_closure];
3640 IMATCH_MP_TAC FINITE_SUBSET;
3641 TYPE_THEN `G` EXISTS_TAC;
3642 REWRITE_TAC[ISUBSET];
3647 let endpoint_edge = prove_by_refinement(
3648 `!G m. (FINITE G) /\ (endpoint G m) ==> (?! e. (G e) /\
3649 (closure top2 e (pointI m)))`,
3653 REWRITE_TAC[endpoint;];
3655 TYPE_THEN `{C | G C /\ closure top2 C (pointI m)} HAS_SIZE 1` SUBGOAL_TAC;
3657 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
3658 IMATCH_MP_TAC num_closure_size;
3661 USE 2 (MATCH_MP CARD_SING_CONV);
3662 USE 2 (REWRITE_RULE[SING]);
3664 USE 2 (REWRITE_RULE[eq_sing]);
3665 REWRITE_TAC[EXISTS_UNIQUE_ALT];
3671 let midpoint_edge = prove_by_refinement(
3672 `!G m. (FINITE G) /\ (midpoint G m) ==>
3673 {C | G C /\ closure top2 C (pointI m)} HAS_SIZE 2`,
3676 REWRITE_TAC[midpoint;];
3679 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
3680 IMATCH_MP_TAC num_closure_size;
3685 let two_endpoint = prove_by_refinement(
3686 `!e. (edge e) ==> ({ m | (closure top2 e (pointI m)) } HAS_SIZE 2)`,
3693 DISCH_THEN DISJ_CASES_TAC;
3694 ASM_REWRITE_TAC[v_edge_closure;h_edge_closure];
3695 REWRITE_TAC[vc_edge;UNION;has_size2];
3696 TYPE_THEN `m` EXISTS_TAC;
3697 TYPE_THEN `(FST m,SND m +: (&:1))` EXISTS_TAC;
3699 IMATCH_MP_TAC EQ_EXT;
3701 REWRITE_TAC[INR IN_SING ;];
3702 TYPE_THEN `euclid_plus (pointI m) e2 = pointI (FST m,SND m +: (&:1))` SUBGOAL_TAC ;
3703 REWRITE_TAC[pointI;e2;point_add;int_suc ];
3706 REWRITE_TAC[v_edge_pointI;pointI_inj;];
3707 REWRITE_TAC[INSERT];
3709 REWRITE_TAC[PAIR_SPLIT];
3712 ASM_REWRITE_TAC[v_edge_closure;h_edge_closure];
3713 REWRITE_TAC[hc_edge;UNION;has_size2];
3714 TYPE_THEN `m` EXISTS_TAC;
3715 TYPE_THEN `(FST m +: (&:1),SND m )` EXISTS_TAC;
3717 IMATCH_MP_TAC EQ_EXT;
3719 REWRITE_TAC[INR IN_SING ;];
3720 TYPE_THEN `euclid_plus (pointI m) e1 = pointI (FST m +: (&:1),SND m )` SUBGOAL_TAC ;
3721 REWRITE_TAC[pointI;e1;point_add;int_suc ];
3724 REWRITE_TAC[h_edge_pointI;pointI_inj;];
3725 REWRITE_TAC[INSERT];
3727 REWRITE_TAC[PAIR_SPLIT];
3732 let edge_midend = prove_by_refinement(
3733 `!G e m. (segment G) /\ (G e) /\ (closure top2 e (pointI m)) ==>
3734 (midpoint G m) \/ (endpoint G m)`,
3737 REWRITE_TAC[segment;midpoint;endpoint];
3740 USE 3 (REWRITE_RULE[INSERT]);
3741 TYPE_THEN `~(num_closure G (pointI m) = 0)` SUBGOAL_TAC;
3742 USE 0 (MATCH_MP num_closure_size);
3747 USE 0(REWRITE_RULE[HAS_SIZE_0]);
3749 REWRITE_TAC[EMPTY_EXISTS];
3750 TYPE_THEN `e` EXISTS_TAC;
3757 let plus_e12 = prove_by_refinement(
3758 `!m. ((pointI m) + e2 = pointI (FST m,SND m +: (&:1))) /\
3759 ((pointI m) + e1 = pointI (FST m +: (&:1),SND m))`,
3763 REWRITE_TAC[pointI;point_add;int_suc];
3768 let c_edge_euclid = prove_by_refinement(
3769 `!e. (edge e) ==> (closure top2 e) SUBSET (euclid 2)`,
3774 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC ) THEN ASM_REWRITE_TAC[hc_edge;vc_edge;h_edge_closure;v_edge_closure;union_subset;plus_e12] THEN MESON_TAC[cell_rules; cell_euclid];
3779 let inter_lattice = prove_by_refinement(
3780 `!x e e'. (edge e) /\ (edge e') /\ (~(e=e')) /\
3781 ((closure top2 e INTER closure top2 e') x) ==>
3782 (?m. x = pointI m)`,
3786 TYPE_THEN `euclid 2 x` SUBGOAL_TAC;
3787 USE 3 (REWRITE_RULE[INTER]);
3789 USE 0 (MATCH_MP c_edge_euclid);
3790 USE 0 (REWRITE_RULE[ISUBSET]);
3792 DISCH_THEN (MP_TAC o (MATCH_MP point_onto));
3796 ASSUME_TAC square_domain;
3798 USE 5 (CONV_RULE (NAME_CONFLICT_CONV));
3803 ASM_REWRITE_TAC[INTER];
3808 DISCH_THEN (CHOOSE_THEN MP_TAC);
3811 DISCH_THEN (CHOOSE_THEN MP_TAC);
3812 REP_CASES_TAC THEN UNDISCH_FIND_TAC `(~)` THEN UNDISCH_FIND_TAC `(closure)` THEN UNDISCH_FIND_TAC `(point p)` THEN ASM_REWRITE_TAC[] THEN (REWRITE_TAC[INR IN_SING;h_edge_closure;v_edge_closure;UNION;vc_edge;hc_edge;plus_e12 ]) THEN
3815 (let tx = REWRITE_RULE[EQ_EMPTY;INTER ] in MESON_TAC[tx hv_edge;tx v_edge_disj;tx h_edge_disj;tx square_v_edge;tx square_h_edge;v_edge_inj;h_edge_inj]);
3819 let edgec_convex = prove_by_refinement(
3820 `!e. (edge e) ==> (convex (closure top2 e))`,
3825 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC ) THEN ASM_REWRITE_TAC[v_edge_closure;h_edge_closure;hc_edge_convex;vc_edge_convex];
3829 let midpoint_h_edge = prove_by_refinement(
3830 `!m. (h_edge m) (((&.1)/(&.2))*# (pointI m) +
3831 ((&.1)/(&.2))*# (pointI m + e1))`,
3834 REWRITE_TAC[plus_e12];
3835 REWRITE_TAC[h_edge;pointI;point_add;point_scale;point_inj;PAIR_SPLIT;int_suc];
3837 CONV_TAC (dropq_conv "u");
3838 CONV_TAC (dropq_conv "v");
3839 TYPE_THEN `a = real_of_int(SND m)` ABBREV_TAC;
3840 TYPE_THEN `b = real_of_int(FST m)` ABBREV_TAC;
3844 ineq_lt_tac `b + (&.1/(&.2)) = &1 / &2 * b + &1 / &2 * (b + &1)`;
3845 ineq_lt_tac `((&1 / &2) * b + &1 / &2 * (b + &1)) + (&1 / &2) = b +. &1`
3849 let midpoint_v_edge = prove_by_refinement(
3850 `!m. (v_edge m) (((&.1)/(&.2))*# (pointI m) +
3851 ((&.1)/(&.2))*# (pointI m + e2))`,
3854 REWRITE_TAC[plus_e12];
3855 REWRITE_TAC[v_edge;pointI;point_add;point_scale;point_inj;PAIR_SPLIT;int_suc];
3857 CONV_TAC (dropq_conv "u");
3858 CONV_TAC (dropq_conv "v");
3859 TYPE_THEN `a = real_of_int(SND m)` ABBREV_TAC;
3860 TYPE_THEN `b = real_of_int(FST m)` ABBREV_TAC;
3864 ineq_lt_tac `a +. (&1/ &2)= &1 / &2 * a + &1 / &2 * (a + &1)`;
3865 ineq_lt_tac `(&1 / &2 * a + &1 / &2 * (a + &1)) +(&1/ &2) = a + &1`;
3869 let midpoint_unique = prove_by_refinement(
3870 `!x y e e'. (edge e) /\ (edge e') /\ (~(e = e')) /\
3871 ((closure top2 e INTER closure top2 e') x) /\
3872 ((closure top2 e INTER closure top2 e') y) ==>
3877 TYPE_THEN `convex (closure top2 e INTER closure top2 e')` SUBGOAL_TAC;
3878 IMATCH_MP_TAC convex_inter ;
3879 ASM_MESON_TAC[edgec_convex];
3880 TYPE_THEN `(?m. x = pointI m) /\ (?n. y = pointI n)` SUBGOAL_TAC;
3881 ASM_MESON_TAC[inter_lattice];
3890 TYPE_THEN `(closure top2 e (pointI n)) /\ closure top2 e (pointI m)` SUBGOAL_TAC;
3896 WITH 0 (MATCH_MP edgec_convex);
3898 USE 0 (REWRITE_RULE[edge]);
3901 DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[];
3902 (* ml -- start of 1st main branch. *)
3904 TYPE_THEN `((n = m') \/ (n = (FST m',SND m' + &:1))) /\ ((m = m') \/ (m = (FST m',SND m' + &:1)))` SUBGOAL_TAC;
3907 ASM_REWRITE_TAC[h_edge_closure;hc_edge;v_edge_closure;UNION;vc_edge;INR IN_SING;plus_e12;pointI_inj;v_edge_pointI ;h_edge_pointI];
3909 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
3910 TYPE_THEN `X = (closure top2 e INTER closure top2 e')` ABBREV_TAC;
3912 TYPE_THEN `X (pointI m') /\ X (pointI m' + e2) ==> ~(X INTER (v_edge m') = EMPTY)` SUBGOAL_TAC;
3913 REWRITE_TAC[EMPTY_EXISTS;INTER ];
3914 USE 5 (REWRITE_RULE[convex;mk_segment]);
3916 H_MATCH_MP (HYP "5") (HYP "10");
3917 USE 11 (REWRITE_RULE[ISUBSET]);
3918 TYPE_THEN `b = (&1 / &2) *# (pointI m') + (&1 / &2) *# (pointI m' + e2)` ABBREV_TAC;
3919 TYPE_THEN `b` EXISTS_TAC;
3923 DISCH_THEN IMATCH_MP_TAC ;
3924 TYPE_THEN `&1/ &2` EXISTS_TAC;
3925 CONV_TAC REAL_RAT_REDUCE_CONV;
3929 MATCH_ACCEPT_TAC midpoint_v_edge; (* end of goal A *)
3930 REWRITE_TAC[plus_e12];
3932 TYPE_THEN `X INTER (v_edge m') = EMPTY ` SUBGOAL_TAC;
3933 REWRITE_TAC[EQ_EMPTY];
3935 USE 10 (REWRITE_RULE[INTER]);
3936 TYPE_THEN `?r. (x = pointI r)` SUBGOAL_TAC;
3937 ASM_MESON_TAC[inter_lattice;edge];
3941 ASM_MESON_TAC[v_edge_pointI];
3944 REP_CASES_TAC THEN ASM_MESON_TAC[];
3945 (* end of FIRST main branch -- snd main branch -- fully parallel *)
3947 TYPE_THEN `((n = m') \/ (n = (FST m' + &:1,SND m'))) /\ ((m = m') \/ (m = (FST m' + &:1,SND m' )))` SUBGOAL_TAC;
3950 ASM_REWRITE_TAC[h_edge_closure;hc_edge;v_edge_closure;UNION;vc_edge;INR IN_SING;plus_e12;pointI_inj;v_edge_pointI ;h_edge_pointI];
3952 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
3953 TYPE_THEN `X = (closure top2 e INTER closure top2 e')` ABBREV_TAC;
3955 TYPE_THEN `X (pointI m') /\ X (pointI m' + e1) ==> ~(X INTER (h_edge m') = EMPTY)` SUBGOAL_TAC;
3956 REWRITE_TAC[EMPTY_EXISTS;INTER ];
3957 USE 5 (REWRITE_RULE[convex;mk_segment]);
3959 H_MATCH_MP (HYP "5") (HYP "10");
3960 USE 11 (REWRITE_RULE[ISUBSET]);
3961 TYPE_THEN `b = (&1 / &2) *# (pointI m') + (&1 / &2) *# (pointI m' + e1)` ABBREV_TAC;
3962 TYPE_THEN `b` EXISTS_TAC;
3966 DISCH_THEN IMATCH_MP_TAC ;
3967 TYPE_THEN `&1/ &2` EXISTS_TAC;
3968 CONV_TAC REAL_RAT_REDUCE_CONV;
3972 MATCH_ACCEPT_TAC midpoint_h_edge; (* end of goal A' *)
3973 REWRITE_TAC[plus_e12];
3975 TYPE_THEN `X INTER (h_edge m') = EMPTY ` SUBGOAL_TAC;
3976 REWRITE_TAC[EQ_EMPTY];
3978 USE 10 (REWRITE_RULE[INTER]);
3979 TYPE_THEN `?r. (x = pointI r)` SUBGOAL_TAC;
3980 ASM_MESON_TAC[inter_lattice;edge];
3984 ASM_MESON_TAC[h_edge_pointI];
3987 REP_CASES_TAC THEN ASM_MESON_TAC[];
3991 let edge_inter = prove_by_refinement(
3992 `!C C'. (edge C) /\ (edge C') /\ (adj C C') ==>
3993 (?m. (closure top2 C) INTER (closure top2 C') = {(pointI m)}) `,
3999 USE 3 (REWRITE_RULE[EMPTY_EXISTS]);
4001 TYPE_THEN `(?m. u = pointI m)` SUBGOAL_TAC;
4002 ASM_MESON_TAC[inter_lattice];
4003 DISCH_THEN (CHOOSE_TAC);
4005 TYPE_THEN `m` EXISTS_TAC;
4006 ASM_REWRITE_TAC [eq_sing];
4007 ASM_MESON_TAC[midpoint_unique];
4012 let inter_midpoint = prove_by_refinement(
4013 `!G C C' m. (segment G) /\ (G C) /\ (G C') /\ (adj C C') /\
4014 (((closure top2 C) INTER (closure top2 C')) (pointI m)) ==>
4018 REWRITE_TAC[midpoint;segment];
4021 USE 3 (REWRITE_RULE[INSERT]);
4023 USE 0 (MATCH_MP num_closure_size);
4025 TYPE_THEN `X = {C | G C /\ closure top2 C (pointI m)}` ABBREV_TAC ;
4026 TYPE_THEN `X C /\ X C'` SUBGOAL_TAC;
4030 REWRITE_TAC[INTER]; (* done WITH subgoal *)
4032 TYPE_THEN `~(C = C')` SUBGOAL_TAC;
4038 USE 0 (MATCH_MP CARD_SING_CONV);
4039 USE 0 (REWRITE_RULE[SING;eq_sing]);
4042 USE 0 (REWRITE_RULE[HAS_SIZE_0;EQ_EMPTY]);
4047 let mid_end_disj = prove_by_refinement(
4048 `!G m. ~(endpoint G m /\ midpoint G m)`,
4051 REWRITE_TAC[endpoint;midpoint];
4052 ASM_MESON_TAC[ARITH_RULE `~(1=2)`];
4056 let two_exclusion = prove_by_refinement(
4057 `!X p q (r:A). (X HAS_SIZE 2) /\ (X p) /\ (X q) /\ (X r) /\ (~(p = r))
4058 /\ (~(q = r)) ==> (p = q)`,
4061 REWRITE_TAC[has_size2;];
4068 ASM_REWRITE_TAC[INSERT];
4073 let midpoint_exists = prove_by_refinement(
4074 `!G e. (segment G) /\ (G e) /\ (~(G = {e})) ==>
4075 (?m. (closure top2 e (pointI m)) /\ (midpoint G m))`,
4080 TYPE_THEN `!m. (closure top2 e (pointI m)) ==> (endpoint G m)` SUBGOAL_TAC;
4081 ASM_MESON_TAC[edge_midend];
4086 REWRITE_TAC[segment];
4090 DISCH_THEN (IMATCH_MP_TAC o GSYM);
4091 ASM_REWRITE_TAC[ISUBSET;INR IN_SING;];
4095 REWRITE_TAC [eq_sing];
4097 TYPE_THEN `(?m. (closure top2 e) INTER (closure top2 C') = {(pointI m)})` SUBGOAL_TAC;
4098 IMATCH_MP_TAC edge_inter;
4099 ASM_MESON_TAC[ISUBSET];
4100 DISCH_THEN CHOOSE_TAC;
4102 TYPE_THEN `endpoint G m` SUBGOAL_TAC;
4104 DISCH_THEN IMATCH_MP_TAC ;
4106 REWRITE_TAC[eq_sing];
4109 REWRITE_TAC[endpoint];
4110 USE 0 (MATCH_MP num_closure_size);
4111 TSPEC `(pointI m)` 0;
4114 USE 0 (MATCH_MP CARD_SING_CONV);
4115 USE 0 (REWRITE_RULE[SING]);
4117 USE 0 (REWRITE_RULE[eq_sing]);
4118 USE 10 (REWRITE_RULE[eq_sing]);
4119 USE 10 (REWRITE_RULE[INTER]);
4124 let pair_swap_unique = prove_by_refinement(
4125 `!u x (y:A). (u HAS_SIZE 2) /\ (u x) /\ (u y) /\ ~(x = y) ==>
4126 (y = pair_swap u x)`,
4130 IMATCH_MP_TAC two_exclusion ;
4131 TYPE_THEN `u` EXISTS_TAC;
4132 TYPE_THEN `x` EXISTS_TAC;
4134 ASM_MESON_TAC[pair_swap];
4138 let pair_swap_adj = prove_by_refinement(
4139 `!G e m e'. (segment G) /\ (G e) /\ (midpoint G m) /\
4140 (closure top2 e (pointI m)) /\
4141 (e' = pair_swap {C | G C /\ closure top2 C (pointI m)} e) ==>
4142 ({C | G C /\ closure top2 C (pointI m)} HAS_SIZE 2) /\
4143 G e' /\ adj e' e /\ (closure top2 e' (pointI m)) `,
4147 TYPE_THEN `X = {C | G C /\ closure top2 C (pointI m)}` ABBREV_TAC;
4149 TYPE_THEN `X HAS_SIZE 2` SUBGOAL_TAC;
4150 USE 3 (REWRITE_RULE[midpoint]);
4151 USE 1 (REWRITE_RULE[segment]);
4154 USE 1 (MATCH_MP num_closure_size);
4160 TYPE_THEN `X e` SUBGOAL_TAC;
4165 TYPE_THEN `X e'` SUBGOAL_TAC;
4166 ASM_MESON_TAC[pair_swap];
4174 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
4180 ASM_REWRITE_TAC[adj];
4181 ASM_SIMP_TAC[pair_swap];
4182 REWRITE_TAC[EMPTY_EXISTS];
4183 ASM_REWRITE_TAC[INTER];
4190 A terminal edge is expressed as
4191 (endpoint G m) /\ (closure top2 e (pointI m))
4194 let terminal_edge_adj = prove_by_refinement(
4195 `!G e m. (segment G) /\ (G e) /\ (~(G = {e})) /\
4196 (endpoint G m) /\ (closure top2 e (pointI m))
4198 (?! e'. (G e') /\ (adj e e')) `,
4203 REWRITE_TAC[EXISTS_UNIQUE_ALT ];
4204 TYPE_THEN `(?m. (closure top2 e (pointI m)) /\ (midpoint G m))` SUBGOAL_TAC;
4205 IMATCH_MP_TAC midpoint_exists;
4207 DISCH_THEN CHOOSE_TAC;
4210 USE 5 (REWRITE_RULE[midpoint]);
4211 TYPE_THEN `FINITE G` SUBGOAL_TAC;
4212 ASM_MESON_TAC[segment];
4214 USE 8 (MATCH_MP num_closure_size);
4215 TSPEC `pointI m'` 8;
4217 TYPE_THEN `X = {C | G C /\ closure top2 C (pointI m')}` ABBREV_TAC;
4218 TYPE_THEN `X e` SUBGOAL_TAC;
4222 TYPE_THEN `pair_swap X e` EXISTS_TAC;
4227 TYPE_THEN `(?m. (closure top2 e) INTER (closure top2 y) = {(pointI m)}) ` SUBGOAL_TAC;
4228 IMATCH_MP_TAC edge_inter;
4229 ASM_MESON_TAC[segment;ISUBSET;];
4230 DISCH_THEN CHOOSE_TAC;
4231 (* show m''=m', then X y, then y != e, then it is the PAIR swap *)
4232 TYPE_THEN `ec = (closure top2 e)` ABBREV_TAC;
4233 TYPE_THEN `ec (pointI m'')` SUBGOAL_TAC;
4235 REWRITE_TAC[eq_sing];
4239 TYPE_THEN `m'' = m'` SUBGOAL_TAC;
4240 TYPE_THEN `Z = {m | ec (pointI m)}` ABBREV_TAC;
4241 IMATCH_MP_TAC two_exclusion;
4242 TYPE_THEN `Z` EXISTS_TAC;
4243 TYPE_THEN `m` EXISTS_TAC;
4247 IMATCH_MP_TAC two_endpoint;
4248 ASM_MESON_TAC[segment;ISUBSET];
4251 TYPE_THEN `midpoint G m''` SUBGOAL_TAC ;
4252 IMATCH_MP_TAC inter_midpoint;
4253 TYPE_THEN `e` EXISTS_TAC;
4254 TYPE_THEN `y` EXISTS_TAC;
4255 ASM_REWRITE_TAC[INR IN_SING ];
4256 ASM_MESON_TAC[mid_end_disj]; (* m'' = m' done *)
4258 TYPE_THEN `X y` SUBGOAL_TAC;
4261 USE 13 (REWRITE_RULE[INTER;eq_sing]);
4264 TYPE_THEN `~(y = e)` SUBGOAL_TAC;
4268 IMATCH_MP_TAC (GSYM pair_swap_unique);
4270 (* now second direction nsd *)
4271 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
4272 ASSUME_TAC pair_swap_adj;
4273 TYPEL_THEN [`G`;`e`;`m'`;`pair_swap X e`] (USE 11 o ISPECL);
4276 TYPE_THEN `X (pair_swap X e)` SUBGOAL_TAC;
4277 ASM_MESON_TAC[pair_swap];
4279 TYPE_THEN `closure top2 (pair_swap X e) (pointI m')` SUBGOAL_TAC;
4281 TYPE_THEN `e'' = pair_swap X e` ABBREV_TAC ;
4285 ASM_MESON_TAC[adj_symm];
4289 let psegment_edge = prove_by_refinement(
4290 `!e. (edge e) ==> (psegment {e})`,
4294 IMATCH_MP_TAC endpoint_psegment;
4295 ASM_REWRITE_TAC[endpoint;segment;EQ_EMPTY ;INR IN_SING;FINITE_SING;ISUBSET;num_closure];
4301 TYPE_THEN `m` EXISTS_TAC;
4303 DISCH_THEN DISJ_CASES_TAC;
4305 IMATCH_MP_TAC CARD_SING;
4307 TYPE_THEN `v_edge m` EXISTS_TAC;
4308 REWRITE_TAC[eq_sing;h_edge_closure;v_edge_closure;vc_edge;hc_edge;UNION;INR IN_SING ];
4311 IMATCH_MP_TAC CARD_SING;
4313 TYPE_THEN `h_edge m` EXISTS_TAC;
4314 REWRITE_TAC[eq_sing;h_edge_closure;v_edge_closure;vc_edge;hc_edge;UNION;INR IN_SING ];
4321 REWRITE_TAC[INSERT];
4323 TYPE_THEN `closure top2 e (pointI m)` ASM_CASES_TAC ;
4324 DISJ1_TAC THEN DISJ2_TAC ;
4325 IMATCH_MP_TAC CARD_SING;
4326 REWRITE_TAC[SING ;eq_sing];
4329 TYPE_THEN `{C | (C = e) /\ closure top2 C (pointI m)} = {}` SUBGOAL_TAC;
4331 USE 2 (REWRITE_RULE[EMPTY_EXISTS]);
4335 REWRITE_TAC[CARD_CLAUSES];
4337 REWRITE_TAC[eq_sing];
4342 let segment_delete = prove_by_refinement(
4343 `!G e m. (segment G) /\ (endpoint G m) /\
4344 (closure top2 e (pointI m)) /\ (~(G = {e}))
4345 ==> (segment (G DELETE e))`,
4349 TYPE_THEN `~G e` ASM_CASES_TAC;
4350 USE 0 (REWRITE_RULE[INR DELETE_NON_ELEMENT]);
4352 REWRITE_TAC[segment];
4354 ASM_REWRITE_TAC[FINITE_DELETE;delete_empty];
4357 MESON_TAC[ISUBSET ;INR IN_DELETE];
4360 REWRITE_TAC[INSERT];
4361 TYPE_THEN `num_closure (G DELETE e) (pointI m') <=| (num_closure G (pointI m'))` SUBGOAL_TAC;
4362 IMATCH_MP_TAC num_closure_mono;
4363 ASM_REWRITE_TAC[INR IN_DELETE;ISUBSET];
4366 USE 4 (REWRITE_RULE[INSERT]);
4371 TYPE_THEN `(?! e'. (G e') /\ (adj e e'))` SUBGOAL_TAC;
4372 IMATCH_MP_TAC terminal_edge_adj;
4373 REWRITE_TAC[segment];
4374 TYPE_THEN `m` EXISTS_TAC;
4376 REWRITE_TAC[EXISTS_UNIQUE_ALT];
4377 DISCH_THEN CHOOSE_TAC;
4379 TYPE_THEN `(e INSERT S = G) ==> (S = G DELETE e)` SUBGOAL_TAC;
4381 IMATCH_MP_TAC (TAUT `(a ==> b ==> C) ==> (b ==> a ==> C)`);
4382 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
4383 REWRITE_TAC[DELETE_INSERT];
4384 REWRITE_TAC[DELETE;ISUBSET;];
4386 IMATCH_MP_TAC EQ_EXT;
4390 DISCH_THEN IMATCH_MP_TAC ;
4392 TYPE_THEN `S e'` ASM_CASES_TAC;
4393 TSPEC `e INSERT S` 5;
4395 DISCH_THEN IMATCH_MP_TAC ;
4397 ASM_REWRITE_TAC [INR INSERT_SUBSET;NOT_INSERT_EMPTY];
4400 MESON_TAC[ISUBSET;INR IN_DELETE];
4404 REWR 11; (* ok to here *)
4406 TYPE_THEN `C' = e` ASM_CASES_TAC;
4407 ASM_REWRITE_TAC[INSERT];
4408 ASM_REWRITE_TAC[INSERT]; (* *)
4410 TYPE_THEN `C = e` ASM_CASES_TAC;
4415 (* start not not -- *)
4417 DISCH_THEN IMATCH_MP_TAC ;
4420 REWRITE_TAC[INSERT];
4423 REWRITE_TAC[DELETE];
4427 TYPE_THEN `S = G` SUBGOAL_TAC;
4429 DISCH_THEN IMATCH_MP_TAC ;
4433 REWRITE_TAC[DELETE;ISUBSET];
4437 TYPEL_THEN [`C`;`C'`] (USE 11 o ISPECL);
4439 DISCH_THEN IMATCH_MP_TAC ;
4441 REWRITE_TAC[DELETE];
4445 TYPE_THEN `G C /\ adj e C` SUBGOAL_TAC;
4446 ASM_MESON_TAC[adj_symm;ISUBSET];
4455 let other_end = jordan_def `other_end e m =
4456 pair_swap {m | closure top2 e (pointI m)} m`;;
4458 let other_end_prop = prove_by_refinement(
4459 `!e m. (edge e) /\ (closure top2 e (pointI m))==>
4460 (closure top2 e (pointI (other_end e m))) /\
4461 (~(other_end e m = m)) /\
4462 (other_end e (other_end e m) = m)`,
4465 REWRITE_TAC[other_end];
4467 USE 0 (MATCH_MP two_endpoint);
4468 TYPE_THEN `X = {m | closure top2 e (pointI m)}` ABBREV_TAC;
4469 TYPE_THEN `X m` SUBGOAL_TAC;
4473 ASM_SIMP_TAC[pair_swap_invol;pair_swap];
4474 TYPE_THEN `X (pair_swap X m)` SUBGOAL_TAC ;
4475 ASM_SIMP_TAC[pair_swap];
4481 let num_closure_delete = prove_by_refinement(
4482 `!G e p. (FINITE G) ==> ((num_closure (G DELETE e) p) =
4483 (if ((G e) /\ (closure top2 e p)) then ((num_closure G p) -| 1)
4484 else (num_closure G p)))`,
4489 REWRITE_TAC[num_closure];
4490 TYPE_THEN `{C | (G DELETE e) C /\ closure top2 C p} = {C | G C /\ closure top2 C p} DELETE e` SUBGOAL_TAC;
4491 IMATCH_MP_TAC EQ_EXT;
4492 REWRITE_TAC[DELETE ];
4495 TYPE_THEN `FINITE {C | G C /\ closure top2 C p}` SUBGOAL_TAC;
4496 IMATCH_MP_TAC FINITE_SUBSET;
4497 TYPE_THEN `G` EXISTS_TAC;
4498 ASM_REWRITE_TAC[ISUBSET;];
4501 USE 2 (MATCH_MP CARD_DELETE);
4504 REWRITE_TAC[num_closure;DELETE ];
4506 IMATCH_MP_TAC EQ_EXT;
4509 TYPE_THEN `x = e` ASM_CASES_TAC;
4515 let psegment_delete_end = prove_by_refinement(
4516 `!G m e. (psegment G) /\ (endpoint G m) /\ (G e) /\
4517 (closure top2 e (pointI m)) /\ (~(G = {e})) ==>
4518 (endpoint (G DELETE e) =
4519 (((other_end e m) INSERT (endpoint G)) DELETE m))`,
4523 TYPE_THEN `FINITE G` SUBGOAL_TAC;
4524 ASM_MESON_TAC[psegment;segment];
4526 TYPE_THEN `edge e` SUBGOAL_TAC;
4527 ASM_MESON_TAC[psegment;segment;ISUBSET];
4529 TYPE_THEN `X = {m | closure top2 e (pointI m)}` ABBREV_TAC;
4530 TYPE_THEN `X HAS_SIZE 2` SUBGOAL_TAC;
4532 IMATCH_MP_TAC two_endpoint;
4535 IMATCH_MP_TAC SUBSET_ANTISYM;
4537 REWRITE_TAC[endpoint;ISUBSET;INSERT;];
4539 ASM_SIMP_TAC[num_closure_delete];
4540 REWRITE_TAC[DELETE];
4541 TYPE_THEN `x = m` ASM_CASES_TAC;
4543 USE 1 (REWRITE_RULE[endpoint]);
4547 TYPE_THEN `x = other_end e m` ASM_CASES_TAC;
4552 TYPE_THEN `X x /\ X m /\ X (other_end e m) /\ (~(m= other_end e m))` SUBGOAL_TAC ;
4555 ASM_MESON_TAC[other_end_prop];
4557 ASM_MESON_TAC[two_exclusion];
4560 REWRITE_TAC[SUBSET;endpoint;DELETE_INSERT];
4561 ASM_SIMP_TAC[other_end_prop];
4562 ASM_SIMP_TAC[num_closure_delete];
4563 REWRITE_TAC[INSERT;DELETE ];
4565 TYPE_THEN `(?m. (closure top2 e (pointI m)) /\ (midpoint G m))` SUBGOAL_TAC;
4566 ASM_MESON_TAC[psegment;midpoint_exists];
4567 DISCH_THEN CHOOSE_TAC;
4568 DISCH_THEN DISJ_CASES_TAC;
4571 TYPE_THEN `X m /\ X m' /\ X x /\ (~(x = m)) /\ (~(m' = m)) /\ (~(x = m'))` SUBGOAL_TAC;
4574 ASM_MESON_TAC[mid_end_disj];
4575 ASM_MESON_TAC[two_exclusion];
4576 USE 10 (REWRITE_RULE[endpoint]);
4579 ASM_SIMP_TAC[other_end_prop];
4580 TYPE_THEN `X m /\ X m' /\ X x /\ (~(x = m)) /\ (~(m = m'))` SUBGOAL_TAC;
4583 ASM_SIMP_TAC[other_end_prop];
4584 ASM_MESON_TAC[mid_end_disj];
4586 TYPE_THEN `x = m'` SUBGOAL_TAC;
4587 ASM_MESON_TAC[two_exclusion];
4588 USE 9 (REWRITE_RULE[midpoint]);
4589 ASM_MESON_TAC[ARITH_RULE `(x = 2) ==> (x -| 1 = 1)`];
4593 let endpoint_size2 = prove_by_refinement(
4594 `!G. (psegment G) ==> (endpoint G HAS_SIZE 2)`,
4597 TYPE_THEN `(!n G. (psegment G) /\ (G HAS_SIZE n) ==> (endpoint G HAS_SIZE 2)) ==> (!G. (psegment G) ==> endpoint G HAS_SIZE 2)` SUBGOAL_TAC;
4600 TYPE_THEN `?n. G HAS_SIZE n` SUBGOAL_TAC;
4601 REWRITE_TAC[HAS_SIZE];
4602 CONV_TAC (dropq_conv "n");
4603 ASM_MESON_TAC[psegment;segment];
4604 DISCH_THEN CHOOSE_TAC;
4606 DISCH_THEN IMATCH_MP_TAC ;
4608 REWRITE_TAC[psegment;segment];
4609 ASM_MESON_TAC[HAS_SIZE_0];
4611 TYPE_THEN `(?m. (endpoint G m))` SUBGOAL_TAC;
4612 ASM_SIMP_TAC[psegment_endpoint];
4613 DISCH_THEN CHOOSE_TAC;
4614 TYPE_THEN `FINITE G` SUBGOAL_TAC ;
4615 ASM_MESON_TAC[psegment;segment];
4617 TYPE_THEN `?e. (G e /\ closure top2 e (pointI m))` SUBGOAL_TAC;
4618 USE 3 (REWRITE_RULE[endpoint]);
4619 USE 4 (MATCH_MP num_closure_size);
4620 TSPEC `(pointI m)` 4;
4622 USE 4 (MATCH_MP CARD_SING_CONV);
4623 USE 4(REWRITE_RULE[SING]);
4625 USE 4 (REWRITE_RULE[eq_sing]);
4627 DISCH_THEN CHOOSE_TAC;
4628 TYPE_THEN `G = {e}` ASM_CASES_TAC;
4629 TYPE_THEN `endpoint G = { m | closure top2 e (pointI m)}` SUBGOAL_TAC;
4630 MATCH_MP_TAC EQ_EXT;
4631 REWRITE_TAC[endpoint];
4632 USE 4 (MATCH_MP num_closure_size );
4636 USE 4 (REWRITE_RULE[INR IN_SING]);
4640 USE 4 (MATCH_MP CARD_SING_CONV);
4641 USE 4(REWRITE_RULE[SING;eq_sing]);
4644 TYPE_THEN `{C | (C = e) /\ closure top2 C (pointI x)} ={e}` SUBGOAL_TAC;
4645 IMATCH_MP_TAC EQ_EXT;
4646 REWRITE_TAC[INR IN_SING ];
4650 USE 4 (REWRITE_RULE[HAS_SIZE]);
4651 ASM_MESON_TAC[CARD_SING;SING];
4653 IMATCH_MP_TAC two_endpoint;
4654 ASM_MESON_TAC[psegment;segment;ISUBSET];
4657 TYPE_THEN `edge e` SUBGOAL_TAC;
4658 ASM_MESON_TAC[psegment;segment;ISUBSET];
4660 TSPEC `G DELETE e` 0;
4661 TYPE_THEN `psegment (G DELETE e) /\ G DELETE e HAS_SIZE n` SUBGOAL_TAC;
4663 REWRITE_TAC[psegment];
4665 IMATCH_MP_TAC segment_delete;
4666 TYPE_THEN `m` EXISTS_TAC;
4667 ASM_REWRITE_TAC[psegment];
4668 ASM_MESON_TAC[psegment];
4669 (* it isn't a rectagon if it has an endpoint *)
4670 TYPE_THEN `(endpoint (G DELETE e) (other_end e m)) ` SUBGOAL_TAC;
4671 ASM_SIMP_TAC[psegment_delete_end];
4672 REWRITE_TAC[DELETE_INSERT];
4674 ASM_MESON_TAC[other_end_prop];
4675 REWRITE_TAC[INSERT];
4676 ASM_MESON_TAC[rectagon_endpoint];
4678 REWRITE_TAC[HAS_SIZE];
4679 ASM_MESON_TAC[SUC_INJ;FINITE_DELETE_IMP;CARD_SUC_DELETE];
4683 ASM_SIMP_TAC[psegment_delete_end];
4685 TYPE_THEN `G' = (other_end e m INSERT endpoint G)` ABBREV_TAC;
4686 TYPE_THEN `G' HAS_SIZE 3` SUBGOAL_TAC;
4688 REWRITE_TAC[HAS_SIZE;ARITH_RULE `3 = SUC 2`;FINITE_DELETE];
4689 TYPE_THEN `G' m` SUBGOAL_TAC;
4692 ASM_REWRITE_TAC [INSERT];
4693 ASM_MESON_TAC[CARD_SUC_DELETE];
4696 REWRITE_TAC[HAS_SIZE;FINITE_INSERT];
4699 ASM_SIMP_TAC [CARD_CLAUSES];
4701 TYPE_THEN `(?m. (closure top2 e (pointI m)) /\ (midpoint G m))` SUBGOAL_TAC;
4702 IMATCH_MP_TAC midpoint_exists;
4703 ASM_MESON_TAC[psegment];
4704 DISCH_THEN CHOOSE_TAC;
4705 TYPE_THEN `X = { m | closure top2 e (pointI m) }` ABBREV_TAC;
4706 TYPE_THEN `X HAS_SIZE 2` SUBGOAL_TAC;
4707 USE 7 (MATCH_MP two_endpoint);
4711 TYPE_THEN `X m /\ X m' /\ X (other_end e m) /\ (~(m=m')) /\ (~(m= other_end e m)) /\ (~(m'=other_end e m))` SUBGOAL_TAC;
4714 ASM_SIMP_TAC[other_end_prop];
4715 ASM_MESON_TAC [mid_end_disj];
4716 ASM_MESON_TAC[two_exclusion];
4721 let sing_has_size1 = prove_by_refinement(
4722 `!(x:A). {x} HAS_SIZE 1`,
4725 REWRITE_TAC[HAS_SIZE];
4728 REWRITE_TAC[FINITE_SING ];
4729 ASM_MESON_TAC[CARD_SING;SING];
4733 let num_closure1 = prove_by_refinement(
4734 `!G x. (FINITE G) ==>
4735 ((num_closure G (x) = 1) <=>
4736 (?e. (!e'. (G e' /\ (closure top2 e' (x))) <=> (e = e'))))`,
4741 USE 0 (MATCH_MP (num_closure_size));
4743 TYPE_THEN `t = num_closure G x` ABBREV_TAC;
4747 USE 0 (MATCH_MP CARD_SING_CONV);
4748 USE 0 (REWRITE_RULE[SING;eq_sing]);
4750 TYPE_THEN `x'` EXISTS_TAC;
4754 TYPE_THEN `{C | G C /\ closure top2 C x} = {e}` SUBGOAL_TAC;
4755 REWRITE_TAC[eq_sing];
4759 TYPE_THEN `e` (fun t -> ASSUME_TAC (ISPEC t sing_has_size1));
4762 REWRITE_TAC [HAS_SIZE];
4768 (* ------------------------------------------------------------------ *)
4770 (* ------------------------------------------------------------------ *)
4774 let inductive_set = jordan_def `inductive_set G S <=>
4777 (!C C'. S C /\ G C' /\ adj C C' ==> S C')`;;
4779 let inductive_univ = prove_by_refinement(
4780 `!G. (~(G = EMPTY )) ==> (inductive_set G G)`,
4783 REWRITE_TAC[inductive_set];
4785 ASM_REWRITE_TAC[SUBSET_REFL];
4790 let inductive_inter = prove_by_refinement(
4791 `!T G. (T SUBSET G) /\ (~(T = EMPTY )) ==>
4793 (INTERS {S | (T SUBSET S) /\ (inductive_set G S)}))`,
4797 ONCE_REWRITE_TAC[inductive_set];
4799 IMATCH_MP_TAC INTERS_SUBSET2;
4800 TYPE_THEN `G` EXISTS_TAC;
4801 ASM_REWRITE_TAC[SUBSET_REFL];
4802 IMATCH_MP_TAC inductive_univ;
4804 REWRITE_TAC[EMPTY_EXISTS];
4805 ASM_MESON_TAC[ISUBSET];
4807 USE 1 (REWRITE_RULE[EMPTY_EXISTS]);
4809 REWRITE_TAC[EMPTY_EXISTS];
4810 TYPE_THEN `u` EXISTS_TAC;
4811 REWRITE_TAC[INTERS];
4813 ASM_MESON_TAC[ISUBSET];
4815 USE 2 (REWRITE_RULE[INTERS]);
4816 REWRITE_TAC[INTERS];
4820 ASM_MESON_TAC[inductive_set];
4824 let segment_of = jordan_def `segment_of G e =
4825 INTERS { S | S e /\ inductive_set G S }`;;
4827 let inductive_segment = prove_by_refinement(
4828 `!G e. (G e) ==> (inductive_set G (segment_of G e))`,
4832 REWRITE_TAC[segment_of];
4833 ASSUME_TAC inductive_inter;
4834 TYPEL_THEN [`{e}`;`G`] (USE 1 o ISPECL);
4835 USE 1 (REWRITE_RULE[single_subset;EMPTY_EXISTS;INR IN_SING ]);
4837 DISCH_THEN IMATCH_MP_TAC ;
4842 let segment_of_G = prove_by_refinement(
4843 `!G e. (G e) ==> (segment_of G e ) SUBSET G`,
4846 REWRITE_TAC[segment_of];
4848 IMATCH_MP_TAC (INR INTERS_SUBSET2 );
4849 TYPE_THEN `G` EXISTS_TAC;
4850 ASM_REWRITE_TAC[SUBSET_REFL];
4851 IMATCH_MP_TAC inductive_univ;
4852 REWRITE_TAC [EMPTY_EXISTS];
4857 let segment_not_in = prove_by_refinement(
4858 `!G e. ~(G e) ==> (segment_of G e = UNIV)`,
4861 REWRITE_TAC[segment_of;];
4863 TYPE_THEN `{S | S e /\ inductive_set G S} = EMPTY ` SUBGOAL_TAC ;
4864 REWRITE_TAC[EQ_EMPTY];
4866 REWRITE_TAC[inductive_set];
4867 ASM_MESON_TAC[ISUBSET];
4872 let segment_of_finite = prove_by_refinement(
4873 `!G e. (FINITE G) /\ (G e) ==> (FINITE (segment_of G e))`,
4877 IMATCH_MP_TAC FINITE_SUBSET;
4878 ASM_MESON_TAC[segment_of_G];
4882 let segment_of_in = prove_by_refinement(
4883 `!G e. (segment_of G e e)`,
4887 TYPE_THEN `G e` ASM_CASES_TAC;
4888 REWRITE_TAC[segment_of;INTERS;inductive_set ];
4890 ASM_SIMP_TAC[segment_not_in];
4894 let segment_of_subset = prove_by_refinement(
4895 `!G e f. (G e) /\ (segment_of G e f) ==>
4896 (segment_of G f) SUBSET (segment_of G e)`,
4899 REWRITE_TAC[ISUBSET;segment_of;INTERS ];
4907 let inductive_diff = prove_by_refinement(
4908 `!G S S'. (inductive_set G S) /\
4909 (inductive_set G S') /\ ~(S DIFF S' = {}) ==>
4910 (inductive_set G (S DIFF S'))`,
4913 REWRITE_TAC[inductive_set;DIFF;SUBSET ];
4914 ASM_MESON_TAC[adj_symm];
4919 let subset_imp_eq = prove_by_refinement(
4920 `!A (B:A->bool). (A SUBSET B) /\ (B DIFF A = EMPTY) ==> (A = B)`,
4923 REWRITE_TAC[SUBSET;DIFF;EQ_EMPTY];
4928 let segment_of_eq = prove_by_refinement(
4929 `!G e f. (G e) /\ (segment_of G e f) ==>
4930 ((segment_of G e) = (segment_of G f))`,
4934 IMATCH_MP_TAC (GSYM subset_imp_eq);
4936 ASM_MESON_TAC[segment_of_subset];
4938 TYPE_THEN `G f` SUBGOAL_TAC;
4939 USE 0 (MATCH_MP segment_of_G);
4940 USE 0 (REWRITE_RULE[SUBSET]);
4943 TYPE_THEN `X = (segment_of G e DIFF segment_of G f)` ABBREV_TAC;
4944 TYPE_THEN `X e` SUBGOAL_TAC;
4947 ASM_SIMP_TAC [segment_of_in];
4950 USE 2 (REWRITE_RULE[EMPTY_EXISTS]);
4956 USE 2 (MATCH_MP segment_of_subset);
4957 ASM_MESON_TAC[ISUBSET]; (* done WITH X e *)
4959 TYPE_THEN `inductive_set G (segment_of G e DIFF segment_of G f)` SUBGOAL_TAC ;
4960 IMATCH_MP_TAC inductive_diff;
4961 ASM_SIMP_TAC[inductive_segment];
4963 TYPE_THEN `segment_of G e SUBSET X` SUBGOAL_TAC;
4964 REWRITE_TAC[segment_of];
4965 IMATCH_MP_TAC INTERS_SUBSET;
4969 REWRITE_TAC[SUBSET];
4971 TYPE_THEN `f` EXISTS_TAC;
4974 ASM_MESON_TAC[segment_of_in];
4978 let segment_of_segment = prove_by_refinement(
4979 `!G P e. (segment G) /\ (P SUBSET G) /\ (P e) ==>
4980 (segment (segment_of P e))`,
4984 TYPE_THEN `FINITE G` SUBGOAL_TAC;
4985 ASM_MESON_TAC[segment];
4987 TYPE_THEN `FINITE P` SUBGOAL_TAC;
4988 ASM_MESON_TAC[FINITE_SUBSET];
4990 REWRITE_TAC[segment];
4991 ASM_SIMP_TAC[segment_of_finite;EMPTY_EXISTS];
4993 ASM_MESON_TAC[segment_of_in];
4996 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
4997 ASM_MESON_TAC[segment];
4998 MP_TAC segment_of_G;
4999 REWRITE_TAC[SUBSET];
5002 ASSUME_TAC segment_of_G;
5006 REWRITE_TAC[INSERT];
5007 TYPEL_THEN [`P`;`e`] (USE 6 o ISPECL);
5010 USE 4 (MATCH_MP num_closure_mono);
5014 USE 1 (MATCH_MP num_closure_mono);
5015 TSPEC `(pointI m)` 1;
5018 REWRITE_TAC[segment];
5019 REWRITE_TAC[INSERT];
5029 (* IMATCH_MP_TAC subset_imp_eq; *)
5030 IMATCH_MP_TAC SUBSET_ANTISYM;
5032 (* PROOF_BY_CONTR_TAC; *)
5033 TYPE_THEN `! C C'. S C /\ P C' /\ adj C C' ==> S C'` SUBGOAL_TAC;
5035 TYPE_THEN `segment_of P C C'` SUBGOAL_TAC;
5036 REWRITE_TAC[segment_of;INTERS;];
5037 X_GEN_TAC `R:((num->real)->bool)->bool`;
5038 REWRITE_TAC[inductive_set];
5041 TYPE_THEN `segment_of P e = segment_of P C` SUBGOAL_TAC ;
5042 IMATCH_MP_TAC segment_of_eq;
5043 ASM_MESON_TAC[ISUBSET];
5044 DISCH_THEN (fun t-> REWRITE_TAC [GSYM t]);
5047 TYPE_THEN `inductive_set P S` SUBGOAL_TAC;
5048 REWRITE_TAC[inductive_set];
5049 ASM_REWRITE_TAC[EMPTY_EXISTS];
5050 ASM_MESON_TAC[ISUBSET;segment_of_G];
5051 TYPE_THEN `segment_of P e = segment_of P u` SUBGOAL_TAC;
5052 IMATCH_MP_TAC segment_of_eq;
5053 ASM_MESON_TAC[ISUBSET];
5056 REWRITE_TAC[segment_of];
5058 IMATCH_MP_TAC (INR INTERS_SUBSET);
5064 let rectagon_subset = prove_by_refinement(
5065 `!G S. (rectagon G) /\ (segment S) /\ (G SUBSET S) ==> (G = S)`,
5069 REWRITE_TAC[rectagon;segment];
5073 DISCH_THEN IMATCH_MP_TAC ;
5076 TYPE_THEN `edge C /\ edge C'` SUBGOAL_TAC;
5077 ASM_MESON_TAC[ISUBSET];
5079 TYPE_THEN `(?m. closure top2 C INTER closure top2 C' = {(pointI m)})` SUBGOAL_TAC;
5080 ASM_MESON_TAC[edge_inter];
5087 USE 5 (MATCH_MP num_closure_mono);
5089 TYPE_THEN `num_closure G (pointI m) = 2` SUBGOAL_TAC;
5091 USE 3 (REWRITE_RULE[INSERT]);
5093 DISCH_THEN DISJ_CASES_TAC;
5097 USE 0 (MATCH_MP num_closure_size);
5098 TSPEC `(pointI m)` 0;
5101 USE 0 (REWRITE_RULE[HAS_SIZE_0]);
5103 REWRITE_TAC[EMPTY_EXISTS ];
5105 REWRITE_TAC[INTER;eq_sing; ];
5108 TYPE_THEN `num_closure S (pointI m) = 2` SUBGOAL_TAC;
5110 USE 8(REWRITE_RULE[INSERT]);
5113 USE 3 (REWRITE_RULE[INSERT]);
5120 (* num_closure G = num_closure S, C' in latter, so in former *)
5121 TYPE_THEN `{C | G C /\ closure top2 C (pointI m)} = {C | S C /\ closure top2 C (pointI m)}` SUBGOAL_TAC;
5122 IMATCH_MP_TAC CARD_SUBSET_LE;
5124 IMATCH_MP_TAC FINITE_SUBSET;
5125 TYPE_THEN `S` EXISTS_TAC;
5126 ASM_REWRITE_TAC[SUBSET];
5130 REWRITE_TAC[SUBSET];
5132 USE 0 (MATCH_MP num_closure_size);
5134 USE 16 (MATCH_MP num_closure_size);
5135 TSPEC `pointI m` 16;
5138 ASM_REWRITE_TAC [HAS_SIZE];
5147 REWRITE_TAC[INTER;eq_sing];
5153 let rectagon_h_edge = prove_by_refinement(
5154 `!G. (rectagon G) ==> (?m. (G (h_edge m)))`,
5159 TYPE_THEN `!e. G e ==> (?m. (e= (v_edge m))) ` SUBGOAL_TAC;
5161 TYPE_THEN `edge e` SUBGOAL_TAC;
5162 ASM_MESON_TAC[rectagon;ISUBSET];
5164 DISCH_THEN (CHOOSE_THEN MP_TAC);
5165 DISCH_THEN DISJ_CASES_TAC;
5169 TYPE_THEN `X = {m | (G (v_edge m)) }` ABBREV_TAC;
5170 TYPE_THEN `FINITE X /\ ~(X = {})` SUBGOAL_TAC;
5172 TYPE_THEN `?C. C SUBSET X /\ FINITE C /\ (G = IMAGE (v_edge) C)` SUBGOAL_TAC ;
5173 IMATCH_MP_TAC finite_subset;
5174 REWRITE_TAC[IMAGE;SUBSET];
5181 ASM_MESON_TAC[rectagon];
5182 DISCH_THEN (CHOOSE_THEN MP_TAC);
5184 TYPE_THEN `C = X` SUBGOAL_TAC;
5185 IMATCH_MP_TAC SUBSET_ANTISYM;
5187 REWRITE_TAC[SUBSET];
5194 DISCH_THEN_REWRITE ;
5195 DISCH_THEN CHOOSE_TAC;
5196 USE 6 (REWRITE_RULE[v_edge_inj;h_edge_inj]);
5199 USE 0 (REWRITE_RULE[rectagon]);
5202 USE 5(REWRITE_RULE[EMPTY_EXISTS]);
5209 REWRITE_TAC[EMPTY_EXISTS];
5212 (* dwf done finite X ... Messed up. X must have type real->bool. *)
5213 TYPE_THEN `Y = IMAGE (real_of_int o SND ) X` ABBREV_TAC;
5214 TYPE_THEN ` FINITE Y /\ ~(Y = EMPTY)` SUBGOAL_TAC;
5217 IMATCH_MP_TAC FINITE_IMAGE;
5220 REWRITE_TAC[IMAGE;EMPTY_EXISTS ];
5221 CONV_TAC (dropq_conv "u");
5223 USE 4 (REWRITE_RULE[EMPTY_EXISTS]);
5227 USE 6 (MATCH_MP min_finite);
5229 TYPE_THEN `?m. (G (v_edge m)) /\ (real_of_int (SND m) = delta)` SUBGOAL_TAC;
5230 USE 5 (REWRITE_RULE[IMAGE;o_DEF]);
5239 (* now show that m is an endpoint *)
5240 TYPE_THEN `endpoint G m` SUBGOAL_TAC;
5241 REWRITE_TAC[endpoint];
5242 TYPE_THEN `FINITE G` SUBGOAL_TAC;
5243 ASM_MESON_TAC[rectagon];
5245 ASM_SIMP_TAC[num_closure1];
5246 TYPE_THEN `v_edge m` EXISTS_TAC;
5250 TYPE_THEN `edge e'` SUBGOAL_TAC;
5251 ASM_MESON_TAC[rectagon;ISUBSET];
5253 DISCH_THEN (CHOOSE_THEN MP_TAC);
5254 DISCH_THEN DISJ_CASES_TAC;
5255 ASM_REWRITE_TAC[v_edge_inj];
5257 USE 10 (REWRITE_RULE[v_edge_closure;vc_edge ;UNION;INR IN_SING ;plus_e12 ; pointI_inj; v_edge_pointI]);
5259 DISCH_THEN DISJ_CASES_TAC;
5261 TYPE_THEN ` Y (real_of_int (SND m'))` SUBGOAL_TAC;
5264 TYPE_THEN `m'` EXISTS_TAC;
5271 TSPEC `(real_of_int(SND m'))` 6;
5275 USE 6 (REWRITE_RULE[int_suc ]);
5276 ASM_MESON_TAC[REAL_ARITH `~(x + &.1 <= x)`];
5277 ASM_MESON_TAC[hv_edgeV2];
5282 REWRITE_TAC[v_edge_closure;vc_edge;UNION ;INR IN_SING ;];
5283 ASM_MESON_TAC[rectagon_endpoint];
5287 let rectagon_v_edge = prove_by_refinement(
5288 `!G. (rectagon G) ==> (?m. (G (v_edge m)))`,
5294 TYPE_THEN `!e. G e ==> (?m. (e= (h_edge m))) ` SUBGOAL_TAC;
5296 TYPE_THEN `edge e` SUBGOAL_TAC;
5297 ASM_MESON_TAC[rectagon;ISUBSET];
5299 DISCH_THEN (CHOOSE_THEN MP_TAC);
5300 DISCH_THEN DISJ_CASES_TAC;
5304 TYPE_THEN `X = {m | (G (h_edge m)) }` ABBREV_TAC;
5305 TYPE_THEN `FINITE X /\ ~(X = {})` SUBGOAL_TAC;
5307 TYPE_THEN `?C. C SUBSET X /\ FINITE C /\ (G = IMAGE (h_edge) C)` SUBGOAL_TAC ;
5308 IMATCH_MP_TAC finite_subset;
5309 REWRITE_TAC[IMAGE;SUBSET];
5316 ASM_MESON_TAC[rectagon];
5317 DISCH_THEN (CHOOSE_THEN MP_TAC);
5319 TYPE_THEN `C = X` SUBGOAL_TAC;
5320 IMATCH_MP_TAC SUBSET_ANTISYM;
5322 REWRITE_TAC[SUBSET];
5329 DISCH_THEN_REWRITE ;
5330 DISCH_THEN CHOOSE_TAC;
5331 USE 6 (REWRITE_RULE[h_edge_inj;v_edge_inj]);
5334 USE 0 (REWRITE_RULE[rectagon]);
5337 USE 5(REWRITE_RULE[EMPTY_EXISTS]);
5344 REWRITE_TAC[EMPTY_EXISTS];
5347 (* dwfx done finite X ... Messed up. X must have type real->bool. *)
5348 TYPE_THEN `Y = IMAGE (real_of_int o FST ) X` ABBREV_TAC;
5349 TYPE_THEN ` FINITE Y /\ ~(Y = EMPTY)` SUBGOAL_TAC;
5352 IMATCH_MP_TAC FINITE_IMAGE;
5355 REWRITE_TAC[IMAGE;EMPTY_EXISTS ];
5356 CONV_TAC (dropq_conv "u");
5358 USE 4 (REWRITE_RULE[EMPTY_EXISTS]);
5362 USE 6 (MATCH_MP min_finite);
5364 TYPE_THEN `?m. (G (h_edge m)) /\ (real_of_int (FST m) = delta)` SUBGOAL_TAC;
5365 USE 5 (REWRITE_RULE[IMAGE;o_DEF]);
5374 (* now show that m is an endpoint *)
5375 TYPE_THEN `endpoint G m` SUBGOAL_TAC;
5376 REWRITE_TAC[endpoint];
5377 TYPE_THEN `FINITE G` SUBGOAL_TAC;
5378 ASM_MESON_TAC[rectagon];
5380 ASM_SIMP_TAC[num_closure1];
5381 TYPE_THEN `h_edge m` EXISTS_TAC;
5385 TYPE_THEN `edge e'` SUBGOAL_TAC;
5386 ASM_MESON_TAC[rectagon;ISUBSET];
5388 DISCH_THEN (CHOOSE_THEN MP_TAC);
5389 IMATCH_MP_TAC (TAUT `((A \/ B) ==> C) ==> ((B \/ A) ==> C)`);
5390 DISCH_THEN DISJ_CASES_TAC;
5391 ASM_REWRITE_TAC[h_edge_inj];
5393 USE 10 (REWRITE_RULE[h_edge_closure;hc_edge ;UNION;INR IN_SING ;plus_e12 ; pointI_inj; h_edge_pointI]);
5395 DISCH_THEN DISJ_CASES_TAC;
5397 TYPE_THEN ` Y (real_of_int (FST m'))` SUBGOAL_TAC;
5400 TYPE_THEN `m'` EXISTS_TAC;
5407 TSPEC `(real_of_int(FST m'))` 6;
5411 USE 6 (REWRITE_RULE[int_suc ]);
5412 ASM_MESON_TAC[REAL_ARITH `~(x + &.1 <= x)`];
5413 ASM_MESON_TAC[hv_edgeV2];
5418 REWRITE_TAC[h_edge_closure;hc_edge;UNION ;INR IN_SING ;];
5419 ASM_MESON_TAC[rectagon_endpoint];
5425 let part_below = jordan_def `part_below G m =
5427 ((?n. (C = v_edge n) /\ (SND n <=: SND m) /\ (FST n = FST m)) \/
5428 (?n. (C = h_edge n) /\ (SND n <=: SND m) /\
5429 (closure top2 C (pointI (FST m,SND n))))) }`;;
5431 let part_below_h = prove_by_refinement(
5432 `!G m n. part_below G m (h_edge n) <=>
5433 (set_lower G m n) \/ (set_lower G (left m) n)`,
5438 REWRITE_TAC[part_below;set_lower;left ];
5439 REWRITE_TAC[h_edge_closure;hc_edge;UNION ;h_edge_pointI];
5440 REWRITE_TAC[hv_edgeV2;plus_e12;INR IN_SING ;pointI_inj ;PAIR_SPLIT ];
5441 REWRITE_TAC[h_edge_inj];
5442 CONV_TAC (dropq_conv "n'");
5443 REWRITE_TAC[INT_ARITH `(x = y+: &:1) <=> (x -: (&:1) = y)`];
5449 let part_below_v = prove_by_refinement(
5450 `!G m n. part_below G m (v_edge n) <=>
5451 (G (v_edge n)) /\ (FST n = FST m) /\ (SND n <=: SND m)`,
5455 REWRITE_TAC[part_below;v_edge_closure;vc_edge;UNION;plus_e12; INR IN_SING; pointI_inj ; PAIR_SPLIT; v_edge_inj; hv_edgeV2];
5461 let has_size_bij = prove_by_refinement(
5462 `!(A:A->bool) n. (A HAS_SIZE n) <=> (?f. BIJ f {m | m < n} A)`,
5468 USE 0 (MATCH_MP (INR HAS_SIZE_INDEX));
5470 REWRITE_TAC[BIJ;INJ ;SURJ ;];
5471 TYPE_THEN `f` EXISTS_TAC;
5473 USE 0 (REWRITE_RULE[EXISTS_UNIQUE_ALT]);
5475 DISCH_THEN CHOOSE_TAC;
5476 REWRITE_TAC[HAS_SIZE];
5477 ASSUME_TAC CARD_NUMSEG_LT;
5481 ASSUME_TAC FINITE_NUMSEG_LT;
5484 USE 0 (MATCH_MP FINITE_BIJ);
5487 IMATCH_MP_TAC (GSYM BIJ_CARD);
5488 TYPE_THEN `f` EXISTS_TAC;
5490 REWRITE_TAC[FINITE_NUMSEG_LT];
5494 let has_size_bij2 = prove_by_refinement(
5495 `!(A:A->bool) n. (A HAS_SIZE n) <=> (?f. BIJ f A {m | m < n})`,
5498 REWRITE_TAC[has_size_bij];
5501 DISCH_THEN CHOOSE_TAC;
5502 TYPE_THEN `INV f {m | m <| n} A` EXISTS_TAC;
5503 IMATCH_MP_TAC INVERSE_BIJ;
5505 DISCH_THEN CHOOSE_TAC;
5506 TYPE_THEN `INV f A {m | m <| n}` EXISTS_TAC;
5507 IMATCH_MP_TAC INVERSE_BIJ;
5512 let fibre_card = prove_by_refinement(
5513 `!(f:A->B) A B m n. (B HAS_SIZE n) /\ (IMAGE f A SUBSET B) /\
5514 (!b. (B b) ==> ({u | (A u) /\ (f u = b)} HAS_SIZE m)) ==>
5519 TYPE_THEN `!b. ?g. (B b) ==> (BIJ g {u | (A u) /\ (f u = b)} {j | j <| m})` SUBGOAL_TAC;
5523 REWRITE_TAC[GSYM has_size_bij2];
5530 DISJ_CASES_TAC (ARITH_RULE `(m=0) \/ 0 < m`);
5533 REWRITE_TAC[HAS_SIZE_0];
5535 USE 2 (REWRITE_RULE[HAS_SIZE_0]);
5536 USE 1 (REWRITE_RULE[IMAGE;ISUBSET ]);
5538 USE 5 (REWRITE_RULE[EMPTY_EXISTS]);
5540 USE 1 (CONV_RULE NAME_CONFLICT_CONV);
5541 USE 1 (CONV_RULE (dropq_conv "x''"));
5546 USE 2 (REWRITE_RULE[EQ_EMPTY]);
5548 TYPE_THEN `BIJ (\x. (f x, g (f x) x)) A {(x,y) | B x /\ {j|j <|m} y}` SUBGOAL_TAC;
5549 REWRITE_TAC[BIJ;INJ;SURJ];
5553 TYPE_THEN `f x` EXISTS_TAC;
5554 REWRITE_TAC[PAIR_SPLIT];
5555 CONV_TAC (dropq_conv "y");
5558 REWRITE_TAC[IMAGE;SUBSET];
5564 REWRITE_TAC[BIJ;SURJ];
5569 USE 8(REWRITE_RULE[PAIR_SPLIT]);
5573 TYPE_THEN `B (f y)` SUBGOAL_TAC;
5575 REWRITE_TAC [IMAGE;SUBSET];
5580 USE 3 (REWRITE_RULE[BIJ;INJ]);
5586 REWRITE_TAC[PAIR_SPLIT];
5587 CONV_TAC (dropq_conv "x'");
5593 DISCH_THEN_REWRITE ;
5604 USE 3 (REWRITE_RULE[BIJ;SURJ]);
5606 REWRITE_TAC[HAS_SIZE];
5609 TYPE_THEN `FINITE B /\ FINITE {j | j <| m}` SUBGOAL_TAC;
5610 ASM_REWRITE_TAC[FINITE_NUMSEG_LT];
5611 ASM_MESON_TAC[HAS_SIZE];
5614 USE 6 (MATCH_MP (INR FINITE_PRODUCT));
5617 USE 7 (MATCH_MP (INR CARD_PRODUCT));
5620 USE 5 (MATCH_MP FINITE_BIJ2);
5624 USE 5 (MATCH_MP BIJ_CARD);
5626 ASM_REWRITE_TAC[CARD_NUMSEG_LT];
5627 USE 0 (REWRITE_RULE[HAS_SIZE]);
5634 let even_card_even = prove_by_refinement(
5635 `!X (Y:A->bool). (FINITE X) /\ (FINITE Y) /\ (X INTER Y = EMPTY) ==>
5636 ((EVEN (CARD X) <=> EVEN (CARD Y)) <=> (EVEN (CARD (X UNION Y))))`,
5640 ASM_SIMP_TAC [CARD_UNION];
5641 REWRITE_TAC[EVEN_ADD];
5647 terminal edge: (endpoint G m) /\ (closure top2 e (pointI m))
5648 produce bij-MAP from terminal edges to endpoints (of P SUBSET G)
5649 2-1 MAP from terminal edges to segments.
5650 Hence an EVEN number of endpoints.
5656 let terminal_edge = jordan_def `terminal_edge G m =
5657 @e. (G e) /\ (closure top2 e (pointI m))`;;
5659 let terminal_endpoint = prove_by_refinement(
5660 `!G m. (FINITE G) /\ (endpoint G m) ==> ((G (terminal_edge G m)) /\
5661 (closure top2 (terminal_edge G m) (pointI m)) ) `,
5665 REWRITE_TAC[terminal_edge];
5668 ASM_MESON_TAC[endpoint_edge;EXISTS_UNIQUE_ALT];
5672 let terminal_unique = prove_by_refinement(
5673 `!G m e. (FINITE G) /\ (endpoint G m) ==>
5674 ( (G e) /\ (closure top2 e (pointI m)) <=> (e = terminal_edge G m))`,
5679 REWRITE_TAC[terminal_edge];
5681 USE 1(REWRITE_RULE[endpoint]);
5682 ASM_MESON_TAC[num_closure1];
5683 ASM_MESON_TAC[terminal_endpoint];
5684 ASM_MESON_TAC[terminal_endpoint];
5689 let segment_of_endpoint = prove_by_refinement(
5690 `!P e m. (P e) /\ (FINITE P) ==>
5692 (segment_of P (terminal_edge P m) = segment_of P e)
5694 endpoint (segment_of P e) m)`,
5698 TYPE_THEN `FINITE (segment_of P e)` SUBGOAL_TAC;
5699 IMATCH_MP_TAC FINITE_SUBSET;
5700 ASM_MESON_TAC[segment_of_G];
5706 REWRITE_TAC[endpoint];
5707 ASM_SIMP_TAC[num_closure1];
5710 TYPE_THEN `e'` EXISTS_TAC;
5713 USE 0 (MATCH_MP segment_of_G);
5714 ASM_MESON_TAC[ISUBSET];
5715 DISCH_THEN (fun t->REWRITE_TAC[GSYM t]);
5718 USE 5 (REWRITE_RULE[]);
5721 DISCH_THEN (fun t->REWRITE_TAC[GSYM t]);
5722 TSPEC `terminal_edge P m` 6;
5724 ASM_SIMP_TAC[terminal_endpoint];
5725 REWRITE_TAC[segment_of_in];
5730 REWRITE_TAC[endpoint];
5731 ASM_SIMP_TAC[num_closure1];
5734 TYPE_THEN `e'` EXISTS_TAC;
5737 TYPE_THEN `P e'' /\ closure top2 e'' (pointI m) ==> segment_of P e e''` SUBGOAL_TAC;
5741 USE 3 (REWRITE_RULE []);
5742 TYPE_THEN `e'' = e'` ASM_CASES_TAC;
5744 USE 0 (MATCH_MP inductive_segment);
5745 USE 0 (REWRITE_RULE[inductive_set]);
5748 TYPEL_THEN [`e'`;`e''`] (USE 9 o ISPECL);
5750 DISCH_THEN IMATCH_MP_TAC ;
5751 ASM_REWRITE_TAC[adj;EMPTY_EXISTS;];
5752 TYPE_THEN `pointI m` EXISTS_TAC;
5756 DISCH_THEN (fun t->REWRITE_TAC[GSYM t]);
5757 ASM_MESON_TAC[segment_of_G;ISUBSET ];
5758 (* I'm getting lost in the thickets *)
5761 IMATCH_MP_TAC (GSYM segment_of_eq);
5767 REWRITE_TAC[endpoint];
5768 ASM_SIMP_TAC[num_closure1];
5769 DISCH_THEN CHOOSE_TAC;
5770 DISCH_THEN CHOOSE_TAC;
5774 TYPE_THEN `e' = e''` SUBGOAL_TAC;
5776 USE 4 (REWRITE_RULE[]);
5777 ASM_MESON_TAC[segment_of_G;ISUBSET ];
5779 TSPEC `terminal_edge P m` 7;
5780 TYPE_THEN `e' = terminal_edge P m` SUBGOAL_TAC;
5781 ASM_MESON_TAC[terminal_endpoint];
5786 let fibre2 = prove_by_refinement(
5787 `!P G. (segment G) /\ (P SUBSET G) /\ (~(rectagon P)) ==>
5788 (!S. ({ S | (?e. (P e) /\ (S = segment_of P e)) } S) ==>
5789 ({m | (endpoint P m) /\ (segment_of P (terminal_edge P m) = S)}
5799 TYPE_THEN `psegment (segment_of P e)` SUBGOAL_TAC;
5800 REWRITE_TAC[psegment];
5802 ASM_MESON_TAC[rectagon_subset;segment_of_G;segment_of_segment];
5804 TYPE_THEN `segment_of P e = G` SUBGOAL_TAC;
5805 IMATCH_MP_TAC rectagon_subset;
5808 ASM_MESON_TAC[SUBSET_TRANS;segment_of_G];
5809 USE 3 (MATCH_MP segment_of_G);
5813 USE 1 (MATCH_MP SUBSET_ANTISYM);
5817 USE 4 (MATCH_MP endpoint_size2);
5818 TYPE_THEN `{m | endpoint P m /\ (segment_of P (terminal_edge P m) = segment_of P e)} = endpoint (segment_of P e)` SUBGOAL_TAC;
5819 IMATCH_MP_TAC EQ_EXT;
5823 IMATCH_MP_TAC segment_of_endpoint;
5825 IMATCH_MP_TAC FINITE_SUBSET;
5826 ASM_MESON_TAC[segment];
5832 let endpoint_even = prove_by_refinement(
5833 `!P G. (segment G) /\ (P SUBSET G) /\ (~(rectagon P)) ==>
5834 (endpoint P HAS_SIZE 2 *|
5835 (CARD {S | (?e. (P e) /\ (S = segment_of P e))}) )`,
5839 TYPE_THEN `f = (segment_of P) o (terminal_edge P)` ABBREV_TAC;
5840 TYPE_THEN `B = { S | (?e. (P e) /\ (S = segment_of P e)) }` ABBREV_TAC;
5841 TYPE_THEN `f` (fun t-> IMATCH_MP_TAC (ISPEC t fibre_card));
5842 TYPE_THEN `B` EXISTS_TAC;
5843 ASM_REWRITE_TAC[HAS_SIZE;IMAGE;SUBSET ; ];
5846 REWRITE_TAC[o_DEF ];
5848 TYPE_THEN `{S | ?e. P e /\ (S = segment_of P e)} = IMAGE (\x. (segment_of P x)) P` SUBGOAL_TAC;
5851 IMATCH_MP_TAC FINITE_IMAGE;
5852 IMATCH_MP_TAC FINITE_SUBSET ;
5853 ASM_MESON_TAC[segment];
5858 DISCH_THEN CHOOSE_TAC ;
5860 TYPE_THEN `terminal_edge P x'` EXISTS_TAC;
5862 TYPE_THEN `FINITE P` SUBGOAL_TAC;
5863 ASM_MESON_TAC[segment;FINITE_SUBSET];
5864 ASM_MESON_TAC[terminal_endpoint];
5866 REWRITE_TAC[GSYM HAS_SIZE];
5868 USE 6 (REWRITE_RULE[]);
5870 DISCH_THEN IMATCH_MP_TAC ;
5875 let num_closure0 = prove_by_refinement(
5877 FINITE G ==> ((num_closure G x = 0) <=>
5878 (!e. (G e) ==> (~(closure top2 e x))))`,
5882 USE 0 (MATCH_MP num_closure_size);
5887 USE 0 (REWRITE_RULE[HAS_SIZE_0;EQ_EMPTY ]);
5890 TYPE_THEN `{C | G C /\ closure top2 C x} = {}` SUBGOAL_TAC;
5892 USE 2 (REWRITE_RULE[EMPTY_EXISTS]);
5897 USE 0 (REWRITE_RULE[HAS_SIZE]);
5898 ASM_MESON_TAC[CARD_CLAUSES];
5902 let num_closure2 = prove_by_refinement(
5904 FINITE G ==> ((num_closure G x = 2) <=>
5905 (?a b. (~(a = b)) /\
5906 ((!e. (G e /\ closure top2 e x) <=> (( e= a)\/ (e =b))))))`,
5911 USE 0 (MATCH_MP num_closure_size);
5916 USE 0 (REWRITE_RULE[has_size2 ; ]);
5919 TYPE_THEN `a` EXISTS_TAC;
5920 TYPE_THEN `b` EXISTS_TAC;
5925 USE 2(REWRITE_RULE[INSERT]);
5930 TYPE_THEN `X = {C | G C /\ closure top2 C x} ` ABBREV_TAC;
5931 TYPE_THEN `(?a b. (X = {a, b}) /\ ~(a = b))` SUBGOAL_TAC;
5932 TYPE_THEN `a` EXISTS_TAC;
5933 TYPE_THEN `b` EXISTS_TAC;
5935 IMATCH_MP_TAC EQ_EXT;
5937 REWRITE_TAC[INSERT];
5942 USE 3 (REWRITE_RULE[GSYM has_size2]);
5943 RULE_ASSUM_TAC (REWRITE_RULE[HAS_SIZE]);
5949 let endpoint_subrectagon = prove_by_refinement(
5950 `!G P m. (rectagon G) /\ (P SUBSET G) ==>
5952 (?C C'. (P C) /\ (G C') /\ (~(P C')) /\ (~(C = C')) /\
5953 (closure top2 C (pointI m)) /\ (closure top2 C' (pointI m))))`,
5957 TYPE_THEN `FINITE G` SUBGOAL_TAC;
5958 ASM_MESON_TAC[rectagon];
5960 TYPE_THEN `FINITE P` SUBGOAL_TAC;
5961 IMATCH_MP_TAC FINITE_SUBSET;
5966 TYPE_THEN `midpoint G m` SUBGOAL_TAC;
5967 REWRITE_TAC[midpoint];
5968 USE 0 (REWRITE_RULE[rectagon;INSERT]);
5973 DISCH_THEN DISJ_CASES_TAC;
5975 USE 4 (REWRITE_RULE[endpoint]);
5977 USE 0 (MATCH_MP num_closure_mono);
5978 ASM_MESON_TAC[ARITH_RULE `~(1 <=| 0)`];
5979 REWRITE_TAC[midpoint];
5980 TYPE_THEN `FINITE G` SUBGOAL_TAC;
5981 ASM_MESON_TAC[rectagon];
5982 DISCH_THEN (MP_TAC o (MATCH_MP num_closure_size));
5986 USE 4 (REWRITE_RULE[endpoint]);
5988 ASM_SIMP_TAC[num_closure1];
5989 DISCH_THEN CHOOSE_TAC;
5990 TYPE_THEN `X = {C | G C /\ closure top2 C (pointI m)}` ABBREV_TAC;
5993 REWRITE_TAC[has_size2];
5994 DISCH_THEN CHOOSE_TAC;
5996 TYPE_THEN `X a /\ X b /\ X e` SUBGOAL_TAC;
5998 ASM_REWRITE_TAC[INSERT ];
6000 ASM_REWRITE_TAC[INSERT];
6004 USE 4(REWRITE_RULE[]);
6006 ASM_MESON_TAC[ISUBSET];
6008 TYPE_THEN `P e /\ (closure top2 e (pointI m))` SUBGOAL_TAC;
6012 TYPE_THEN `e` EXISTS_TAC;
6014 TYPE_THEN `G a /\ closure top2 a (pointI m) /\ G b /\ closure top2 b (pointI m)` SUBGOAL_TAC;
6020 TYPE_THEN `(e =a) \/ (e = b)` SUBGOAL_TAC;
6021 ASM_MESON_TAC[two_exclusion];
6022 DISCH_THEN DISJ_CASES_TAC;
6023 TYPE_THEN `b` EXISTS_TAC;
6025 TYPE_THEN `a` EXISTS_TAC;
6032 REWRITE_TAC[endpoint];
6034 REWRITE_TAC[rectagon;INSERT ];
6039 DISCH_THEN DISJ_CASES_TAC;
6040 USE 3 (MATCH_MP num_closure1);
6042 USE 0 (MATCH_MP num_closure2);
6047 TYPE_THEN `(C = a) \/ (C = b)` SUBGOAL_TAC;
6049 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
6050 ASM_MESON_TAC[ISUBSET];
6052 TYPE_THEN `(C' = a) \/ (C' = b)` SUBGOAL_TAC;
6054 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
6055 ASM_MESON_TAC[ISUBSET];
6057 TYPE_THEN `C` EXISTS_TAC;
6063 TYPE_THEN `G e'` SUBGOAL_TAC;
6076 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
6079 USE 0(MATCH_MP num_closure0);
6085 let part_below_finite = prove_by_refinement(
6086 `!G m. (FINITE G) ==> FINITE(part_below G m)`,
6090 IMATCH_MP_TAC FINITE_SUBSET;
6091 TYPE_THEN `G` EXISTS_TAC;
6092 ASM_REWRITE_TAC[part_below;ISUBSET ];
6097 let part_below_subset = prove_by_refinement(
6098 `!G m. (part_below G m) SUBSET G`,
6101 REWRITE_TAC[part_below;ISUBSET];
6106 let v_edge_cpoint = prove_by_refinement(
6107 `!m n. (closure top2 (v_edge m) (pointI n) <=>
6108 ((n = m) \/ (n = (FST m,SND m +: (&:1)))))`,
6112 REWRITE_TAC[v_edge_closure;vc_edge;UNION];
6113 REWRITE_TAC[v_edge_pointI;INR IN_SING ;plus_e12;pointI_inj];
6117 let h_edge_cpoint = prove_by_refinement(
6118 `!m n. (closure top2 (h_edge m) (pointI n) <=>
6119 ((n = m) \/ (n = (FST m +: (&:1),SND m ))))`,
6123 REWRITE_TAC[h_edge_closure;hc_edge;UNION];
6124 REWRITE_TAC[h_edge_pointI;INR IN_SING ;plus_e12;pointI_inj];
6128 let endpoint_lemma = prove_by_refinement(
6129 `!G m x. (rectagon G) /\
6130 (endpoint (part_below G m) x)
6133 ((C = v_edge m') \/ (C = h_edge m')) /\
6135 (!e. G e /\ closure top2 e (pointI x) <=> (e = C) \/ (e = C')) /\
6138 (part_below G m C) /\
6140 (~part_below G m C') /\
6142 (closure top2 C (pointI x)) /\
6143 (closure top2 C' (pointI x)) /\
6144 (part_below G m SUBSET G) /\
6145 (endpoint (part_below G m) x))
6150 TYPE_THEN `part_below G m SUBSET G` SUBGOAL_TAC;
6151 ASM_MESON_TAC[part_below_subset];
6158 SIMP_TAC[endpoint_subrectagon];
6161 DISCH_THEN (CHOOSE_THEN MP_TAC);
6162 DISCH_THEN (CHOOSE_THEN MP_TAC);
6164 USE 0 (REWRITE_RULE[rectagon;INSERT ]);
6169 DISCH_THEN DISJ_CASES_TAC;
6170 USE 0 (MATCH_MP num_closure2);
6176 TYPE_THEN `(C = a) \/ (C = b)` SUBGOAL_TAC;
6179 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
6180 ASM_MESON_TAC[ISUBSET];
6181 TYPE_THEN `(C' = a) \/ (C' = b)` SUBGOAL_TAC;
6185 TYPE_THEN `!e. G e /\ closure top2 e (pointI x) <=> ((e = C) \/ (e = C'))` SUBGOAL_TAC;
6200 TYPE_THEN `edge C /\ edge C'` SUBGOAL_TAC;
6201 ASM_MESON_TAC[ISUBSET;];
6203 USE 0 (REWRITE_RULE[edge]);
6205 DISCH_THEN CHOOSE_TAC;
6206 TYPE_THEN `C` EXISTS_TAC;
6207 TYPE_THEN `C'` EXISTS_TAC;
6208 TYPE_THEN `m'` EXISTS_TAC;
6211 USE 0 (MATCH_MP num_closure0);
6221 let endpoint_lemma_small_fst = prove_by_refinement(
6222 `!G m x. (rectagon G) /\ (endpoint (part_below G m) x) ==>
6223 (FST m <=: FST x +: &:1) `,
6230 USE 0 (MATCH_MP endpoint_lemma);
6236 REWRITE_TAC[INT_ARITH `x <=: z +: y <=> ~(z +: y <: x)`];
6238 (* setup complete *)
6240 DISCH_THEN DISJ_CASES_TAC;
6242 USE 6 (REWRITE_RULE[part_below_v]);
6244 USE 10 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6245 TYPE_THEN `FST x = FST m'` SUBGOAL_TAC;
6256 USE 6 (REWRITE_RULE[part_below_h ;set_lower ;left ;]);
6258 USE 10 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6259 TYPE_THEN `(FST x = FST m') \/ (FST x = FST m' +: (&:1))` SUBGOAL_TAC;
6261 TYPE_THEN `(FST m' = FST m) \/ (FST m' = FST m -: &:1)` SUBGOAL_TAC;
6269 (* identical proof to endpoint_lemma_small_fst *)
6270 let endpoint_lemma_big_fst = prove_by_refinement(
6271 `!G m x. (rectagon G) /\ (endpoint (part_below G m) x) ==>
6272 (FST x <=: FST m +: &:1) `,
6279 USE 0 (MATCH_MP endpoint_lemma);
6285 REWRITE_TAC[INT_ARITH `x <=: z +: y <=> ~(z +: y <: x)`];
6287 (* setup complete *)
6289 DISCH_THEN DISJ_CASES_TAC;
6291 USE 6 (REWRITE_RULE[part_below_v]);
6293 USE 10 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6294 TYPE_THEN `FST x = FST m'` SUBGOAL_TAC;
6305 USE 6 (REWRITE_RULE[part_below_h ;set_lower ;left ;]);
6307 USE 10 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6308 TYPE_THEN `(FST x = FST m') \/ (FST x = FST m' +: (&:1))` SUBGOAL_TAC;
6310 TYPE_THEN `(FST m' = FST m) \/ (FST m' = FST m -: &:1)` SUBGOAL_TAC;
6318 let endpoint_lemma_big_snd = prove_by_refinement(
6319 `!G m x. (rectagon G) /\ (endpoint (part_below G m) x) ==>
6320 (SND x <=: SND m +: &:1) `,
6327 USE 0 (MATCH_MP endpoint_lemma);
6333 REWRITE_TAC[INT_ARITH `x <=: z +: y <=> ~(z +: y <: x)`];
6335 (* setup complete *)
6337 DISCH_THEN DISJ_CASES_TAC;
6339 USE 6 (REWRITE_RULE[part_below_v]);
6341 USE 10 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6342 TYPE_THEN `(SND x = SND m') \/ (SND x = SND m' +: &:1)` SUBGOAL_TAC;
6351 USE 6 (REWRITE_RULE[part_below_h ;set_lower ;left ;]);
6353 USE 10 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6354 TYPE_THEN `SND x = SND m'` SUBGOAL_TAC;
6356 TYPE_THEN `(SND m' <=: SND m)` SUBGOAL_TAC;
6364 let endpoint_lemma_mid_fst = prove_by_refinement(
6365 `!G m x. (rectagon G) /\ (endpoint (part_below G m) x) ==>
6366 (FST x = FST m) ==> (SND x = SND m +: &:1) `,
6373 USE 0 (MATCH_MP endpoint_lemma);
6379 (* setup complete *)
6381 DISCH_THEN DISJ_CASES_TAC;
6383 USE 7 (REWRITE_RULE[part_below_v]);
6385 USE 11 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6386 TYPE_THEN `(SND x = SND m') \/ (SND x = SND m' +: &:1)` SUBGOAL_TAC;
6391 USE 3 (REWRITE_RULE[edge]);
6394 DISCH_THEN DISJ_CASES_TAC;
6396 USE 7 (REWRITE_RULE[part_below_v]);
6400 USE 9 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6401 TYPE_THEN `(FST m'' = FST m) /\ (FST x = FST m'')` SUBGOAL_TAC;
6411 USE 7 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6414 USE 9 (REWRITE_RULE[left ;set_lower;part_below_h]);
6416 TYPE_THEN `(FST x = FST m') ` SUBGOAL_TAC;
6434 USE 11(REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6435 USE 3(REWRITE_RULE[edge]);
6438 DISCH_THEN DISJ_CASES_TAC;
6440 USE 9(REWRITE_RULE[left ;set_lower;part_below_v;part_below_h]);
6447 USE 0(REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6449 USE 1 (MATCH_MP endpoint_lemma_big_snd );
6453 TYPE_THEN `G (h_edge m')` SUBGOAL_TAC;
6454 ASM_MESON_TAC[ISUBSET];
6457 USE 12 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6458 TYPE_THEN `SND x = SND m''` SUBGOAL_TAC;
6463 USE 7(REWRITE_RULE[left ;set_lower;part_below_v;part_below_h]);
6465 TYPE_THEN `SND m' <=: SND m` SUBGOAL_TAC;
6474 USE 9(REWRITE_RULE[left ;set_lower;part_below_v;part_below_h]);
6477 TYPE_THEN `SND x = SND m'` SUBGOAL_TAC;
6485 TYPE_THEN `(FST m'' = FST m) \/ (FST m'' = FST m -: &:1)` SUBGOAL_TAC;
6491 TYPE_THEN `~(SND m'' <=: SND m)` SUBGOAL_TAC;
6503 let endpoint_lemma_upper_left = prove_by_refinement(
6504 `!G m . (rectagon G) ==>
6505 ~(endpoint (part_below G m) (FST m -: &:1, SND m +: &:1))`,
6509 (* needs to be rewritten, template only *)
6511 TYPE_THEN `(! x. (rectagon G) /\ (endpoint (part_below G m) x) ==> ~(x = (FST m -: &:1, SND m +: &:1))) ==> (rectagon G ==> ~( endpoint (part_below G m) (FST m -: &:1,SND m +: &:1)))` SUBGOAL_TAC;
6513 DISCH_THEN IMATCH_MP_TAC ;
6516 USE 0 (MATCH_MP endpoint_lemma);
6523 DISCH_THEN DISJ_CASES_TAC;
6525 USE 6 (REWRITE_RULE[part_below_v]);
6527 USE 10 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6528 TYPE_THEN `FST m -: &:1 = FST m'` SUBGOAL_TAC;
6530 TYPE_THEN `FST m' = FST m` SUBGOAL_TAC;
6535 USE 6 (REWRITE_RULE[part_below_h ;set_lower ;left ;]);
6537 USE 10 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6538 TYPE_THEN `(SND m +: &:1 = SND m') /\ (SND m' <=: SND m)` SUBGOAL_TAC;
6545 let endpoint_lemma_upper_left = prove_by_refinement(
6546 `!G m . (rectagon G) ==>
6547 ~(endpoint (part_below G m) (FST m -: &:1, SND m +: &:1))`,
6551 (* needs to be rewritten, template only *)
6553 TYPE_THEN `(! x. (rectagon G) /\ (endpoint (part_below G m) x) ==> ~(x = (FST m -: &:1, SND m +: &:1))) ==> (rectagon G ==> ~( endpoint (part_below G m) (FST m -: &:1,SND m +: &:1)))` SUBGOAL_TAC;
6555 DISCH_THEN IMATCH_MP_TAC ;
6558 USE 0 (MATCH_MP endpoint_lemma);
6565 DISCH_THEN DISJ_CASES_TAC;
6567 USE 6 (REWRITE_RULE[part_below_v]);
6569 USE 10 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6570 TYPE_THEN `FST m -: &:1 = FST m'` SUBGOAL_TAC;
6572 TYPE_THEN `FST m' = FST m` SUBGOAL_TAC;
6577 USE 6 (REWRITE_RULE[part_below_h ;set_lower ;left ;]);
6579 USE 10 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6580 TYPE_THEN `(SND m +: &:1 = SND m') /\ (SND m' <=: SND m)` SUBGOAL_TAC;
6587 let endpoint_lemma_upper_right = prove_by_refinement(
6588 `!G m . (rectagon G) ==>
6589 ~(endpoint (part_below G m) (FST m +: &:1, SND m +: &:1))`,
6593 (* needs to be rewritten, template only *)
6595 TYPE_THEN `(! x. (rectagon G) /\ (endpoint (part_below G m) x) ==> ~(x = (FST m +: &:1, SND m +: &:1))) ==> (rectagon G ==> ~( endpoint (part_below G m) (FST m +: &:1,SND m +: &:1)))` SUBGOAL_TAC;
6597 DISCH_THEN IMATCH_MP_TAC ;
6600 USE 0 (MATCH_MP endpoint_lemma);
6607 DISCH_THEN DISJ_CASES_TAC;
6609 USE 6 (REWRITE_RULE[part_below_v]);
6611 USE 10 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6612 TYPE_THEN `FST m +: &:1 = FST m'` SUBGOAL_TAC;
6614 TYPE_THEN `FST m' = FST m` SUBGOAL_TAC;
6619 USE 6 (REWRITE_RULE[part_below_h ;set_lower ;left ;]);
6621 USE 10 (REWRITE_RULE[h_edge_cpoint;PAIR_SPLIT]);
6622 TYPE_THEN `(SND m +: &:1 = SND m') /\ (SND m' <=: SND m)` SUBGOAL_TAC;
6629 let endpoint_lemma_summary = prove_by_refinement(
6630 `!G m x. (rectagon G) /\ (endpoint (part_below G m) x) ==>
6631 ((FST x = FST m -: &:1) /\ (SND x <=: SND m)) \/
6632 ((FST x = FST m +: &:1) /\ (SND x <=: SND m)) \/
6633 ((FST x = FST m) /\ (SND x = SND m +: &:1 )) `,
6636 (* USE int -arith to show cases of fst x, then for each give *)
6639 TYPE_THEN `(FST x < FST m -: &:1) \/ (FST x = FST m -: &:1) \/ (FST x = FST m ) \/ (FST x = FST m +: &:1) \/ (FST m +: &:1 <: FST x )` SUBGOAL_TAC;
6642 USE 0 (MATCH_MP endpoint_lemma_small_fst);
6650 USE 0 (MATCH_MP endpoint_lemma_big_snd);
6651 IMATCH_MP_TAC (INT_ARITH `x <=: m+ &:1 /\ ~(x = m + &:1) ==> ( x <=: m)`);
6655 TYPE_THEN `x = (FST m -: &:1, SND m + &:1)` SUBGOAL_TAC;
6656 ASM_REWRITE_TAC[PAIR_SPLIT];
6659 ASM_MESON_TAC[endpoint_lemma_upper_left];
6660 USE 0 (MATCH_MP endpoint_lemma_mid_fst);
6666 USE 0 (MATCH_MP endpoint_lemma_big_snd);
6667 IMATCH_MP_TAC (INT_ARITH `x <=: m+ &:1 /\ ~(x = m + &:1) ==> ( x <=: m)`);
6671 TYPE_THEN `x = (FST m +: &:1, SND m + &:1)` SUBGOAL_TAC;
6672 ASM_REWRITE_TAC[PAIR_SPLIT];
6675 ASM_MESON_TAC[endpoint_lemma_upper_right];
6676 USE 0 (MATCH_MP endpoint_lemma_big_fst);
6684 let terminal_case1 = prove_by_refinement(
6685 `!G m n x. (rectagon G) /\ (endpoint (part_below G m) x) /\
6686 (closure top2 (h_edge n) (pointI x)) /\ (set_lower G m n ) ==>
6690 REWRITE_TAC[h_edge_cpoint; set_lower];
6692 USE 2 (REWRITE_RULE[PAIR_SPLIT]);
6694 DISCH_THEN DISJ_CASES_TAC;
6695 TYPE_THEN `FST x = FST m` SUBGOAL_TAC;
6699 USE 0 (MATCH_MP endpoint_lemma_mid_fst);
6705 TYPE_THEN `FST x = FST m +: &:1` SUBGOAL_TAC;
6707 REWRITE_TAC[PAIR_SPLIT;right ];
6712 let terminal_case2 = prove_by_refinement(
6713 `!G m n x. (rectagon G) /\ (endpoint (part_below G m) x) /\
6714 (closure top2 (h_edge n) (pointI x)) /\
6715 (set_lower G (left m) n ) ==>
6719 REWRITE_TAC[h_edge_cpoint; set_lower ];
6721 USE 2 (REWRITE_RULE[PAIR_SPLIT]);
6723 DISCH_THEN DISJ_CASES_TAC;
6724 ASM_REWRITE_TAC[PAIR_SPLIT];
6725 TYPE_THEN `FST x = FST m` SUBGOAL_TAC;
6732 USE 0 (MATCH_MP endpoint_lemma_mid_fst);
6744 let terminal_case_v = prove_by_refinement(
6745 `!G m n x. (rectagon G) /\ (endpoint (part_below G m) x) /\
6746 (closure top2 (v_edge n) (pointI x)) /\
6747 (part_below G m (v_edge n)) ==>
6748 (x = up m) /\ (m =n)`,
6751 REWRITE_TAC[part_below_v; v_edge_cpoint;];
6754 USE 2 (REWRITE_RULE[PAIR_SPLIT]);
6756 TYPE_THEN `FST x = FST m` SUBGOAL_TAC;
6760 REWRITE_TAC[PAIR_SPLIT; up ;];
6762 USE 0 (MATCH_MP endpoint_lemma_mid_fst);
6772 let inj_terminal = prove_by_refinement(
6773 `!G m. (rectagon G) ==>
6774 (INJ (terminal_edge (part_below G m))
6775 (endpoint (part_below G m)) UNIV)`,
6779 TYPE_THEN `FINITE (part_below G m)` SUBGOAL_TAC ;
6780 ASM_MESON_TAC[part_below_finite;rectagon];
6784 TYPE_THEN `e = terminal_edge (part_below G m) x` ABBREV_TAC;
6785 TYPE_THEN `closure top2 e (pointI x) /\ closure top2 e (pointI y)` SUBGOAL_TAC;
6786 ASM_MESON_TAC[terminal_endpoint];
6788 TYPE_THEN `(part_below G m) e` SUBGOAL_TAC;
6789 ASM_MESON_TAC[terminal_endpoint];
6791 TYPE_THEN `part_below G m SUBSET G` SUBGOAL_TAC;
6792 REWRITE_TAC[part_below;ISUBSET];
6795 TYPE_THEN `edge e` SUBGOAL_TAC;
6796 ASM_MESON_TAC[ISUBSET;rectagon];
6798 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC);
6799 TYPE_THEN `(x = up m) /\ (y = up m)` SUBGOAL_TAC;
6800 ASM_MESON_TAC[terminal_case_v];
6805 USE 4 (REWRITE_RULE[part_below_h ;]);
6808 DISCH_THEN DISJ_CASES_TAC;
6809 TYPE_THEN `(x = right m') /\ (y = right m')` SUBGOAL_TAC ;
6810 ASM_MESON_TAC[terminal_case1];
6812 TYPE_THEN `( x= m' ) /\ (y = m') ` SUBGOAL_TAC;
6813 ASM_MESON_TAC[terminal_case2];
6818 (* now start on surjectivity results *)
6820 let endpoint_criterion = prove_by_refinement(
6821 `!G m e. (FINITE G) /\
6822 (!e'. (G e' /\ (closure top2 e' (pointI m))) = (e = e')) ==>
6823 (endpoint G m) /\ (e = terminal_edge G m)`,
6828 REWRITE_TAC[endpoint;];
6829 ASM_SIMP_TAC[num_closure1];
6832 ASM_MESON_TAC[terminal_unique];
6836 let target_set = jordan_def `target_set G m =
6837 { e | (?n. (e = h_edge n) /\ (set_lower G m n)) \/
6838 (?n. (e = h_edge n) /\ (set_lower G (left m) n)) \/
6839 ((e = v_edge m) /\ G e)}`;;
6841 let target_set_subset = prove_by_refinement(
6842 `!G m. target_set G m SUBSET G`,
6845 REWRITE_TAC[ISUBSET;target_set;set_lower];
6850 let target_edge = prove_by_refinement(
6851 `!G m. target_set G m SUBSET edge`,
6854 REWRITE_TAC[target_set;edge;ISUBSET ];
6859 let target_h = prove_by_refinement(
6860 `!G m n. target_set G m (h_edge n) <=>
6861 (set_lower G m n) \/ (set_lower G (left m) n)`,
6865 REWRITE_TAC[target_set;h_edge_inj; hv_edgeV2;];
6870 let target_v = prove_by_refinement(
6871 `!G m n. target_set G m (v_edge n) <=>
6872 (n = m) /\ G (v_edge n)`,
6876 REWRITE_TAC[target_set;hv_edgeV2;v_edge_inj;];
6880 let part_below_subset = prove_by_refinement(
6881 `!G m. (part_below G m SUBSET G)`,
6884 REWRITE_TAC[part_below;ISUBSET];
6889 let part_below_finite = prove_by_refinement(
6890 `!G m. (FINITE G ==> FINITE (part_below G m))`,
6894 IMATCH_MP_TAC FINITE_SUBSET;
6895 TYPE_THEN `G` EXISTS_TAC;
6896 ASM_REWRITE_TAC[part_below_subset];
6900 let terminal_edge_image = prove_by_refinement(
6901 `!G m x. (rectagon G) /\ (endpoint (part_below G m) x) ==>
6902 (target_set G m (terminal_edge (part_below G m) x))`,
6906 TYPE_THEN `FINITE G` SUBGOAL_TAC;
6907 ASM_MESON_TAC[rectagon];
6910 USE 2 ( MATCH_MP part_below_finite);
6912 REWRITE_TAC[target_set];
6913 TYPE_THEN `e = terminal_edge (part_below G m) x` ABBREV_TAC;
6914 TYPE_THEN `(part_below G m e) /\ (closure top2 e (pointI x))` SUBGOAL_TAC;
6915 ASM_MESON_TAC[terminal_endpoint];
6917 TYPE_THEN `edge e` SUBGOAL_TAC;
6918 ASM_MESON_TAC[part_below_subset;ISUBSET;rectagon];
6920 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC);
6921 ASM_REWRITE_TAC[hv_edgeV2;v_edge_inj];
6923 USE 5 (REWRITE_RULE[part_below_v]);
6924 ASM_REWRITE_TAC[PAIR_SPLIT ];
6926 USE 6 (REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT]);
6927 TYPE_THEN `FST x = FST m'` SUBGOAL_TAC;
6931 TYPE_THEN `SND x = SND m +: &:1` SUBGOAL_TAC;
6932 ASM_MESON_TAC[endpoint_lemma_mid_fst];
6939 ASM_REWRITE_TAC[hv_edgeV2;h_edge_inj;];
6941 USE 5(REWRITE_RULE[part_below_h ]);
6946 let terminal_edge_surj = prove_by_refinement(
6947 `!G m e. (rectagon G) /\ (target_set G m e) ==>
6948 (?x. (endpoint (part_below G m) x) /\
6949 (e = terminal_edge (part_below G m) x))`,
6953 TYPE_THEN `FINITE G` SUBGOAL_TAC;
6954 ASM_MESON_TAC[rectagon];
6956 TYPE_THEN `FINITE (part_below G m)` SUBGOAL_TAC;
6957 ASM_MESON_TAC[part_below_finite];
6959 TYPE_THEN `(part_below G m) SUBSET G` SUBGOAL_TAC;
6960 ASM_MESON_TAC[part_below_subset];
6962 TYPE_THEN `edge e` SUBGOAL_TAC;
6963 ASM_MESON_TAC[target_edge;ISUBSET];
6965 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC);
6967 USE 1(REWRITE_RULE[target_v]);
6972 TYPE_THEN `up m` EXISTS_TAC;
6973 IMATCH_MP_TAC endpoint_criterion;
6978 TYPE_THEN `edge e'` SUBGOAL_TAC;
6979 ASM_MESON_TAC[ISUBSET;rectagon];
6981 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC);
6983 USE 6 (REWRITE_RULE[part_below_v]);
6984 ASM_REWRITE_TAC [v_edge_inj;PAIR_SPLIT];
6986 USE 7(REWRITE_RULE[v_edge_cpoint;PAIR_SPLIT;up;]);
6993 USE 6 (REWRITE_RULE[part_below_h;set_lower;left ;]);
6994 TYPE_THEN `SND m' <=: SND m` SUBGOAL_TAC;
6998 USE 7(REWRITE_RULE[h_edge_cpoint; up; PAIR_SPLIT ]);
7005 ASM_REWRITE_TAC [part_below_v;v_edge_cpoint;up];
7007 (* half-on-proof , hedge *)
7010 USE 1(REWRITE_RULE[target_h]);
7012 DISCH_THEN (DISJ_CASES_TAC); (* split LEFT and RIGHT H *)
7013 TYPE_THEN `right m'` EXISTS_TAC;
7014 IMATCH_MP_TAC endpoint_criterion;
7019 TYPE_THEN `edge e'` SUBGOAL_TAC;
7020 ASM_MESON_TAC[ISUBSET;rectagon];
7022 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC); (* snd H or v *)
7024 USE 6 (REWRITE_RULE[part_below_v]);
7026 USE 7(REWRITE_RULE[v_edge_cpoint;right ;PAIR_SPLIT; ]);
7027 REWRITE_TAC[h_edge_inj;hv_edgeV2;];
7028 USE 1 (REWRITE_RULE[set_lower]);
7029 ASM_MESON_TAC[INT_ARITH `~(x +: &:1 = x)`];
7030 ASM_REWRITE_TAC [h_edge_inj;PAIR_SPLIT ]; (* snd H *)
7033 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE [t]));
7034 RULE_ASSUM_TAC (REWRITE_RULE[part_below_h;h_edge_cpoint;PAIR_SPLIT;right ]);
7036 DISCH_THEN DISJ_CASES_TAC;
7037 RULE_ASSUM_TAC (REWRITE_RULE[set_lower]);
7039 RULE_ASSUM_TAC (REWRITE_RULE[set_lower;left ]);
7047 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
7048 REWRITE_TAC[part_below_h;h_edge_cpoint;right ];
7051 (* finally LEFT case: now everything needs to have an endpoint *)
7053 USE 1 (REWRITE_RULE[set_lower;left ]);
7054 TYPE_THEN ` m'` EXISTS_TAC ; (* was left m *)
7055 IMATCH_MP_TAC endpoint_criterion;
7060 TYPE_THEN `edge e'` SUBGOAL_TAC;
7061 ASM_MESON_TAC[rectagon;ISUBSET];
7063 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC);
7066 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
7067 RULE_ASSUM_TAC (REWRITE_RULE[part_below_v;v_edge_cpoint;left ;PAIR_SPLIT ;]);
7075 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
7076 RULE_ASSUM_TAC (REWRITE_RULE[part_below_h;h_edge_cpoint;left ;PAIR_SPLIT ;]);
7078 DISCH_THEN DISJ_CASES_TAC;
7079 USE 5(REWRITE_RULE[set_lower]);
7085 USE 5 (REWRITE_RULE[set_lower]);
7086 REWRITE_TAC[h_edge_inj;PAIR_SPLIT;];
7091 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
7092 ASM_REWRITE_TAC[part_below_h;h_edge_cpoint; set_lower; left ];
7097 let inj_subset = prove_by_refinement(
7098 `!t t' s (f:A->B). (INJ f s t') /\ (t SUBSET t') /\
7099 (IMAGE f s SUBSET t) ==> (INJ f s t)`,
7102 REWRITE_TAC[INJ;IMAGE;SUBSET ];
7107 let terminal_edge_bij = prove_by_refinement(
7108 `!G m. (rectagon G) ==>
7109 (BIJ (terminal_edge (part_below G m))
7110 (endpoint (part_below G m)) (target_set G m))`,
7116 IMATCH_MP_TAC inj_subset;
7117 TYPE_THEN `UNIV:((num->real)->bool)->bool` EXISTS_TAC;
7118 ASM_SIMP_TAC[inj_terminal];
7119 REWRITE_TAC[IMAGE;SUBSET];
7120 ASM_MESON_TAC[terminal_edge_image];
7121 REWRITE_TAC[INJ;SURJ];
7124 ASM_MESON_TAC[terminal_edge_surj];
7128 let target_set_finite = prove_by_refinement(
7129 `!G m. (FINITE G) ==> (FINITE (target_set G m))`,
7133 IMATCH_MP_TAC FINITE_SUBSET;
7134 TYPE_THEN `G` EXISTS_TAC;
7135 ASM_MESON_TAC[target_set_subset];
7139 let rectagon_endpoint0 = prove_by_refinement(
7140 `!G. (rectagon G) ==> ((endpoint G) HAS_SIZE 0)`,
7144 TYPE_THEN `endpoint G = {}` SUBGOAL_TAC;
7145 REWRITE_TAC[EQ_EMPTY];
7146 ASM_MESON_TAC[rectagon_endpoint];
7148 ASM_MESON_TAC[HAS_SIZE_0];
7152 let target_set_even = prove_by_refinement(
7153 `!G m. (rectagon G) ==> (EVEN (CARD (target_set G m)))`,
7157 TYPE_THEN `CARD (endpoint(part_below G m)) = CARD (target_set G m)` SUBGOAL_TAC;
7158 IMATCH_MP_TAC BIJ_CARD ;
7159 TYPE_THEN `terminal_edge (part_below G m)` EXISTS_TAC;
7160 ASM_SIMP_TAC[terminal_edge_bij];
7161 ASSUME_TAC terminal_edge_bij;
7162 TYPEL_THEN [`G`;`m`] (USE 1 o ISPECL);
7164 ASSUME_TAC target_set_finite;
7165 TYPEL_THEN [`G`;`m`] (USE 2 o ISPECL);
7166 ASM_MESON_TAC[FINITE_BIJ2;rectagon];
7167 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
7168 TYPE_THEN `rectagon (part_below G m)` ASM_CASES_TAC;
7169 TYPE_THEN `CARD (endpoint (part_below G m)) =0` SUBGOAL_TAC;
7170 ASM_MESON_TAC[HAS_SIZE;rectagon_endpoint0];
7172 TYPE_THEN `P = part_below G m` ABBREV_TAC ;
7173 TYPE_THEN `segment G /\ (P SUBSET G) /\ ~(rectagon P)` SUBGOAL_TAC;
7174 ASM_SIMP_TAC[rectagon_segment];
7175 ASM_MESON_TAC[part_below_subset];
7177 USE 3 (MATCH_MP endpoint_even );
7178 USE 3 (REWRITE_RULE[HAS_SIZE]);
7179 ASM_REWRITE_TAC[EVEN_DOUBLE];
7183 let bij_target_set = prove_by_refinement(
7184 `!G m. (rectagon G) /\ ~(G (v_edge m)) ==>
7185 (BIJ h_edge (set_lower G (left m) UNION (set_lower G m))
7194 REWRITE_TAC[target_set;set_lower;UNION;h_edge_inj;hv_edgeV2; ];
7196 REWRITE_TAC[h_edge_inj;];
7198 REWRITE_TAC[INJ;SURJ];
7201 REWRITE_TAC[target_set;set_lower;UNION;];
7214 let bij_target_set_odd = prove_by_refinement(
7215 `!G m. (rectagon G) /\ (G (v_edge m)) ==>
7216 (BIJ h_edge (set_lower G (left m) UNION
7218 (target_set G m DELETE (v_edge m)))`,
7226 REWRITE_TAC[target_set;set_lower;UNION;h_edge_inj;hv_edgeV2; DELETE ];
7228 REWRITE_TAC[h_edge_inj;];
7230 REWRITE_TAC[INJ;SURJ];
7233 REWRITE_TAC[target_set;set_lower;UNION;DELETE ];
7249 let target_set_odd = prove_by_refinement(
7250 `!G m. (rectagon G) /\ (G (v_edge m)) ==>
7251 ~(EVEN(CARD (target_set G m DELETE (v_edge m))))`,
7254 REWRITE_TAC[GSYM EVEN];
7256 TYPE_THEN `FINITE (target_set G m)` SUBGOAL_TAC;
7257 ASM_MESON_TAC[target_set_finite;rectagon];
7259 TYPE_THEN `target_set G m (v_edge m)` SUBGOAL_TAC;
7260 ASM_REWRITE_TAC [target_v];
7262 TYPE_THEN `SUC (CARD (target_set G m DELETE (v_edge m))) = CARD (target_set G m )` SUBGOAL_TAC;
7263 IMATCH_MP_TAC CARD_SUC_DELETE;
7266 ASM_MESON_TAC[target_set_even];
7270 let squ_left_even = prove_by_refinement(
7271 `!G m. (rectagon G) /\ ~(G (v_edge m)) ==>
7272 ((even_cell G (squ (left m)) = even_cell G(squ m)))`,
7276 TYPE_THEN `FINITE G` SUBGOAL_TAC;
7277 ASM_MESON_TAC[rectagon];
7279 REWRITE_TAC[even_cell_squ;num_lower_set];
7280 TYPE_THEN `(EVEN (CARD (set_lower G (left m))) <=> EVEN (CARD (set_lower G m))) <=> (EVEN (CARD ((set_lower G (left m)) UNION (set_lower G m))))` SUBGOAL_TAC;
7281 IMATCH_MP_TAC even_card_even;
7282 ASM_SIMP_TAC[finite_set_lower];
7283 REWRITE_TAC[set_lower;INTER ;left ;EQ_EMPTY ];
7284 MESON_TAC[INT_ARITH `~(z = z -: &:1)`];
7286 TYPE_THEN `BIJ h_edge (set_lower G (left m) UNION (set_lower G m)) (target_set G m) ` SUBGOAL_TAC;
7287 ASM_MESON_TAC[bij_target_set];
7289 TYPE_THEN `CARD (set_lower G (left m) UNION (set_lower G m)) = CARD (target_set G m)` SUBGOAL_TAC;
7290 IMATCH_MP_TAC BIJ_CARD ;
7291 TYPE_THEN `h_edge` EXISTS_TAC;
7293 REWRITE_TAC[FINITE_UNION];
7294 ASM_MESON_TAC[finite_set_lower];
7296 ASM_MESON_TAC[target_set_even];
7300 let squ_left_odd = prove_by_refinement(
7301 `!G m. (rectagon G) /\ (G (v_edge m)) ==>
7302 (~(even_cell G (squ (left m)) = even_cell G(squ m)))`,
7306 TYPE_THEN `FINITE G` SUBGOAL_TAC;
7307 ASM_MESON_TAC[rectagon];
7310 REWRITE_TAC[even_cell_squ;num_lower_set];
7311 TYPE_THEN `(EVEN (CARD (set_lower G (left m))) <=> EVEN (CARD (set_lower G m))) <=> (EVEN (CARD ((set_lower G (left m)) UNION (set_lower G m))))` SUBGOAL_TAC;
7312 IMATCH_MP_TAC even_card_even;
7313 ASM_SIMP_TAC[finite_set_lower];
7314 REWRITE_TAC[set_lower;INTER ;left ;EQ_EMPTY ];
7315 MESON_TAC[INT_ARITH `~(z = z -: &:1)`];
7317 TYPE_THEN `BIJ h_edge (set_lower G (left m) UNION (set_lower G m)) (target_set G m DELETE (v_edge m)) ` SUBGOAL_TAC;
7318 ASM_MESON_TAC[bij_target_set_odd];
7320 TYPE_THEN `CARD (set_lower G (left m) UNION (set_lower G m)) = CARD (target_set G m DELETE (v_edge m))` SUBGOAL_TAC;
7321 IMATCH_MP_TAC BIJ_CARD ;
7322 TYPE_THEN `h_edge` EXISTS_TAC;
7324 REWRITE_TAC[FINITE_UNION];
7325 ASM_MESON_TAC[finite_set_lower];
7327 ASM_MESON_TAC[target_set_odd];
7331 let squ_left_par = prove_by_refinement(
7332 `!G m. (rectagon G) ==>
7333 (((even_cell G (squ (left m)) = even_cell G(squ m))) <=>
7337 ASM_MESON_TAC[squ_left_even;squ_left_odd];
7341 (* ------------------------------------------------------------------ *)
7343 (* ------------------------------------------------------------------ *)
7346 let rectangle = jordan_def `rectangle p q =
7347 {Z | ?u v. (Z = point(u,v)) /\
7348 (real_of_int (FST p ) <. u) /\ (u <. (real_of_int (FST q ))) /\
7349 (real_of_int (SND p ) <. v) /\ (v <. (real_of_int (SND q))) }`;;
7351 let rectangle_inter = prove_by_refinement(
7352 `!p q. rectangle p q =
7353 {z | ?r. (z = point r) /\ (real_of_int(FST p) <. FST r)} INTER
7354 {z | ?r. (z = point r) /\ (real_of_int(SND p) <. SND r)} INTER
7355 {z | ?r. (z = point r) /\ (FST r ) <. real_of_int(FST q)} INTER
7356 {z | ?r. (z = point r) /\ (SND r ) <. real_of_int(SND q)} `,
7361 IMATCH_MP_TAC EQ_EXT;
7362 REWRITE_TAC[rectangle;INTER];
7368 ASM_REWRITE_TAC[point_inj];
7369 CONV_TAC (dropq_conv "r");
7371 CONV_TAC (dropq_conv "r");
7373 CONV_TAC (dropq_conv "r'");
7374 CONV_TAC (dropq_conv "r");
7379 USE 1 (REWRITE_RULE[point_inj]);
7380 USE 1(CONV_RULE (dropq_conv "r'"));
7382 USE 2(REWRITE_RULE[point_inj]);
7383 USE 2(CONV_RULE (dropq_conv "r'"));
7385 USE 3(REWRITE_RULE[point_inj]);
7386 USE 3(CONV_RULE (dropq_conv "r'"));
7387 REWRITE_TAC[point_inj;PAIR_SPLIT];
7388 CONV_TAC (dropq_conv "u");
7389 CONV_TAC (dropq_conv "v");
7395 let rectangle_open = prove_by_refinement(
7396 `!p q. top2 (rectangle p q)`,
7399 REWRITE_TAC[rectangle_inter];
7400 ASSUME_TAC top2_top;
7402 REPEAT (IMATCH_MP_TAC top_inter THEN ASM_REWRITE_TAC[top_inter;open_half_plane2D_FLT_open;open_half_plane2D_LTF_open;open_half_plane2D_SLT_open;open_half_plane2D_LTS_open]);
7406 let rectangle_convex = prove_by_refinement(
7407 `!p q. convex (rectangle p q)`,
7411 REWRITE_TAC[rectangle_inter];
7412 REPEAT (IMATCH_MP_TAC convex_inter THEN REWRITE_TAC[open_half_plane2D_FLT_convex;open_half_plane2D_LTF_convex;open_half_plane2D_SLT_convex;open_half_plane2D_LTS_convex]);
7416 let rectangle_squ = prove_by_refinement(
7417 `!p. squ p = rectangle p (FST p +: &:1,SND p +: &:1)`,
7420 REWRITE_TAC[squ;rectangle];
7424 let squ_inter = prove_by_refinement(
7426 {z | ?r. (z = point r) /\ (real_of_int(FST p) <. FST r)} INTER
7427 {z | ?r. (z = point r) /\ (real_of_int(SND p) <. SND r)} INTER
7428 {z | ?r. (z = point r) /\ (FST r ) <. real_of_int(FST p +: &:1) } INTER
7429 {z | ?r. (z = point r) /\ (SND r ) <. real_of_int(SND p +: &:1) }`,
7432 REWRITE_TAC[rectangle_squ;rectangle_inter];
7437 let subset3_absorb = prove_by_refinement(
7438 `!(A:A->bool) B C. (B SUBSET C) ==> (B INTER A = B INTER C INTER A)`,
7442 REWRITE_TAC[INTER_ACI];
7444 ASM_MESON_TAC[SUBSET_INTER_ABSORPTION];
7448 let rectangle_lemma1 = prove_by_refinement(
7450 (rectangle (FST p , SND p -: &:1) (FST p +: &:1 , SND p +: &:1))
7451 INTER {z | ?r. (z = point r) /\ (SND r <. real_of_int(SND p))}`,
7455 REWRITE_TAC[squ_inter;rectangle_inter;down];
7456 REWRITE_TAC[INT_ARITH `x -: &:1 +: &:1 = x`];
7457 REWRITE_TAC[INTER_ACI];
7461 IMATCH_MP_TAC EQ_EXT;
7463 REWRITE_TAC[INTER;int_suc ;];
7467 ASSUME_TAC (REAL_ARITH `!u. u <. u + &.1`);
7469 TYPE_THEN `r` EXISTS_TAC;
7470 ASM_MESON_TAC[REAL_LT_TRANS ];
7477 let rectangle_lemma2 = prove_by_refinement(
7479 (rectangle (FST p , SND p -: &:1) (FST p +: &:1 , SND p +: &:1))
7480 INTER {z | ?r. (z = point r) /\ ( real_of_int(SND p) <. SND r)}`,
7484 REWRITE_TAC[squ_inter;rectangle_inter;down];
7485 REWRITE_TAC[INTER_ACI];
7487 TYPE_THEN `B = {z | ?r. (z = point r) /\ real_of_int (SND p) < SND r}` ABBREV_TAC ;
7488 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (SND p -: &:1) < SND r}` ABBREV_TAC ;
7489 REWRITE_TAC[INTER_ACI];
7490 IMATCH_MP_TAC subset3_absorb;
7493 REWRITE_TAC[SUBSET;int_sub_th; int_of_num_th];
7494 ASM_MESON_TAC[REAL_ARITH `a <. b ==> (a - &.1 <. b)`];
7498 let rectangle_lemma3 = prove_by_refinement(
7500 (rectangle (FST q , SND q -: &:1) (FST q +: &:1 , SND q +: &:1))
7501 INTER {z | ?r. (z = point r) /\ ( SND r = real_of_int(SND q))}`,
7505 REWRITE_TAC[h_edge_inter;rectangle_inter;];
7506 TYPE_THEN `B = {z | ?p. (z = point p) /\ (SND p = real_of_int (SND q))}` ABBREV_TAC ;
7507 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (SND q -: &:1) < SND r}` ABBREV_TAC ;
7508 TYPE_THEN `D = {z | ?r. (z = point r) /\ SND r < real_of_int (SND q +: &:1)}` ABBREV_TAC ;
7509 REWRITE_TAC[INTER_ACI];
7510 TYPE_THEN `!A. B INTER C INTER D INTER A = B INTER (C INTER D) INTER A` SUBGOAL_TAC;
7511 REWRITE_TAC[INTER_ACI];
7512 DISCH_THEN (fun t-> PURE_REWRITE_TAC [t]);
7513 IMATCH_MP_TAC subset3_absorb;
7514 REWRITE_TAC[SUBSET_INTER];
7518 REWRITE_TAC[SUBSET;int_sub_th; int_of_num_th;int_add_th;];
7519 ASM_MESON_TAC[REAL_ARITH `x - &.1 <. x /\ x < x + &.1`];
7523 let rectangle_h = prove_by_refinement(
7524 `!p. rectangle (FST p , SND p -: &:1) (FST p +: &:1 , SND p +: &:1) =
7525 ((squ (down p)) UNION (h_edge p) UNION (squ p) )`,
7529 REWRITE_TAC[rectangle_lemma1;rectangle_lemma2;rectangle_lemma3];
7530 REWRITE_TAC[GSYM UNION_OVER_INTER];
7531 TYPE_THEN `({z | ?r. (z = point r) /\ SND r < real_of_int (SND p)} UNION {z | ?r. (z = point r) /\ (SND r = real_of_int (SND p))} UNION {z | ?r. (z = point r) /\ real_of_int (SND p) < SND r}) = {z | ?r. (z = point r)}` SUBGOAL_TAC;
7532 IMATCH_MP_TAC EQ_EXT;
7535 ASM_MESON_TAC[REAL_ARITH `!x y. (x <. y) \/ (x = y) \/ (y <. x)`];
7537 TYPE_THEN `rectangle (FST p,SND p -: &:1) (FST p +: &:1,SND p +: &:1) SUBSET {z | ?r. z = point r}` SUBGOAL_TAC;
7538 REWRITE_TAC[rectangle;SUBSET ];
7540 REWRITE_TAC [SUBSET_INTER_ABSORPTION;];
7545 let rectangle_lemma4 = prove_by_refinement(
7547 (rectangle (FST p -: &:1 , SND p)(FST p +: &:1 , SND p +: &:1))
7548 INTER {z | ?r. (z = point r) /\ (FST r <. real_of_int(FST p))}`,
7552 REWRITE_TAC[squ_inter;rectangle_inter;left ];
7553 REWRITE_TAC[INT_ARITH `x -: &:1 +: &:1 = x`];
7554 REWRITE_TAC[INTER_ACI];
7557 TYPE_THEN `B = {z | ?r. (z = point r) /\ FST r < real_of_int (FST p)}` ABBREV_TAC ;
7558 TYPE_THEN `C = {z | ?r. (z = point r) /\ FST r < real_of_int (FST p +: &:1)}` ABBREV_TAC ;
7559 REWRITE_TAC[INTER_ACI];
7560 IMATCH_MP_TAC subset3_absorb;
7563 REWRITE_TAC[SUBSET;int_suc];
7564 ASM_MESON_TAC[REAL_ARITH `x <. y ==> x <. y + &.1`];
7568 let rectangle_lemma5 = prove_by_refinement(
7570 (rectangle (FST p -: &:1 , SND p) (FST p +: &:1 , SND p +: &:1))
7571 INTER {z | ?r. (z = point r) /\ ( real_of_int(FST p) <. FST r)}`,
7575 REWRITE_TAC[squ_inter;rectangle_inter;];
7576 TYPE_THEN `B = {z | ?r. (z = point r) /\ real_of_int (FST p) < FST r} ` ABBREV_TAC ;
7577 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (FST p -: &:1) < FST r}` ABBREV_TAC ;
7578 REWRITE_TAC[INTER_ACI];
7579 IMATCH_MP_TAC subset3_absorb;
7582 REWRITE_TAC[SUBSET;int_sub_th; int_of_num_th];
7583 ASM_MESON_TAC[REAL_ARITH `a <. b ==> (a - &.1 <. b)`];
7587 let rectangle_lemma6 = prove_by_refinement(
7589 (rectangle (FST q -: &:1 , SND q) (FST q +: &:1 , SND q +: &:1))
7590 INTER {z | ?r. (z = point r) /\ ( FST r = real_of_int(FST q))}`,
7594 REWRITE_TAC[v_edge_inter;rectangle_inter;];
7595 REWRITE_TAC[INTER_ACI];
7596 TYPE_THEN `B = {z | ?p. (z = point p) /\ (FST p = real_of_int (FST q))}` ABBREV_TAC ;
7597 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (FST q -: &:1) < FST r}` ABBREV_TAC ;
7598 TYPE_THEN `D = {z | ?r. (z = point r) /\ FST r < real_of_int (FST q +: &:1)}` ABBREV_TAC ;
7599 REWRITE_TAC[INTER_ACI];
7600 TYPE_THEN `!A. B INTER C INTER D INTER A = B INTER (C INTER D) INTER A` SUBGOAL_TAC;
7601 REWRITE_TAC[INTER_ACI];
7602 DISCH_THEN (fun t-> PURE_REWRITE_TAC [t]);
7603 IMATCH_MP_TAC subset3_absorb;
7604 REWRITE_TAC[SUBSET_INTER];
7608 REWRITE_TAC[SUBSET;int_sub_th; int_of_num_th;int_add_th;];
7609 ASM_MESON_TAC[REAL_ARITH `x - &.1 <. x /\ x < x + &.1`];
7613 let rectangle_v = prove_by_refinement(
7614 `!p. rectangle (FST p -: &:1 , SND p ) (FST p +: &:1 , SND p +: &:1) =
7615 ((squ (left p)) UNION (v_edge p) UNION (squ p) )`,
7619 REWRITE_TAC[rectangle_lemma4;rectangle_lemma5;rectangle_lemma6];
7620 REWRITE_TAC[GSYM UNION_OVER_INTER];
7621 TYPE_THEN `({z | ?r. (z = point r) /\ FST r < real_of_int (FST p)} UNION {z | ?r. (z = point r) /\ (FST r = real_of_int (FST p))} UNION {z | ?r. (z = point r) /\ real_of_int (FST p) < FST r}) = {z | ?r. (z = point r)}` SUBGOAL_TAC;
7622 IMATCH_MP_TAC EQ_EXT;
7625 ASM_MESON_TAC[REAL_ARITH `!x y. (x <. y) \/ (x = y) \/ (y <. x)`];
7627 TYPE_THEN `rectangle (FST p -: &:1 ,SND p) (FST p +: &:1,SND p +: &:1) SUBSET {z | ?r. z = point r}` SUBGOAL_TAC;
7628 REWRITE_TAC[rectangle;SUBSET ];
7630 REWRITE_TAC [SUBSET_INTER_ABSORPTION;];
7635 let long_v = jordan_def `long_v p =
7636 {z | (?r. (z = point r) /\ (FST r = real_of_int (FST p)) /\
7637 (real_of_int(SND p) - &1 <. SND r) /\
7638 (SND r <. real_of_int(SND p) + &1) )}`;;
7640 let long_v_inter = prove_by_refinement(
7642 {z | ?r. (z = point r) /\ (FST r = real_of_int (FST p))} INTER
7643 {z | ?r. (z = point r) /\ (real_of_int(SND p -: &:1) <. SND r)} INTER
7644 {z | ?r. (z = point r) /\ (SND r <. real_of_int(SND p +: &:1))} `,
7649 IMATCH_MP_TAC EQ_EXT ;
7650 REWRITE_TAC[long_v;INTER;int_add_th;int_sub_th;int_of_num_th];
7653 DISCH_THEN CHOOSE_TAC;
7659 RULE_ASSUM_TAC (REWRITE_RULE[point_inj]);
7660 USE 2(CONV_RULE (dropq_conv "r'"));
7661 USE 1(CONV_RULE (dropq_conv "r'"));
7667 let long_v_lemma1 = prove_by_refinement(
7668 `!q. v_edge (down q) =
7670 {z | ?r. (z = point r) /\ (SND r <. real_of_int(SND q))}`,
7673 REWRITE_TAC[v_edge_inter;long_v_inter;down ];
7674 REWRITE_TAC[INT_ARITH `x -: &:1 +: &:1 = x`];
7676 TYPE_THEN `B = {z | ?r. (z = point r) /\ SND r < real_of_int (SND q)}` ABBREV_TAC ;
7677 TYPE_THEN `C = {z | ?r. (z = point r) /\ SND r < real_of_int (SND q +: &:1)}` ABBREV_TAC ;
7679 REWRITE_TAC[INTER_ACI];
7680 IMATCH_MP_TAC subset3_absorb;
7683 REWRITE_TAC[SUBSET;int_add_th;int_of_num_th];
7684 MESON_TAC[REAL_ARITH `x <. y ==> x <. y + &1`];
7688 let long_v_lemma2 = prove_by_refinement(
7691 {z | ?r. (z = point r) /\ (real_of_int(SND q) <. SND r )}`,
7694 REWRITE_TAC[v_edge_inter;long_v_inter;down;int_suc;int_sub_th;int_of_num_th ];
7696 TYPE_THEN `B = {z | ?r. (z = point r) /\ real_of_int (SND q) < SND r}` ABBREV_TAC ;
7697 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (SND q) - &1 < SND r}` ABBREV_TAC ;
7699 REWRITE_TAC[INTER_ACI];
7700 IMATCH_MP_TAC subset3_absorb;
7703 REWRITE_TAC[SUBSET;int_add_th;int_of_num_th];
7704 MESON_TAC[REAL_ARITH `x <. y ==> x - &1 <. y`];
7708 let pointI_inter = prove_by_refinement(
7710 {z | ?r. (z = point r) /\ (FST r = real_of_int (FST q))} INTER
7711 {z | ?r. (z = point r) /\ (real_of_int (SND q) = SND r)}`,
7715 IMATCH_MP_TAC EQ_EXT;
7716 REWRITE_TAC[INTER;INR IN_SING;pointI ];
7720 REWRITE_TAC[point_inj];
7721 CONV_TAC (dropq_conv "r");
7722 CONV_TAC (dropq_conv "r'");
7726 USE 1(REWRITE_RULE[point_inj]);
7727 USE 1(CONV_RULE (dropq_conv "r'"));
7728 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT;];
7732 let long_v_lemma3 = prove_by_refinement(
7733 `!q. {(pointI q)} = long_v q INTER
7734 { z | ?r. (z = point r) /\ (real_of_int(SND q) = SND r)}`,
7737 REWRITE_TAC[pointI_inter;long_v_inter];
7740 TYPE_THEN `A = {z | ?r. (z = point r) /\ (FST r = real_of_int (FST q))}` ABBREV_TAC ;
7741 TYPE_THEN `B = {z | ?r. (z = point r) /\ (real_of_int (SND q) = SND r)}` ABBREV_TAC ;
7742 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (SND q -: &:1) < SND r}` ABBREV_TAC ;
7743 TYPE_THEN `D = {z | ?r. (z = point r) /\ SND r < real_of_int (SND q +: &:1)}` ABBREV_TAC ;
7744 REWRITE_TAC[INTER_ACI];
7746 ONCE_REWRITE_TAC [EQ_SYM_EQ];
7747 REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION];
7751 REWRITE_TAC[SUBSET;INTER;int_sub_th;int_of_num_th;int_add_th];
7752 ASM_MESON_TAC[REAL_ARITH `(x = y) ==> (x - &1 <. y /\ x <. y + &1)`];
7756 let long_v_union = prove_by_refinement(
7758 (v_edge (down p)) UNION {(pointI p)} UNION (v_edge p)`,
7762 REWRITE_TAC[long_v_lemma1;long_v_lemma2;long_v_lemma3];
7763 REWRITE_TAC[GSYM UNION_OVER_INTER];
7764 TYPE_THEN `({z | ?r. (z = point r) /\ SND r < real_of_int (SND p)} UNION {z | ?r. (z = point r) /\ (real_of_int (SND p) = SND r)} UNION {z | ?r. (z = point r) /\ real_of_int (SND p) < SND r}) = {z | ?r. (z = point r)}` SUBGOAL_TAC;
7765 IMATCH_MP_TAC EQ_EXT ;
7767 REWRITE_TAC[UNION;];
7770 DISCH_THEN CHOOSE_TAC;
7771 ASM_REWRITE_TAC[point_inj];
7772 CONV_TAC (dropq_conv "r'");
7775 ONCE_REWRITE_TAC[EQ_SYM_EQ];
7776 REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION;];
7777 REWRITE_TAC[long_v;SUBSET];
7782 let two_two_lemma1 = prove_by_refinement(
7783 `!p. rectangle(FST p - &:1 , SND p - &:1) (FST p , SND p + &:1) =
7784 rectangle (FST p -: &:1 , SND p -: &:1) (FST p +: &:1 , SND p + &:1)
7786 {z | (?r. (z = point r) /\ (FST r <. real_of_int(FST p)))}`,
7790 REWRITE_TAC[rectangle_inter];
7792 TYPE_THEN `B = {z | ?r. (z = point r) /\ FST r < real_of_int (FST p)}` ABBREV_TAC ;
7793 TYPE_THEN `C = {z | ?r. (z = point r) /\ FST r < real_of_int (FST p +: &:1)} ` ABBREV_TAC ;
7794 REWRITE_TAC[INTER_ACI];
7795 IMATCH_MP_TAC subset3_absorb;
7798 REWRITE_TAC[SUBSET;int_suc;];
7799 MESON_TAC[REAL_ARITH `x <. y ==> x < y + &1`];
7803 let two_two_lemma2 = prove_by_refinement(
7804 `!p. rectangle(FST p , SND p - &:1) (FST p + &:1 ,SND p + &:1) =
7805 rectangle (FST p -: &:1 , SND p -: &:1) (FST p +: &:1 , SND p + &:1)
7807 {z | (?r. (z = point r) /\ ( real_of_int(FST p) <. FST r ))}`,
7811 REWRITE_TAC[rectangle_inter];
7813 TYPE_THEN `B = {z | ?r. (z = point r) /\ real_of_int (FST p) < FST r}` ABBREV_TAC ;
7814 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (FST p -: &:1) < FST r}` ABBREV_TAC ;
7815 REWRITE_TAC[INTER_ACI];
7816 IMATCH_MP_TAC subset3_absorb;
7819 REWRITE_TAC[SUBSET;int_sub_th;int_add_th;int_of_num_th;];
7820 ASM_MESON_TAC[REAL_ARITH `x < y ==> (x - &1 <. y)`];
7824 let two_two_lemma3 = prove_by_refinement(
7826 rectangle (FST p -: &:1 , SND p -: &:1) (FST p +: &:1 , SND p + &:1)
7828 {z | (?r. (z = point r) /\ ( FST r = real_of_int(FST p) ))}`,
7832 REWRITE_TAC[long_v_inter;rectangle_inter];
7834 TYPE_THEN `B = {z | ?r. (z = point r) /\ (FST r = real_of_int (FST p))} ` ABBREV_TAC ;
7835 TYPE_THEN `C = {z | ?r. (z = point r) /\ real_of_int (FST p -: &:1) < FST r}` ABBREV_TAC ;
7836 TYPE_THEN `D = {z | ?r. (z = point r) /\ FST r < real_of_int (FST p +: &:1)} ` ABBREV_TAC ;
7837 REWRITE_TAC[INTER_ACI];
7838 TYPE_THEN `!A. (B INTER C INTER D INTER A) = B INTER (C INTER D) INTER A` SUBGOAL_TAC;
7839 REWRITE_TAC[INTER_ACI];
7840 DISCH_THEN (fun t-> PURE_REWRITE_TAC[t]);
7841 IMATCH_MP_TAC subset3_absorb;
7845 REWRITE_TAC[SUBSET;INTER;int_sub_th;int_add_th;int_of_num_th];
7847 DISCH_THEN (CHOOSE_THEN MP_TAC);
7848 ASM_MESON_TAC[REAL_ARITH `(x = y) ==> (x - &.1 <. y /\ x <. y+ &1)`];
7852 let two_two_union = prove_by_refinement(
7853 `!p. rectangle (FST p -: &:1 , SND p -: &:1)
7854 (FST p +: &:1 , SND p + &:1) =
7855 rectangle(FST p - &:1 , SND p - &:1) (FST p , SND p + &:1) UNION
7857 rectangle(FST p , SND p - &:1) (FST p + &:1 ,SND p + &:1)`,
7860 REWRITE_TAC[two_two_lemma1;two_two_lemma2;two_two_lemma3];
7861 REWRITE_TAC[GSYM UNION_OVER_INTER];
7863 TYPE_THEN `{z | ?r. (z = point r)} = ({z | ?r. (z = point r) /\ FST r < real_of_int (FST p)} UNION {z | ?r. (z = point r) /\ (FST r = real_of_int (FST p))} UNION {z | ?r. (z = point r) /\ real_of_int (FST p) < FST r})` SUBGOAL_TAC;
7864 IMATCH_MP_TAC EQ_EXT;
7868 DISCH_THEN (CHOOSE_THEN MP_TAC);
7870 REWRITE_TAC [point_inj];
7871 CONV_TAC (dropq_conv "r'");
7877 ONCE_REWRITE_TAC [EQ_SYM_EQ];
7878 REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION];
7879 REWRITE_TAC[rectangle;SUBSET];
7884 let two_two_nine = prove_by_refinement(
7885 `!p. rectangle (FST p -: &:1 , SND p -: &:1) (FST p +: &:1 , SND p + &:1) =
7886 squ (FST p -: &:1,SND p -: &:1) UNION squ (FST p -: &:1,SND p ) UNION
7887 squ (FST p,SND p -: &:1) UNION squ p UNION
7888 h_edge (left p) UNION h_edge p UNION
7889 v_edge (down p) UNION v_edge p UNION {(pointI p)}`,
7893 REWRITE_TAC[two_two_union;rectangle_h;rectangle_v];
7894 TYPE_THEN `rectangle (FST p -: &:1,SND p -: &:1) (FST p,SND p +: &:1) = rectangle (FST (left p),SND (left p) -: &:1) (FST (left p) +: &:1,SND (left p) +: &:1)` SUBGOAL_TAC;
7895 REWRITE_TAC[left ;INT_ARITH `x -: &:1 +: &:1 = x`];
7897 REWRITE_TAC[rectangle_h];
7898 REWRITE_TAC[left ;down; long_v_union];
7899 REWRITE_TAC[UNION_ACI];
7904 (* ------------------------------------------------------------------ *)
7906 let curve_cell = jordan_def `curve_cell G = G UNION
7907 {z | (?n. (z = {(pointI n)}) /\ (closure top2 (UNIONS G) (pointI n)))}`;;
7909 let curve_cell_cell = prove_by_refinement(
7910 `!G. (G SUBSET edge) ==> (curve_cell G SUBSET cell)`,
7913 REWRITE_TAC[SUBSET;edge;curve_cell;cell;UNION ];
7917 DISCH_THEN DISJ_CASES_TAC;
7926 let curve_cell_point = prove_by_refinement(
7927 `!G n. (FINITE G) /\ (G SUBSET edge) ==> (curve_cell G {(pointI n)} <=>
7928 (?e. (G e /\ (closure top2 e (pointI n)))))`,
7931 REWRITE_TAC[curve_cell;UNION ;edge;SUBSET ];
7934 DISCH_THEN DISJ_CASES_TAC;
7935 TSPEC `{(pointI n)}` 1;
7937 USE 1(REWRITE_RULE[eq_sing;v_edge_pointI;h_edge_pointI;]);
7939 USE 2 (REWRITE_RULE[eq_sing;INR IN_SING ;pointI_inj]);
7940 USE 2(CONV_RULE (dropq_conv "n'"));
7941 ASSUME_TAC top2_top;
7943 ASM_SIMP_TAC[closure_unions];
7944 REWRITE_TAC[IMAGE;INR IN_UNIONS ];
7945 DISCH_THEN CHOOSE_TAC;
7949 DISCH_THEN CHOOSE_TAC;
7951 REWRITE_TAC[eq_sing;INR IN_SING;pointI_inj;];
7952 CONV_TAC (dropq_conv "n'") ;
7953 TYPE_THEN `closure top2 e SUBSET closure top2 (UNIONS G)` SUBGOAL_TAC;
7954 IMATCH_MP_TAC subset_of_closure;
7955 REWRITE_TAC[top2_top];
7956 IMATCH_MP_TAC sub_union;
7958 REWRITE_TAC[SUBSET];
7963 let curve_cell_h = prove_by_refinement(
7964 `!G n. (segment G) ==> (curve_cell G (h_edge n) = G (h_edge n))`,
7968 REWRITE_TAC[curve_cell;UNION ; eq_sing;INR IN_SING; h_edge_pointI];
7972 let curve_cell_v = prove_by_refinement(
7973 `!G n. (segment G) ==> (curve_cell G (v_edge n) = G (v_edge n))`,
7977 REWRITE_TAC[curve_cell;UNION ; eq_sing;INR IN_SING; v_edge_pointI];
7981 let curve_cell_in = prove_by_refinement(
7982 `!C G . (G SUBSET edge) /\ (curve_cell G C) ==>
7983 (?n. (C = {(pointI n)}) \/ (C = h_edge n) \/ (C = v_edge n))`,
7986 REWRITE_TAC[curve_cell;UNION ;SUBSET; edge ];
7989 DISCH_THEN DISJ_CASES_TAC;
7995 let curve_cell_subset = prove_by_refinement(
7996 `!G. (G SUBSET (curve_cell G))`,
7999 REWRITE_TAC[SUBSET;curve_cell;UNION ];
8004 let curve_closure = prove_by_refinement(
8005 `!G. (segment G) ==>
8006 (closure top2 (UNIONS G) = (UNIONS (curve_cell G)))`,
8010 TYPE_THEN `FINITE G` SUBGOAL_TAC;
8011 ASM_MESON_TAC[segment];
8013 ASSUME_TAC top2_top;
8014 (* ASM_SIMP_TAC[closure_unions]; *)
8015 TYPE_THEN `G SUBSET edge ` SUBGOAL_TAC;
8016 ASM_MESON_TAC[segment];
8018 IMATCH_MP_TAC SUBSET_ANTISYM;
8020 ASM_SIMP_TAC[closure_unions];
8021 REWRITE_TAC[IMAGE;INR IN_UNIONS;SUBSET ];
8026 TYPE_THEN `edge x'` SUBGOAL_TAC;
8027 ASM_MESON_TAC[segment;ISUBSET];
8029 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC);
8033 USE 4(REWRITE_RULE[v_edge_closure;vc_edge;UNION ;INR IN_SING ]);
8036 TYPE_THEN `v_edge m` EXISTS_TAC;
8037 ASM_SIMP_TAC [curve_cell_v];
8038 TYPE_THEN `{(pointI m)}` EXISTS_TAC;
8040 ASM_SIMP_TAC [curve_cell_point];
8041 REWRITE_TAC[INR IN_SING];
8043 USE 4(REWRITE_RULE[plus_e12]);
8044 TYPE_THEN `{(pointI (FST m,SND m +: &:1))}` EXISTS_TAC;
8046 ASM_SIMP_TAC [curve_cell_point];
8047 REWRITE_TAC[INR IN_SING];
8049 (* dt2 , down to 2 goals *)
8053 USE 4 (REWRITE_RULE[h_edge_closure;hc_edge;UNION;INR IN_SING]);
8056 TYPE_THEN `h_edge m` EXISTS_TAC;
8057 ASM_SIMP_TAC[curve_cell_h];
8058 TYPE_THEN `{(pointI m)}` EXISTS_TAC;
8059 ASM_SIMP_TAC[curve_cell_point ;INR IN_SING ];
8061 USE 4(REWRITE_RULE[plus_e12]);
8062 TYPE_THEN `{x}` EXISTS_TAC;
8063 ASM_REWRITE_TAC[INR IN_SING];
8064 ASM_SIMP_TAC[curve_cell_point ;INR IN_SING ];
8067 REWRITE_TAC[curve_cell; UNIONS_UNION; union_subset];
8068 ASM_SIMP_TAC[closure_unions];
8070 REWRITE_TAC[SUBSET;IMAGE;UNIONS];
8072 CONV_TAC (dropq_conv "u");
8075 TYPE_THEN `u` EXISTS_TAC;
8077 ASM_MESON_TAC[subset_closure;ISUBSET ];
8079 TYPE_THEN `A = UNIONS (IMAGE (closure top2) G)` ABBREV_TAC ;
8080 REWRITE_TAC[UNIONS;SUBSET ];
8081 CONV_TAC (dropq_conv "u");
8082 REWRITE_TAC[INR IN_SING];
8088 let not_not = prove_by_refinement(
8089 `!x y. (~x = ~y) <=> (x = y)`,
8096 let not_eq = prove_by_refinement(
8097 `!x y. (~x = y) <=> (x = ~y)`,
8104 let cell_inter = prove_by_refinement(
8105 `!C D. (cell C) /\ (D SUBSET cell) ==>
8106 ((C INTER (UNIONS D) = EMPTY) <=> ~(D C))`,
8110 REWRITE_TAC[INTER;IN_UNIONS;SUBSET;EQ_EMPTY ];
8113 REWRITE_TAC[not_not ];
8115 DISCH_THEN CHOOSE_TAC;
8118 TYPE_THEN `t = C` SUBGOAL_TAC;
8119 IMATCH_MP_TAC cell_partition;
8120 REWRITE_TAC[EMPTY_EXISTS;INTER ];
8124 USE 0(MATCH_MP cell_nonempty);
8125 USE 0(REWRITE_RULE[EMPTY_EXISTS]);
8132 let curve_cell_h_inter = prove_by_refinement(
8133 `!G m. (segment G) ==>
8134 (((h_edge m) INTER (UNIONS (curve_cell G)) = {}) <=>
8135 (~(G (h_edge m))))`,
8139 ASM_SIMP_TAC[GSYM curve_cell_h];
8140 IMATCH_MP_TAC cell_inter;
8141 ASM_REWRITE_TAC [cell_rules;curve_cell_cell];
8142 ASM_MESON_TAC[segment;curve_cell_cell];
8146 let curve_cell_v_inter = prove_by_refinement(
8147 `!G m. (segment G) ==>
8148 (((v_edge m) INTER (UNIONS (curve_cell G)) = {}) <=>
8149 (~(G (v_edge m))))`,
8153 ASM_SIMP_TAC[GSYM curve_cell_v];
8154 IMATCH_MP_TAC cell_inter;
8155 ASM_REWRITE_TAC [cell_rules;curve_cell_cell];
8156 ASM_MESON_TAC[segment;curve_cell_cell];
8160 let curve_cell_squ = prove_by_refinement(
8161 `!G m. (segment G) ==> ~curve_cell G (squ m)`,
8164 REWRITE_TAC[curve_cell;UNION ;eq_sing;square_pointI; segment];
8165 REWRITE_TAC[SUBSET; edge];
8168 USE 3(REWRITE_RULE[square_v_edgeV2;square_h_edgeV2;]);
8173 let curve_cell_squ_inter = prove_by_refinement(
8174 `!G m. (segment G) ==>
8175 (((squ m) INTER (UNIONS (curve_cell G)) = {}))`,
8179 TYPE_THEN `cell (squ m)` SUBGOAL_TAC;
8180 REWRITE_TAC[cell_rules];
8182 TYPE_THEN `(curve_cell G SUBSET cell)` SUBGOAL_TAC;
8183 ASM_MESON_TAC[curve_cell_cell;segment];
8185 ASM_SIMP_TAC [cell_inter];
8186 ASM_MESON_TAC [curve_cell_squ];
8190 let curve_point_unions = prove_by_refinement(
8191 `!G m. (segment G) ==>
8192 (UNIONS (curve_cell G) (pointI m) = curve_cell G {(pointI m)})`,
8196 TYPE_THEN `UNIONS (curve_cell G) (pointI m) <=> ~({(pointI m)} INTER (UNIONS (curve_cell G)) = EMPTY )` SUBGOAL_TAC;
8197 REWRITE_TAC[REWRITE_RULE[not_eq] single_inter];
8199 REWRITE_TAC [not_eq];
8200 IMATCH_MP_TAC cell_inter;
8201 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
8202 ASM_MESON_TAC[segment];
8204 ASM_MESON_TAC[cell_rules;curve_cell_cell];
8208 let curve_cell_not_point = prove_by_refinement(
8209 `!G m. (segment G) ==> ((curve_cell G {(pointI m)} <=>
8210 ~(num_closure G (pointI m) = 0)))`,
8214 TYPE_THEN `FINITE G /\ (G SUBSET edge)` SUBGOAL_TAC;
8215 ASM_MESON_TAC[segment];
8217 ASM_SIMP_TAC[curve_cell_point;num_closure0];
8222 (* ------------------------------------------------------------------ *)
8224 let par_cell = jordan_def `par_cell eps G C <=>
8225 ((?m. (C = {(pointI m)}) /\ (eps = EVEN (num_lower G m))) \/
8226 (?m. (C = h_edge m) /\ (eps = EVEN (num_lower G m))) \/
8227 (?m. (C = v_edge m) /\ (eps = EVEN (num_lower G m))) \/
8228 (?m. (C = squ m) /\ (eps= EVEN (num_lower G m)))) /\
8229 (C INTER (UNIONS (curve_cell G)) = EMPTY )`;;
8231 let par_cell_curve_disj = prove_by_refinement(
8232 `!G C eps. (par_cell eps G C) ==>
8233 (C INTER (UNIONS (curve_cell G)) = EMPTY )`,
8236 REWRITE_TAC[par_cell];
8242 let par_cell_cell = prove_by_refinement(
8243 `!G eps. (par_cell eps G SUBSET cell)`,
8246 REWRITE_TAC[SUBSET;par_cell;even_cell];
8248 ASM_MESON_TAC[cell_rules];
8252 let par_cell_h = prove_by_refinement(
8253 `!G m eps. (segment G) ==> ((par_cell eps G (h_edge m) <=>
8254 (~(G (h_edge m))) /\ (eps = EVEN (num_lower G m))))`,
8258 REWRITE_TAC[par_cell;eq_sing;h_edge_inj;hv_edgeV2;h_edge_pointI;];
8259 REWRITE_TAC[square_h_edgeV2];
8260 ASM_SIMP_TAC[curve_cell_h_inter];
8261 CONV_TAC (dropq_conv "m'");
8266 let par_cell_v = prove_by_refinement(
8267 `!G m eps. (segment G) ==> ((par_cell eps G (v_edge m) <=>
8268 (~(G (v_edge m))) /\ (eps = EVEN (num_lower G m))))`,
8272 REWRITE_TAC[par_cell;eq_sing;v_edge_inj;hv_edgeV2;v_edge_pointI;];
8273 REWRITE_TAC[square_v_edgeV2];
8274 ASM_SIMP_TAC[curve_cell_v_inter];
8275 CONV_TAC (dropq_conv "m'");
8280 let par_cell_squ = prove_by_refinement(
8281 `!G m eps. (segment G) ==> ((par_cell eps G (squ m) <=>
8282 (eps = EVEN (num_lower G m))))`,
8286 REWRITE_TAC[par_cell;eq_sing;square_h_edgeV2;square_v_edgeV2;squ_inj];
8287 ASM_SIMP_TAC[curve_cell_squ_inter];
8288 REWRITE_TAC[square_pointI];
8289 CONV_TAC (dropq_conv "m'");
8293 let par_cell_point = prove_by_refinement(
8294 `!G m eps. (segment G) ==> ((par_cell eps G {(pointI m)} <=>
8295 ((num_closure G (pointI m) = 0) /\
8296 (eps = EVEN (num_lower G m)))))`,
8300 REWRITE_TAC[par_cell;eq_sing;INR IN_SING;point_inj;];
8301 SUBGOAL_TAC `!u x. ({(pointI u)} = x) <=> (x = {(pointI u)})` ;
8303 DISCH_THEN (fun t-> REWRITE_TAC[t]);
8304 REWRITE_TAC[eq_sing;INR IN_SING ;h_edge_pointI; v_edge_pointI; square_pointI;];
8305 REWRITE_TAC[pointI_inj; REWRITE_RULE[not_eq] single_inter];
8306 CONV_TAC (dropq_conv "m'");
8307 ASM_SIMP_TAC [curve_point_unions;curve_cell_not_point];
8312 let eq_sing_sym = prove_by_refinement(
8313 `!X (y:A). ({y} = X) <=> X y /\ (!u. X u ==> (u = y))`,
8316 ASM_MESON_TAC[eq_sing];
8320 let par_cell_disjoint = prove_by_refinement(
8321 `!G eps. (par_cell eps G INTER par_cell (~eps) G = EMPTY)`,
8324 REWRITE_TAC[EQ_EMPTY;INTER ];
8326 REWRITE_TAC[par_cell];
8327 REPEAT (REPEAT (LEFT_TAC "m") THEN (GEN_TAC));
8328 REPEAT (LEFT_TAC "m");
8329 REPEAT (REPEAT (LEFT_TAC "m'") THEN (GEN_TAC ));
8330 REPEAT (LEFT_TAC ("m'"));
8331 REPEAT (REPEAT (LEFT_TAC "m''") THEN (GEN_TAC ));
8332 REPEAT (LEFT_TAC ("m''"));
8333 LEFT_TAC "m'''" THEN GEN_TAC;
8334 LEFT_TAC "m''''" THEN GEN_TAC;
8335 LEFT_TAC "m'''''" THEN GEN_TAC;
8336 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
8337 REWRITE_TAC[DE_MORGAN_THM];
8338 REPEAT (CONJ_TAC) THEN (REWRITE_TAC[GSYM DE_MORGAN_THM;GSYM CONJ_ASSOC]) THEN (REWRITE_TAC[TAUT `~(A /\ B) <=> (A ==> ~B)`]) THEN (DISCH_THEN_REWRITE ) THEN (REWRITE_TAC[eq_sing;eq_sing_sym;pointI_inj;h_edge_pointI;v_edge_pointI;square_pointI; INR IN_SING ; hv_edgeV2; h_edge_inj ; v_edge_inj; square_v_edgeV2;square_h_edgeV2;squ_inj ]) THEN (ASM_MESON_TAC[]);
8342 let par_cell_nonempty = prove_by_refinement(
8343 `!G eps. (rectagon G) ==> ~(par_cell eps G = EMPTY)`,
8348 USE 1 (MATCH_MP rectagon_h_edge);
8350 TYPE_THEN `FINITE G` SUBGOAL_TAC;
8351 ASM_MESON_TAC[rectagon];
8353 USE 3(MATCH_MP squ_down);
8355 USE 3 (REWRITE_RULE[set_lower_n]);
8357 ASM_REWRITE_TAC[even_cell_squ;];
8360 REWRITE_TAC[EMPTY_EXISTS];
8361 TYPE_THEN `segment G` SUBGOAL_TAC;
8362 ASM_MESON_TAC[rectagon_segment];
8364 TYPE_THEN `eps = EVEN (num_lower G m)` ASM_CASES_TAC;
8365 TYPE_THEN `squ m` EXISTS_TAC;
8366 ASM_SIMP_TAC [par_cell_squ];
8367 TYPE_THEN `squ (down m)` EXISTS_TAC;
8368 ASM_SIMP_TAC[par_cell_squ];
8373 let par_cell_unions_nonempty = prove_by_refinement(
8374 `!G eps. (rectagon G) ==> ~(UNIONS (par_cell eps G) = EMPTY)`,
8378 REWRITE_TAC[UNIONS;EMPTY_EXISTS ];
8381 USE 0 (MATCH_MP par_cell_nonempty);
8383 USE 0 (REWRITE_RULE[EMPTY_EXISTS]);
8386 TYPE_THEN `u` EXISTS_TAC;
8388 TYPE_THEN `cell u` SUBGOAL_TAC;
8389 ASM_MESON_TAC[par_cell_cell;ISUBSET ];
8390 DISCH_THEN (fun t-> MP_TAC (MATCH_MP cell_nonempty t));
8391 REWRITE_TAC[EMPTY_EXISTS];
8395 let ctop = jordan_def `ctop G =
8396 induced_top top2 (euclid 2 DIFF (UNIONS (curve_cell G)))`;;
8398 let top2_unions = prove_by_refinement(
8399 `UNIONS (top2) = (euclid 2)`,
8403 ASM_MESON_TAC[top_of_metric_unions;metric_euclid];
8407 let curve_closed = prove_by_refinement(
8408 `!G. (segment G) ==> (closed_ top2 (UNIONS (curve_cell G)))`,
8412 ASM_SIMP_TAC[GSYM curve_closure];
8413 IMATCH_MP_TAC closure_closed;
8414 REWRITE_TAC[top2_top];
8415 IMATCH_MP_TAC UNIONS_SUBSET;
8416 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
8417 ASM_MESON_TAC[segment];
8418 REWRITE_TAC[SUBSET;top2_unions;edge; ];
8424 ASM_MESON_TAC[REWRITE_RULE[SUBSET] h_edge_euclid;REWRITE_RULE[SUBSET] v_edge_euclid];
8428 let ctop_unions = prove_by_refinement(
8429 `!G. UNIONS (ctop G) = (euclid 2 DIFF (UNIONS (curve_cell G)))`,
8434 REWRITE_TAC[induced_top_support];
8435 REWRITE_TAC[top2_unions];
8436 REWRITE_TAC[INTER;DIFF;];
8437 IMATCH_MP_TAC EQ_EXT;
8443 let par_cell_partition = prove_by_refinement(
8444 `!G eps. (segment G) ==>
8445 ((UNIONS (par_cell eps G) UNION (UNIONS (par_cell (~eps) G))) =
8446 (UNIONS (ctop G))) `,
8450 IMATCH_MP_TAC SUBSET_ANTISYM ;
8452 REWRITE_TAC[union_subset];
8453 TYPE_THEN `eps` (fun t-> SPEC_TAC (t,t));
8457 IMATCH_MP_TAC UNIONS_SUBSET;
8458 REWRITE_TAC[ctop_unions;DIFF_SUBSET ];
8461 USE 2(MATCH_MP par_cell_curve_disj);
8463 IMATCH_MP_TAC cell_euclid;
8464 ASM_MESON_TAC[par_cell_cell ;ISUBSET ];
8469 REWRITE_TAC[ctop_unions;SUBSET ;DIFF ; UNION ; UNIONS ];
8471 USE 1(MATCH_MP point_onto);
8473 ASSUME_TAC cell_unions;
8475 USE 3 (REWRITE_RULE[UNIONS]);
8477 USE 3 (REWRITE_RULE[cell]);
8485 USE 3(REWRITE_RULE[INR IN_SING;pointI;point_inj ;]);
8486 ASM_REWRITE_TAC[GSYM pointI];
8488 TYPE_THEN `{(pointI p')}` EXISTS_TAC;
8489 ASM_SIMP_TAC[par_cell_point];
8490 REWRITE_TAC[INR IN_SING];
8492 TSPEC `{(pointI p')}` 2;
8494 USE 2(REWRITE_RULE[GSYM pointI;INR IN_SING ]);
8496 ASM_SIMP_TAC [curve_cell_not_point];
8500 TYPE_THEN `h_edge p'` EXISTS_TAC ;
8501 ASM_SIMP_TAC [par_cell_h];
8506 TYPE_THEN `(G (h_edge p'))` SUBGOAL_TAC;
8509 TSPEC `h_edge p'` 2;
8510 ASM_MESON_TAC[curve_cell_h];
8513 TYPE_THEN `v_edge p'` EXISTS_TAC ;
8514 ASM_SIMP_TAC [par_cell_v];
8519 TYPE_THEN `(G (v_edge p'))` SUBGOAL_TAC;
8522 TSPEC `v_edge p'` 2;
8523 ASM_MESON_TAC[curve_cell_v];
8526 TYPE_THEN `squ p'` EXISTS_TAC ;
8527 ASM_SIMP_TAC [par_cell_squ];
8535 (* ------------------------------------------------------------------ *)
8536 (* openness of par_cell *)
8537 (* ------------------------------------------------------------------ *)
8539 let par_cell_h_squ = prove_by_refinement(
8540 `!G m eps. (segment G) /\ (par_cell eps G (h_edge m)) ==>
8541 (par_cell eps G (squ m) /\ par_cell eps G (squ (down m)))`,
8546 ASM_SIMP_TAC [par_cell_h;par_cell_squ];
8548 TYPE_THEN `FINITE G` SUBGOAL_TAC;
8549 ASM_MESON_TAC[segment];
8551 ONCE_REWRITE_TAC [EQ_SYM_EQ];
8552 ASM_SIMP_TAC[num_lower_down];
8553 ASM_MESON_TAC[set_lower_n];
8557 let par_cell_v_squ = prove_by_refinement(
8558 `!G m eps. (rectagon G) /\ (par_cell eps G (v_edge m)) ==>
8559 (par_cell eps G (squ m) /\ par_cell eps G (squ (left m)))`,
8565 TYPE_THEN `segment G` SUBGOAL_TAC;
8566 ASM_MESON_TAC[rectagon_segment];
8567 ASM_SIMP_TAC [par_cell_v;par_cell_squ];
8569 ONCE_REWRITE_TAC [EQ_SYM_EQ];
8570 ASM_SIMP_TAC[REWRITE_RULE[even_cell_squ] squ_left_par];
8576 let segment_finite = prove_by_refinement(
8577 `!G. (segment G) ==> (FINITE G)`,
8580 ASM_MESON_TAC[segment];
8584 let num_closure0_edge = prove_by_refinement(
8585 `!G m. (FINITE G) /\ (num_closure G (pointI m) = 0) ==>
8586 ~G (v_edge m) /\ ~G (v_edge (down m)) /\
8587 ~G (h_edge m) /\ ~G(h_edge (left m))`,
8590 let rule = REWRITE_RULE[down;left ;h_edge_closure;hc_edge;v_edge_closure;vc_edge;UNION ;plus_e12; INR IN_SING ; INT_ARITH `x -: &:1 +: &:1 = x`] in
8594 ASM_SIMP_TAC[num_closure0];
8596 REWRITE_TAC[GSYM DE_MORGAN_THM];
8597 PURE_REWRITE_TAC [GSYM IMP_CLAUSES];
8603 TSPEC `v_edge (down m)` 1;
8607 TSPEC `h_edge ( m)` 1;
8611 TSPEC `h_edge (left m)` 1;
8618 let par_cell_point_h = prove_by_refinement(
8619 `!G m eps. (rectagon G) /\ (par_cell eps G {(pointI m)}) ==>
8620 (par_cell eps G (h_edge m) /\ par_cell eps G (h_edge (left m)))`,
8625 TYPE_THEN `segment G` SUBGOAL_TAC;
8626 ASM_MESON_TAC[rectagon_segment];
8627 ASM_SIMP_TAC [par_cell_h;par_cell_point];
8629 ONCE_REWRITE_TAC [EQ_SYM_EQ];
8630 ASM_SIMP_TAC[REWRITE_RULE[even_cell_squ] squ_left_par];
8632 TYPE_THEN `FINITE G` SUBGOAL_TAC;
8633 ASM_MESON_TAC[segment_finite];
8634 ASM_MESON_TAC[num_closure0_edge];
8638 let par_cell_point_v = prove_by_refinement(
8639 `!G m eps. (rectagon G) /\ (par_cell eps G {(pointI m)}) ==>
8640 (par_cell eps G (v_edge m) /\ par_cell eps G (v_edge (down m)))`,
8645 TYPE_THEN `segment G` SUBGOAL_TAC;
8646 ASM_MESON_TAC[rectagon_segment];
8647 ASM_SIMP_TAC [par_cell_v;par_cell_point];
8649 ONCE_REWRITE_TAC [EQ_SYM_EQ];
8650 TYPE_THEN `FINITE G` SUBGOAL_TAC;
8651 ASM_MESON_TAC[segment_finite];
8652 ASM_SIMP_TAC[num_lower_down];
8653 REWRITE_TAC [set_lower_n];
8654 ASM_MESON_TAC[num_closure0_edge];
8658 let par_cell_point_rectangle = prove_by_refinement(
8659 `!G m eps. (rectagon G) /\ (par_cell eps G {(pointI m)}) ==>
8660 (rectangle (FST m -: &:1,SND m -: &:1) (FST m +: &:1,SND m +: &:1)
8661 SUBSET (UNIONS (par_cell eps G)))`,
8665 TYPE_THEN `segment G` SUBGOAL_TAC;
8666 ASM_SIMP_TAC[rectagon_segment];
8668 REWRITE_TAC[two_two_union;union_subset];
8670 TYPE_THEN `rectangle (FST m -: &:1,SND m -: &:1) (FST m,SND m +: &:1) = rectangle (FST (left m),SND (left m) -: &:1) (FST (left m) +: &:1,SND (left m) +: &:1)` SUBGOAL_TAC;
8671 REWRITE_TAC[left ;INT_ARITH ` x -: &:1 +: &:1 =x`];
8673 REWRITE_TAC[rectangle_h;union_subset ];
8674 TYPE_THEN `par_cell eps G (h_edge (left m))` SUBGOAL_TAC;
8675 ASM_MESON_TAC[par_cell_point_h];
8676 ASM_MESON_TAC[sub_union;par_cell_h_squ];
8678 REWRITE_TAC[long_v_union;union_subset;];
8679 ASM_MESON_TAC[sub_union; par_cell_point_v;];
8680 REWRITE_TAC[rectangle_h;union_subset ];
8681 TYPE_THEN `par_cell eps G (h_edge ( m))` SUBGOAL_TAC;
8682 ASM_MESON_TAC[par_cell_point_h];
8683 ASM_MESON_TAC[sub_union;par_cell_h_squ];
8687 let par_cell_h_rectangle = prove_by_refinement(
8688 `!G m eps. (rectagon G) /\ (par_cell eps G (h_edge m)) ==>
8689 (rectangle (FST m ,SND m -: &:1) (FST m +: &:1,SND m +: &:1)
8690 SUBSET (UNIONS (par_cell eps G)))`,
8694 TYPE_THEN `segment G` SUBGOAL_TAC;
8695 ASM_SIMP_TAC[rectagon_segment];
8697 REWRITE_TAC[rectangle_h;union_subset ];
8698 ASM_MESON_TAC[sub_union;par_cell_h_squ];
8702 let par_cell_v_rectangle = prove_by_refinement(
8703 `!G m eps. (rectagon G) /\ (par_cell eps G (v_edge m)) ==>
8704 (rectangle (FST m -: &:1 ,SND m ) (FST m +: &:1,SND m +: &:1)
8705 SUBSET (UNIONS (par_cell eps G)))`,
8709 TYPE_THEN `segment G` SUBGOAL_TAC;
8710 ASM_SIMP_TAC[rectagon_segment];
8712 REWRITE_TAC[rectangle_v;union_subset ];
8713 ASM_MESON_TAC[sub_union;par_cell_v_squ];
8717 let par_cell_squ_rectangle = prove_by_refinement(
8718 `!G m eps. (rectagon G) /\ (par_cell eps G (squ m)) ==>
8719 (rectangle (FST m ,SND m ) (FST m +: &:1,SND m +: &:1)
8720 SUBSET (UNIONS (par_cell eps G)))`,
8724 REWRITE_TAC[GSYM rectangle_squ];
8725 IMATCH_MP_TAC sub_union;
8730 let par_cell_point_in_rectangle = prove_by_refinement(
8731 `!m. (rectangle (FST m -: &:1,SND m -: &:1)
8732 (FST m +: &:1,SND m +: &:1) (pointI m))`,
8736 REWRITE_TAC[two_two_union;UNION ;long_v_union ; INR IN_SING ;];
8740 let par_cell_h_in_rectangle = prove_by_refinement(
8741 `!m. (h_edge m SUBSET
8742 (rectangle (FST m,SND m -: &:1) (FST m +: &:1,SND m +: &:1)))`,
8746 REWRITE_TAC[rectangle_h; UNION ; ISUBSET; INR IN_SING ;];
8751 let par_cell_v_in_rectangle = prove_by_refinement(
8752 `!m. (v_edge m SUBSET
8753 (rectangle (FST m -: &:1 ,SND m) (FST m +: &:1,SND m +: &:1)))`,
8757 REWRITE_TAC[rectangle_v; UNION ; ISUBSET; INR IN_SING ;];
8762 let ctop_top = prove_by_refinement(
8763 `!G. topology_ (ctop G)`,
8768 IMATCH_MP_TAC induced_top_top;
8769 REWRITE_TAC[top2_top];
8773 let ctop_open = prove_by_refinement(
8774 `!G B eps. (segment G) /\ (B SUBSET UNIONS (par_cell eps G)) /\
8775 (top2 B) ==> (ctop G B)`,
8779 REWRITE_TAC[ctop;induced_top;IMAGE];
8780 TYPE_THEN `B` EXISTS_TAC;
8782 ONCE_REWRITE_TAC [EQ_SYM_EQ];
8783 REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION;GSYM ctop_unions];
8784 ASM_SIMP_TAC[GSYM par_cell_partition];
8785 REWRITE_TAC[UNION;ISUBSET ];
8786 ASM_MESON_TAC[ISUBSET];
8790 let par_cell_open = prove_by_refinement(
8791 `!G eps. (rectagon G) ==> (ctop G (UNIONS (par_cell eps G )))`,
8795 TYPE_THEN `segment G` SUBGOAL_TAC;
8796 ASM_MESON_TAC[rectagon_segment];
8798 ASSUME_TAC ctop_top;
8800 USE 2(MATCH_MP open_nbd);
8802 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]) ;
8806 USE 2(REWRITE_RULE[UNIONS]);
8808 TYPE_THEN `?p. (u = {(pointI p)}) \/ (u = h_edge p) \/ (u = v_edge p) \/ (u = squ p)` SUBGOAL_TAC;
8810 USE 3 (MATCH_MP (REWRITE_RULE[ISUBSET ]par_cell_cell));
8811 USE 3(REWRITE_RULE[cell]);
8813 DISCH_THEN (CHOOSE_THEN MP_TAC );
8814 ASSUME_TAC rectangle_open;
8818 USE 2(REWRITE_RULE[INR IN_SING]);
8820 TYPE_THEN `rectangle (FST p -: &:1,SND p -: &:1) (FST p +: &:1,SND p +: &:1)` EXISTS_TAC;
8821 REWRITE_TAC[par_cell_point_in_rectangle];
8823 ASM_SIMP_TAC[par_cell_point_rectangle];
8824 ASM_MESON_TAC[ctop_open];
8827 TYPE_THEN `rectangle (FST p,SND p -: &:1) (FST p +: &:1,SND p +: &:1)` EXISTS_TAC;
8828 ASM_SIMP_TAC [REWRITE_RULE[ISUBSET] par_cell_h_in_rectangle];
8830 ASM_SIMP_TAC[par_cell_h_rectangle];
8831 ASM_MESON_TAC[ctop_open];
8834 TYPE_THEN `rectangle (FST p -: &:1,SND p ) (FST p +: &:1,SND p +: &:1)` EXISTS_TAC;
8835 ASM_SIMP_TAC [REWRITE_RULE[ISUBSET] par_cell_v_in_rectangle];
8837 ASM_SIMP_TAC[par_cell_v_rectangle];
8838 ASM_MESON_TAC[ctop_open];
8841 TYPE_THEN `rectangle (FST p,SND p ) (FST p +: &:1,SND p +: &:1)` EXISTS_TAC;
8842 ASSUME_TAC rectangle_squ;
8845 ASM_SIMP_TAC[par_cell_squ_rectangle];
8848 ASM_MESON_TAC[PAIR];
8849 ASM_MESON_TAC[ctop_open];
8853 (* ------------------------------------------------------------------ *)
8854 (* start on connected components of ctop G *)
8855 (* ------------------------------------------------------------------ *)
8858 let connected_empty = prove_by_refinement(
8859 `!(U:(A->bool)->bool). connected U EMPTY `,
8862 REWRITE_TAC[connected];
8866 let par_cell_union_disjoint = prove_by_refinement(
8867 `!G eps. (UNIONS (par_cell eps G) INTER (UNIONS (par_cell (~eps) G)) =
8872 REWRITE_TAC[INTER;EQ_EMPTY ;UNIONS;];
8877 TYPE_THEN `cell u /\ cell u'` SUBGOAL_TAC;
8878 ASM_MESON_TAC[par_cell_cell;ISUBSET];
8880 TYPE_THEN `u = u'` SUBGOAL_TAC;
8881 IMATCH_MP_TAC cell_partition;
8882 REWRITE_TAC[EMPTY_EXISTS;INTER ];
8885 ASSUME_TAC par_cell_disjoint;
8886 USE 4(REWRITE_RULE[INTER;EQ_EMPTY]);
8887 TYPEL_THEN[`G`;`eps`;`u`] (USE 4 o ISPECL);
8895 let par_cell_comp = prove_by_refinement(
8896 `!G eps x. (rectagon G) ==>
8897 (component (ctop G) x SUBSET (UNIONS (par_cell eps G))) \/
8898 (component (ctop G) x SUBSET (UNIONS (par_cell (~eps) G)))`,
8903 TYPE_THEN `component (ctop G) x SUBSET (UNIONS (ctop G))` SUBGOAL_TAC;
8904 REWRITE_TAC[component_DEF ;SUBSET ;connected ];
8906 TYPE_THEN `segment G` SUBGOAL_TAC;
8907 ASM_MESON_TAC [rectagon_segment];
8909 ASM_SIMP_TAC[GSYM par_cell_partition];
8912 USE 3 (REWRITE_RULE[DE_MORGAN_THM;SUBSET ]);
8918 TYPE_THEN `component (ctop G) x x'' /\ component (ctop G) x x' ` SUBGOAL_TAC;
8921 TYPE_THEN `component (ctop G) x' x'' ` SUBGOAL_TAC;
8922 ASM_MESON_TAC[component_symm;component_trans];
8924 USE 6(REWRITE_RULE[component_DEF]);
8926 USE 6(REWRITE_RULE[connected]);
8930 TYPE_THEN `A = UNIONS (par_cell eps G)` ABBREV_TAC ;
8931 TYPE_THEN `B = UNIONS (par_cell (~eps) G)` ABBREV_TAC ;
8932 TYPEL_THEN [`A`;`B`] (USE 7 o ISPECL);
8935 TYPE_THEN `ctop G A /\ ctop G B` SUBGOAL_TAC;
8936 ASM_MESON_TAC[par_cell_open];
8938 TYPE_THEN `Z SUBSET (A UNION B)` SUBGOAL_TAC;
8939 ASM_MESON_TAC[par_cell_partition];
8941 TYPE_THEN `A INTER B = EMPTY` SUBGOAL_TAC;
8944 ASM_MESON_TAC[par_cell_union_disjoint;INTER_ACI;];
8946 ASM_MESON_TAC[ISUBSET];
8952 let connected_component = prove_by_refinement(
8953 `!U Z (x:A). (connected U Z) /\ (Z x) ==> (Z SUBSET (component U x)) `,
8956 REWRITE_TAC[component_DEF ;SUBSET ];
8959 TYPE_THEN `Z` EXISTS_TAC;
8964 let cont_mk_segment = prove_by_refinement(
8965 `!x y n. (euclid n x) /\ (euclid n y) ==>
8966 (continuous (joinf (\u. x)
8967 (joinf (\t. euclid_plus (t *# y) ((&1 - t) *# x)) (\u. y) (&.1))
8969 (top_of_metric (UNIV,d_real)) (top_of_metric (euclid n,d_euclid)))`,
8973 IMATCH_MP_TAC joinf_cont;
8975 IMATCH_MP_TAC const_continuous;
8976 IMATCH_MP_TAC top_of_metric_top;
8977 REWRITE_TAC[metric_real];
8979 IMATCH_MP_TAC joinf_cont;
8981 IMATCH_MP_TAC continuous_lin_combo;
8984 IMATCH_MP_TAC const_continuous;
8985 IMATCH_MP_TAC top_of_metric_top;
8986 REWRITE_TAC[metric_real];
8989 REWRITE_TAC[euclid_scale_one; euclid_scale0; euclid_rzero ];
8992 REWRITE_TAC[euclid_scale_one; euclid_scale0; euclid_lzero ];
8996 let mk_segment_image = prove_by_refinement(
8997 `!x y n. (euclid n x) /\ (euclid n y) ==> (?f.
8999 (top_of_metric(UNIV,d_real))
9000 (top_of_metric (euclid n,d_euclid))) /\
9001 (IMAGE f {t | &.0 <=. t /\ t <=. &.1} = mk_segment x y))`,
9005 TYPE_THEN `(joinf (\u. x) (joinf (\t. euclid_plus (t *# y) ((&1 - t) *# x)) (\u. y) (&.1)) (&.0))` EXISTS_TAC;
9007 IMATCH_MP_TAC cont_mk_segment;
9009 REWRITE_TAC[joinf;IMAGE ];
9010 REWRITE_TAC[mk_segment];
9011 IMATCH_MP_TAC EQ_EXT;
9021 ASM_MESON_TAC[REAL_ARITH `~(&0 <=. x /\ x < &.0)`];
9026 TYPE_THEN `&1 - x''` EXISTS_TAC;
9034 ONCE_REWRITE_TAC [euclid_add_comm];
9035 REWRITE_TAC[REAL_ARITH `&1 - (&1 - x) = x`];
9039 TYPE_THEN `&0` EXISTS_TAC;
9044 REWRITE_TAC[euclid_scale_one; euclid_scale0; euclid_lzero;REAL_ARITH `&1 - &0 = &1` ];
9048 TYPE_THEN `&1 - a` EXISTS_TAC ;
9057 ASM_MESON_TAC[REAL_ARITH `&1 - a < &0 ==> ~(a <= &1)`];
9059 REWRITE_TAC[REAL_ARITH `&1 - (&1 - a) = a`];
9060 ASM_MESON_TAC [euclid_add_comm];
9061 TYPE_THEN `a = &.0` SUBGOAL_TAC;
9069 REWRITE_TAC [euclid_scale_one; euclid_scale0; euclid_lzero;REAL_ARITH `&1 - &0 = &1` ];
9073 let euclid_n_convex = prove_by_refinement(
9074 `!n. (convex (euclid n))`,
9078 REWRITE_TAC[convex;mk_segment;SUBSET ];
9083 ASM_MESON_TAC[euclid_add_closure;euclid_scale_closure];
9087 let connected_mk_segment = prove_by_refinement(
9088 `!x y n. (euclid n x) /\ (euclid n y) ==>
9089 (connected (top_of_metric(euclid n,d_euclid)) (mk_segment x y))`,
9093 TYPE_THEN `?f. (continuous f (top_of_metric(UNIV,d_real)) (top_of_metric (euclid n,d_euclid))) /\ (IMAGE f {t | &.0 <=. t /\ t <=. &.1} = mk_segment x y)` SUBGOAL_TAC;
9094 IMATCH_MP_TAC mk_segment_image;
9096 DISCH_THEN CHOOSE_TAC;
9099 IMATCH_MP_TAC connect_image;
9100 TYPE_THEN `(top_of_metric (UNIV,d_real))` EXISTS_TAC;
9105 TYPE_THEN `UNIONS (top_of_metric (euclid n,d_euclid) ) = (euclid n)` SUBGOAL_TAC;
9106 ASM_MESON_TAC [top_of_metric_unions;metric_euclid];
9108 ASM_MESON_TAC[convex;euclid_n_convex];
9109 MATCH_ACCEPT_TAC connect_real;
9113 let ctop_open = prove_by_refinement(
9114 `!G A. (top2 A /\ (A SUBSET (UNIONS (ctop G))) ==> ctop G A)`,
9118 REWRITE_TAC[ctop;induced_top;IMAGE ];
9119 TYPE_THEN `A` EXISTS_TAC;
9121 ONCE_REWRITE_TAC[EQ_SYM_EQ];
9122 REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION];
9123 REWRITE_TAC[GSYM ctop_unions];
9128 let ctop_top2 = prove_by_refinement(
9129 `!G A. (segment G /\ ctop G A ==> top2 A)`,
9132 REWRITE_TAC[ctop;induced_top;IMAGE ;];
9134 TYPE_THEN `U = top_of_metric(euclid 2,d_euclid)` ABBREV_TAC ;
9135 TYPE_THEN `euclid 2 = UNIONS U` SUBGOAL_TAC;
9137 ASM_MESON_TAC[top_of_metric_unions;metric_euclid];
9141 IMATCH_MP_TAC top_inter;
9142 ASM_REWRITE_TAC[top2_top;];
9143 ASM_SIMP_TAC[GSYM curve_closure;top2];
9144 IMATCH_MP_TAC (REWRITE_RULE[open_DEF] closed_open);
9145 IMATCH_MP_TAC closure_closed;
9148 ASM_MESON_TAC[top_of_metric_top;metric_euclid];
9151 IMATCH_MP_TAC UNIONS_SUBSET;
9152 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
9153 ASM_MESON_TAC[segment];
9154 REWRITE_TAC[edge;ISUBSET;];
9161 DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] ;
9162 MATCH_ACCEPT_TAC (REWRITE_RULE[ISUBSET;] v_edge_euclid);
9163 MATCH_ACCEPT_TAC (REWRITE_RULE[ISUBSET;] h_edge_euclid);
9167 let mk_segment_sym_lemma = prove_by_refinement(
9168 `!x y z. (mk_segment x y z ==> mk_segment y x z)`,
9171 REWRITE_TAC[mk_segment];
9174 TYPE_THEN `&1 - a` EXISTS_TAC;
9176 ASM_MESON_TAC[REAL_ARITH `a <= &1 ==> &0 <= &1 - a`];
9178 ASM_MESON_TAC[REAL_ARITH `&0 <= a ==> &1 - a <= &1`];
9179 ONCE_REWRITE_TAC[euclid_add_comm];
9180 ASM_REWRITE_TAC[REAL_ARITH `&1 - (&1 - a) = a`];
9184 let mk_segment_sym = prove_by_refinement(
9185 `!x y. (mk_segment x y = mk_segment y x)`,
9189 IMATCH_MP_TAC EQ_EXT;
9191 EQ_TAC THEN ASM_MESON_TAC[mk_segment_sym_lemma];
9195 let mk_segment_end = prove_by_refinement(
9196 `!x y. (mk_segment x y x /\ mk_segment x y y)`,
9203 REWRITE_TAC[mk_segment];
9204 TYPE_THEN `&1` EXISTS_TAC;
9208 REWRITE_TAC[euclid_scale_one;euclid_scale0;euclid_rzero];
9210 ONCE_REWRITE_TAC[mk_segment_sym];
9215 let convex_connected = prove_by_refinement(
9216 `!G Z. (segment G /\ convex Z) /\ (Z SUBSET (UNIONS (ctop G))) ==>
9217 (connected (ctop G) Z)`,
9221 REWRITE_TAC[connected];
9226 USE 7 (REWRITE_RULE[DE_MORGAN_THM;SUBSET ]);
9232 TYPE_THEN `Z x /\ Z x'` SUBGOAL_TAC;
9235 TYPE_THEN `mk_segment x x' SUBSET A UNION B` SUBGOAL_TAC;
9236 USE 1(REWRITE_RULE[convex]);
9237 ASM_MESON_TAC[ISUBSET];
9239 TYPE_THEN `connected (top_of_metric(euclid 2,d_euclid)) (mk_segment x x')` SUBGOAL_TAC;
9240 IMATCH_MP_TAC connected_mk_segment;
9241 USE 2(REWRITE_RULE[ctop_unions;SUBSET;DIFF;]);
9243 REWRITE_TAC[connected];
9246 TYPEL_THEN [`A`;`B`] (USE 11 o ISPECL);
9248 TYPE_THEN `top_of_metric (euclid 2,d_euclid) A /\ top_of_metric (euclid 2,d_euclid) B` SUBGOAL_TAC;
9249 REWRITE_TAC[GSYM top2];
9250 ASM_MESON_TAC[ctop_top2;top2];
9254 REWRITE_TAC[DE_MORGAN_THM;ISUBSET;];
9257 TYPE_THEN `x'` EXISTS_TAC;
9258 REWRITE_TAC[mk_segment_end];
9261 TYPE_THEN `x` EXISTS_TAC;
9262 REWRITE_TAC[mk_segment_end];
9267 let component_replace = prove_by_refinement(
9268 `!U (x:A) y. component U x y ==> (component U x = component U y)`,
9273 IMATCH_MP_TAC EQ_EXT;
9277 USE 0(MATCH_MP component_symm);
9278 ASM_MESON_TAC[component_trans];
9279 ASM_MESON_TAC[component_trans;component_symm];
9284 let convex_component = prove_by_refinement(
9285 `!G Z x. (segment G /\ convex Z /\ (Z SUBSET (UNIONS (ctop G))) /\
9286 (~(Z INTER (component (ctop G) x ) = EMPTY)) ==>
9287 (Z SUBSET (component (ctop G) x))) `,
9291 TYPE_THEN `connected (ctop G) Z` SUBGOAL_TAC;
9292 ASM_SIMP_TAC[convex_connected];
9294 USE 3(REWRITE_RULE[EMPTY_EXISTS;INTER ]);
9297 USE 3(MATCH_MP component_replace);
9299 IMATCH_MP_TAC connected_component;
9304 let cell_convex = prove_by_refinement(
9305 `!C. (cell C) ==> (convex C)`,
9310 DISCH_THEN (CHOOSE_THEN MP_TAC ) THEN REP_CASES_TAC THEN ASM_REWRITE_TAC[v_edge_convex;h_edge_convex;convex_pointI;rectangle_squ;rectangle_convex];
9315 (* ------------------------------------------------------------------ *)
9317 let cell_of = jordan_def `cell_of C = { A | (cell A) /\ (A SUBSET C) }`;;
9319 let unions_cell_of = prove_by_refinement(
9320 `!G x. (segment G ==>
9321 (UNIONS (cell_of (component (ctop G) x)) =
9322 component (ctop G) x))`,
9326 IMATCH_MP_TAC SUBSET_ANTISYM;
9327 REWRITE_TAC[UNIONS;SUBSET;cell_of];
9334 TYPE_THEN `(euclid 2 x')` SUBGOAL_TAC;
9336 REWRITE_TAC[component_DEF ;connected;SUBSET ;ctop_unions;DIFF ];
9337 DISCH_THEN CHOOSE_TAC;
9340 USE 2 (MATCH_MP point_onto);
9344 ASSUME_TAC cell_unions;
9346 USE 3 (REWRITE_RULE[UNIONS]);
9348 TYPE_THEN `u` EXISTS_TAC;
9349 TYPE_THEN `u SUBSET (component (ctop G) x) ==> (!x'. u x' ==> component (ctop G) x x')` SUBGOAL_TAC;
9350 REWRITE_TAC[ISUBSET];
9352 DISCH_THEN IMATCH_MP_TAC ;
9353 IMATCH_MP_TAC convex_component ;
9354 ASM_REWRITE_TAC[EMPTY_EXISTS];
9356 ASM_MESON_TAC[cell_convex];
9358 REWRITE_TAC[ctop_unions];
9359 REWRITE_TAC[DIFF;SUBSET ];
9365 ASM_MESON_TAC[cell_euclid;ISUBSET];
9366 REWRITE_TAC[UNIONS];
9370 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
9371 ASM_MESON_TAC[segment];
9373 USE 6 (MATCH_MP curve_cell_cell);
9374 USE 6 (REWRITE_RULE[ISUBSET]);
9377 TYPE_THEN `u = u'` SUBGOAL_TAC;
9378 IMATCH_MP_TAC cell_partition;
9379 REWRITE_TAC[EMPTY_EXISTS;INTER];
9382 USE 1 (REWRITE_RULE[component_DEF;connected;SUBSET ]);
9383 TYPE_THEN `UNIONS (ctop G) (point p)` SUBGOAL_TAC;
9385 REWRITE_TAC[ctop_unions;DIFF ;UNIONS ;DE_MORGAN_THM ];
9389 TYPE_THEN `point p` EXISTS_TAC;
9390 ASM_REWRITE_TAC [INTER];
9397 (* ------------------------------------------------------------------ *)
9399 (* ------------------------------------------------------------------ *)
9401 (* ------------------------------------------------------------------ *)
9402 (* num_abs_of_int *)
9403 (* ------------------------------------------------------------------ *)
9405 let num_abs_of_int_exists = prove_by_refinement(
9406 `!m. ?i. &i = abs (real_of_int(m))`,
9410 REWRITE_TAC[GSYM int_abs_th];
9411 ASSUME_TAC dest_int_rep;
9414 TYPE_THEN `n` EXISTS_TAC;
9416 DISCH_THEN DISJ_CASES_TAC;
9418 WITH 0 (REWRITE_RULE[int_abs_th]);
9419 TYPE_THEN `&0 <= abs (real_of_int m)` SUBGOAL_TAC;
9420 REWRITE_TAC[REAL_ABS_POS];
9421 TYPE_THEN `abs (real_of_int m) <= &.0` SUBGOAL_TAC;
9429 let num_abs_of_int_select = new_definition
9430 `num_abs_of_int m = @i. (&i = abs (real_of_int m))`;;
9432 let num_abs_of_int_th = prove_by_refinement(
9433 `!m. &(num_abs_of_int m) = abs (real_of_int m)`,
9437 REWRITE_TAC[num_abs_of_int_select];
9440 ASM_MESON_TAC[num_abs_of_int_exists];
9444 let num_abs_of_int_mul = prove_by_refinement(
9445 `!m n. (num_abs_of_int (m * n) = num_abs_of_int m * num_abs_of_int n)`,
9448 REWRITE_TAC[GSYM REAL_OF_NUM_EQ;GSYM REAL_MUL;num_abs_of_int_th;int_mul_th;ABS_MUL;];
9452 let num_abs_of_int_num = prove_by_refinement(
9453 `!n. (num_abs_of_int (&: n) = n)`,
9456 REWRITE_TAC[GSYM REAL_OF_NUM_EQ;num_abs_of_int_th;int_of_num_th;REAL_ABS_NUM;];
9460 let num_abs_of_int_triangle = prove_by_refinement(
9461 `!n m. num_abs_of_int (m + n) <=|
9462 num_abs_of_int(m) +| num_abs_of_int n`,
9466 REWRITE_TAC[GSYM REAL_OF_NUM_LE;num_abs_of_int_th;int_add_th;GSYM REAL_OF_NUM_ADD;ABS_TRIANGLE;];
9470 let num_abs_of_int0 = prove_by_refinement(
9471 `!m. (num_abs_of_int m = 0) <=> (m = &:0)`,
9475 REWRITE_TAC[GSYM REAL_OF_NUM_EQ;num_abs_of_int_th;REAL_ABS_ZERO;];
9476 REWRITE_TAC[int_eq;];
9477 REWRITE_TAC[int_of_num_th;];
9481 let num_abs_of_int_neg = prove_by_refinement(
9482 `!m. (num_abs_of_int (--: m) = num_abs_of_int m)`,
9486 REWRITE_TAC[GSYM REAL_OF_NUM_EQ;num_abs_of_int_th;int_neg_th;REAL_ABS_NEG;];
9490 let num_abs_of_int_suc = prove_by_refinement(
9491 `!m. (&:0 <=: m) ==>
9492 (SUC (num_abs_of_int m) = num_abs_of_int (m +: &:1))`,
9495 REWRITE_TAC[int_le;int_of_num_th;];
9497 REWRITE_TAC[GSYM REAL_OF_NUM_EQ;num_abs_of_int_th;ADD1;GSYM REAL_ADD;int_suc];
9503 let num_abs_of_int_pre = prove_by_refinement(
9504 `!m. (m <=: &:0) ==>
9505 (SUC (num_abs_of_int m) = num_abs_of_int (m -: &:1))`,
9508 REWRITE_TAC[int_le;int_of_num_th;];
9510 REWRITE_TAC[GSYM REAL_OF_NUM_EQ;num_abs_of_int_th;ADD1;GSYM REAL_ADD;int_suc;int_sub_th;int_of_num_th;];
9516 (* ------------------------------------------------------------------ *)
9517 (* closure of squares *)
9518 (* ------------------------------------------------------------------ *)
9520 let right_left = prove_by_refinement(
9521 `!m. (right (left m) = m) /\ (left (right m) = m) /\
9522 (up (down m) = m) /\ (down (up m) = m) /\
9523 (up (right m) = right (up m)) /\ (up (left m) = left (up m)) /\
9524 (down (right m) = right (down m)) /\
9525 (down (left m) = (left (down m)))`,
9528 REWRITE_TAC[right ;left ;up;down;PAIR_SPLIT];
9533 let squc = jordan_def `squc p = {Z | ?u v.
9534 (Z = point (u,v)) /\
9535 real_of_int (FST p) <= u /\
9536 u <= real_of_int (FST p +: &:1) /\
9537 real_of_int (SND p) <= v /\
9538 v <= real_of_int (SND p +: &:1)}`;;
9540 let squc_inter = prove_by_refinement(
9542 {z | ?r. (z = point r) /\ real_of_int (FST p) <= FST r} INTER
9543 {z | ?r. (z = point r) /\ real_of_int (SND p) <= SND r} INTER
9544 {z | ?r. (z = point r) /\ FST r <= real_of_int (FST p +: &:1)} INTER
9545 {z | ?r. (z = point r) /\ SND r <= real_of_int (SND p +: &:1)}`,
9551 IMATCH_MP_TAC EQ_EXT;
9558 ASM_REWRITE_TAC[point_inj;];
9559 CONV_TAC (dropq_conv "r");
9561 CONV_TAC (dropq_conv "r");
9563 CONV_TAC (dropq_conv "r'");
9565 CONV_TAC (dropq_conv "r");
9571 REWRITE_TAC[point_inj;PAIR_SPLIT ;];
9572 CONV_TAC (dropq_conv "u");
9573 CONV_TAC (dropq_conv "v");
9574 USE 1 (REWRITE_RULE[point_inj;]);
9575 USE 1 (CONV_RULE (dropq_conv "r'"));
9577 USE 2 (REWRITE_RULE[point_inj;]);
9578 USE 2 (CONV_RULE (dropq_conv "r'"));
9580 USE 3 (REWRITE_RULE[point_inj;]);
9581 USE 3 (CONV_RULE (dropq_conv "r'"));
9587 let squc_closed = prove_by_refinement(
9588 `!p. closed_ (top2) (squc p)`,
9592 ASSUME_TAC top2_top;
9593 REWRITE_TAC[squc_inter];
9594 ASM_SIMP_TAC[closed_inter2;closed_half_plane2D_LTS_closed;closed_half_plane2D_SLT_closed;closed_half_plane2D_LTF_closed;closed_half_plane2D_FLT_closed];
9598 let squ_subset_sqc = prove_by_refinement(
9599 `!p. (squ p SUBSET (squc p))`,
9603 REWRITE_TAC[SUBSET;squ;squc];
9608 TYPE_THEN `u` EXISTS_TAC;
9609 TYPE_THEN `v` EXISTS_TAC;
9610 ASM_MESON_TAC[REAL_ARITH `x < y ==> x <=. y`];
9614 let squc_union_lemma1 = prove_by_refinement(
9616 {z | ?r. (z = point r) /\ (real_of_int(FST p) = FST r)} =
9617 {(pointI p)} UNION (v_edge p) UNION {(pointI (up p))}`,
9621 IMATCH_MP_TAC EQ_EXT;
9623 REWRITE_TAC[squc;UNION ;INR IN_SING ;INTER ;up; int_of_num_th; int_add_th;];
9629 USE 1(REWRITE_RULE[point_inj]);
9630 USE 1(CONV_RULE (dropq_conv "r"));
9635 REWRITE_TAC[REAL_ARITH `(x <=y) <=> (y = x) \/ (x <. y)`];
9643 ASM_MESON_TAC[REAL_ARITH `~(v = v + &.1)`];
9645 REWRITE_TAC[pointI;int_suc;];
9646 ASM_REWRITE_TAC[pointI];
9647 REWRITE_TAC[v_edge];
9650 REWRITE_TAC[point_inj; PAIR_SPLIT];
9651 CONV_TAC (dropq_conv "u");
9652 CONV_TAC (dropq_conv "v'");
9654 ASM_REWRITE_TAC[int_suc];
9656 ASM_REWRITE_TAC[pointI;point_inj;];
9658 REWRITE_TAC[PAIR_SPLIT];
9659 CONV_TAC (dropq_conv "u");
9660 CONV_TAC (dropq_conv "v");
9662 CONV_TAC (dropq_conv "r");
9663 USE 0 (REWRITE_RULE[v_edge]);
9667 REWRITE_TAC[point_inj];
9669 REWRITE_TAC[PAIR_SPLIT];
9670 CONV_TAC (dropq_conv "u");
9671 CONV_TAC (dropq_conv "v'");
9674 REWRITE_TAC[int_suc];
9676 CONV_TAC (dropq_conv "r");
9678 ASM_REWRITE_TAC[pointI;point_inj;];
9680 REWRITE_TAC[PAIR_SPLIT];
9681 CONV_TAC (dropq_conv "u");
9682 CONV_TAC (dropq_conv "v");
9683 REWRITE_TAC[int_suc];
9685 CONV_TAC (dropq_conv "r");
9689 let squc_union_lemma2 = prove_by_refinement(
9691 {z | ?r. (z = point r) /\ (real_of_int(FST p) + &1= FST r )} =
9692 {(pointI (right p))} UNION (v_edge (right p)) UNION
9693 {(pointI (up (right p)))}`,
9697 IMATCH_MP_TAC EQ_EXT;
9699 REWRITE_TAC[squc;right ;UNION ;INR IN_SING ;INTER ;up; int_of_num_th; int_add_th;];
9705 USE 1(REWRITE_RULE[point_inj]);
9706 USE 1(CONV_RULE (dropq_conv "r"));
9711 REWRITE_TAC[REAL_ARITH `(x <=y) <=> (y = x) \/ (x <. y)`];
9719 ASM_MESON_TAC[REAL_ARITH `~(v = v + &.1)`];
9721 REWRITE_TAC[pointI;int_suc;];
9723 ASM_REWRITE_TAC[pointI;int_suc;];
9725 REWRITE_TAC[v_edge];
9728 REWRITE_TAC[point_inj; PAIR_SPLIT];
9729 CONV_TAC (dropq_conv "u");
9730 REWRITE_TAC[int_suc];
9731 CONV_TAC (dropq_conv "v'");
9734 ASM_REWRITE_TAC[int_suc];
9736 ASM_REWRITE_TAC[pointI;point_inj;];
9738 REWRITE_TAC[PAIR_SPLIT];
9739 CONV_TAC (dropq_conv "u");
9740 CONV_TAC (dropq_conv "v");
9741 ASM_REWRITE_TAC[int_suc];
9743 CONV_TAC (dropq_conv "r");
9744 REWRITE_TAC[int_suc];
9746 USE 0 (REWRITE_RULE[v_edge]);
9750 REWRITE_TAC[point_inj];
9752 REWRITE_TAC[PAIR_SPLIT];
9753 CONV_TAC (dropq_conv "u");
9754 CONV_TAC (dropq_conv "v'");
9757 REWRITE_TAC[int_suc];
9759 CONV_TAC (dropq_conv "r");
9760 REWRITE_TAC[int_suc];
9762 ASM_REWRITE_TAC[pointI;point_inj;];
9764 REWRITE_TAC[PAIR_SPLIT];
9765 CONV_TAC (dropq_conv "u");
9766 CONV_TAC (dropq_conv "v");
9767 REWRITE_TAC[int_suc];
9769 CONV_TAC (dropq_conv "r");
9770 REWRITE_TAC[int_suc];
9774 let squc_union_lemma3 = prove_by_refinement(
9776 {z | ?r. (z = point r) /\ (FST r <. real_of_int(FST p) + &1 ) /\
9777 (real_of_int(FST p) <. FST r) } =
9778 (h_edge p) UNION squ p UNION (h_edge (up p))`,
9782 IMATCH_MP_TAC EQ_EXT;
9784 REWRITE_TAC[INTER;squc;UNION;];
9790 USE 1 (REWRITE_RULE[point_inj]);
9791 USE 1 (CONV_RULE (dropq_conv "r"));
9799 REWRITE_TAC[REAL_ARITH `(x <= y) <=> (y = x) \/ (x <. y)`;int_suc];
9801 ASM_MESON_TAC[REAL_ARITH `~(v = v + &1)`];
9803 REWRITE_TAC[up;h_edge];
9806 REWRITE_TAC[point_inj;];
9807 REWRITE_TAC[PAIR_SPLIT];
9808 CONV_TAC (dropq_conv "u'");
9809 CONV_TAC (dropq_conv "v");
9810 ASM_REWRITE_TAC[int_suc];
9814 REWRITE_TAC[h_edge;point_inj;PAIR_SPLIT];
9815 CONV_TAC (dropq_conv "u'");
9816 CONV_TAC (dropq_conv "v");
9817 ASM_REWRITE_TAC[int_suc];
9821 REWRITE_TAC[squ;point_inj;PAIR_SPLIT];
9822 CONV_TAC (dropq_conv "u'");
9823 CONV_TAC (dropq_conv "v'");
9824 ASM_REWRITE_TAC[int_suc];
9827 TYPE_THEN `?q. x = point q` ASM_CASES_TAC;
9829 ASM_REWRITE_TAC[point_inj];
9831 REWRITE_TAC[PAIR_SPLIT];
9832 CONV_TAC (dropq_conv "u");
9833 CONV_TAC (dropq_conv "v");
9836 REWRITE_TAC[h_edge;squ;up;int_suc ;point_inj; PAIR_SPLIT ;];
9838 USE 0 (CONV_RULE (dropq_conv "u"));
9839 USE 0 (CONV_RULE (dropq_conv "v"));
9842 USE 0 (CONV_RULE (dropq_conv "u"));
9843 USE 0 (CONV_RULE (dropq_conv "v"));
9846 USE 0 (CONV_RULE (dropq_conv "u"));
9847 USE 0 (CONV_RULE (dropq_conv "v"));
9850 CONV_TAC (dropq_conv "r");
9853 REWRITE_TAC[h_edge;squ;up;int_suc ;point_inj; PAIR_SPLIT ;];
9855 USE 0 (CONV_RULE (dropq_conv "u"));
9856 USE 0 (CONV_RULE (dropq_conv "v"));
9859 USE 0 (CONV_RULE (dropq_conv "u"));
9860 USE 0 (CONV_RULE (dropq_conv "v"));
9863 USE 0 (CONV_RULE (dropq_conv "u"));
9864 USE 0 (CONV_RULE (dropq_conv "v"));
9872 IMATCH_MP_TAC point_onto;
9873 ASM_MESON_TAC[h_edge_euclid;squ_euclid;v_edge_euclid;ISUBSET ];
9877 let squc_lemma4 = prove_by_refinement(
9879 {z | ?r. (z = point r) /\ (real_of_int(FST p) = FST r)} UNION
9880 {z | ?r. (z = point r) /\ (real_of_int(FST p) + &1= FST r )} UNION
9881 {z | ?r. (z = point r) /\ (FST r <. real_of_int(FST p) + &1 ) /\
9882 (real_of_int(FST p) <. FST r) } `,
9885 REWRITE_TAC[SUBSET;UNION ;squc ];
9889 ASM_REWRITE_TAC[point_inj ;];
9891 CONV_TAC (dropq_conv "r");
9896 ASM_REWRITE_TAC[int_suc];
9901 let squc_union = prove_by_refinement(
9902 `!p. squc p = {(pointI p)} UNION {(pointI (right p))} UNION
9903 {(pointI (up p))} UNION {(pointI (up (right p)))} UNION
9904 (h_edge p) UNION (h_edge (up p)) UNION
9905 (v_edge p) UNION (v_edge (right p)) UNION
9910 TYPE_THEN `squc p = squc p INTER ({z | ?r. (z = point r) /\ (real_of_int(FST p) = FST r)} UNION {z | ?r. (z = point r) /\ (real_of_int(FST p) + &1= FST r )} UNION {z | ?r. (z = point r) /\ (FST r <. real_of_int(FST p) + &1 ) /\ (real_of_int(FST p) <. FST r) } )` SUBGOAL_TAC;
9911 ONCE_REWRITE_TAC[EQ_SYM_EQ];
9912 REWRITE_TAC [GSYM SUBSET_INTER_ABSORPTION];
9913 MATCH_ACCEPT_TAC squc_lemma4;
9914 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
9915 REWRITE_TAC[UNION_OVER_INTER];
9916 REWRITE_TAC[squc_union_lemma1;squc_union_lemma2;squc_union_lemma3];
9917 REWRITE_TAC[UNION_ACI];
9921 let squ_closure_h = prove_by_refinement(
9922 `!p. (h_edge p) SUBSET (closure top2 (squ p))`,
9925 REWRITE_TAC[SUBSET;];
9927 ASM_REWRITE_TAC[top2];
9928 IMATCH_MP_TAC closure_segment;
9929 ASM_REWRITE_TAC[squ_euclid];
9930 TYPE_THEN `?q. (x = point q)` SUBGOAL_TAC ;
9931 IMATCH_MP_TAC point_onto;
9932 ASM_MESON_TAC[REWRITE_RULE[ISUBSET] h_edge_euclid];
9937 TYPE_THEN `point (FST q, SND q + &1)` EXISTS_TAC;
9938 REWRITE_TAC[point_scale;point_add;];
9940 TYPE_THEN `point q = point (FST q,SND q)` SUBGOAL_TAC;
9942 DISCH_THEN (fun t-> PURE_REWRITE_TAC [t]);
9943 PURE_REWRITE_TAC[point_add;point_scale];
9944 REWRITE_TAC[h_edge;squ;point_inj;PAIR_SPLIT;];
9946 USE 0 (CONV_RULE (dropq_conv "u"));
9947 USE 0 (CONV_RULE (dropq_conv "v"));
9949 CONV_TAC (dropq_conv "u");
9950 CONV_TAC (dropq_conv "v");
9952 REWRITE_TAC[int_suc];
9953 ASSUME_TAC (real_poly_conv `t *x + (&1 - t)* x`);
9956 ASSUME_TAC (real_poly_conv `t *(y + &1) + (&1- t)* y`);
9966 let squ_closure_up_h = prove_by_refinement(
9967 `!p. (h_edge (up p)) SUBSET (closure top2 (squ p))`,
9970 REWRITE_TAC[SUBSET;up ];
9972 ASM_REWRITE_TAC[top2];
9973 IMATCH_MP_TAC closure_segment;
9974 ASM_REWRITE_TAC[squ_euclid];
9975 TYPE_THEN `?q. (x = point q)` SUBGOAL_TAC ;
9976 IMATCH_MP_TAC point_onto;
9977 ASM_MESON_TAC[REWRITE_RULE[ISUBSET] h_edge_euclid];
9982 TYPE_THEN `point (FST q , SND q - &1)` EXISTS_TAC;
9983 REWRITE_TAC[point_scale;point_add;];
9985 TYPE_THEN `point q = point (FST q,SND q)` SUBGOAL_TAC;
9987 DISCH_THEN (fun t-> PURE_REWRITE_TAC [t]);
9988 PURE_REWRITE_TAC[point_add;point_scale];
9989 REWRITE_TAC[h_edge;squ;point_inj;PAIR_SPLIT;];
9991 USE 0 (CONV_RULE (dropq_conv "u"));
9992 USE 0 (CONV_RULE (dropq_conv "v"));
9994 CONV_TAC (dropq_conv "u");
9995 CONV_TAC (dropq_conv "v");
9997 REWRITE_TAC[int_suc];
9998 ASSUME_TAC (real_poly_conv `t *x + (&1 - t)* x`);
10001 ASSUME_TAC (real_poly_conv `t *(y - &1) + (&1- t)* y`);
10011 let squ_closure_down_h = prove_by_refinement(
10012 `!p. (h_edge p SUBSET (closure top2 (squ (down p))))`,
10017 ASSUME_TAC squ_closure_up_h ;
10019 USE 0 (REWRITE_RULE [right_left]);
10025 let squ_closure_v = prove_by_refinement(
10026 `!p. (v_edge p) SUBSET (closure top2 (squ p))`,
10029 REWRITE_TAC[SUBSET;];
10031 ASM_REWRITE_TAC[top2];
10032 IMATCH_MP_TAC closure_segment;
10033 ASM_REWRITE_TAC[squ_euclid];
10034 TYPE_THEN `?q. (x = point q)` SUBGOAL_TAC ;
10035 IMATCH_MP_TAC point_onto;
10036 ASM_MESON_TAC[REWRITE_RULE[ISUBSET] v_edge_euclid];
10041 TYPE_THEN `point (FST q + &1, SND q )` EXISTS_TAC;
10042 REWRITE_TAC[point_scale;point_add;];
10044 TYPE_THEN `point q = point (FST q,SND q)` SUBGOAL_TAC;
10046 DISCH_THEN (fun t-> PURE_REWRITE_TAC [t]);
10047 PURE_REWRITE_TAC[point_add;point_scale];
10048 REWRITE_TAC[v_edge;squ;point_inj;PAIR_SPLIT;];
10050 USE 0 (CONV_RULE (dropq_conv "u"));
10051 USE 0 (CONV_RULE (dropq_conv "v"));
10053 CONV_TAC (dropq_conv "u");
10054 CONV_TAC (dropq_conv "v");
10056 REWRITE_TAC[int_suc];
10057 ASSUME_TAC (real_poly_conv `t *x + (&1 - t)* x`);
10060 ASSUME_TAC (real_poly_conv `t *(y + &1) + (&1- t)* y`);
10070 let squ_closure_right_v = prove_by_refinement(
10071 `!p. (v_edge (right p)) SUBSET (closure top2 (squ p))`,
10074 REWRITE_TAC[SUBSET;right ];
10076 ASM_REWRITE_TAC[top2];
10077 IMATCH_MP_TAC closure_segment;
10078 ASM_REWRITE_TAC[squ_euclid];
10079 TYPE_THEN `?q. (x = point q)` SUBGOAL_TAC ;
10080 IMATCH_MP_TAC point_onto;
10081 ASM_MESON_TAC[REWRITE_RULE[ISUBSET] v_edge_euclid];
10086 TYPE_THEN `point (FST q - &1 , SND q )` EXISTS_TAC;
10087 REWRITE_TAC[point_scale;point_add;];
10089 TYPE_THEN `point q = point (FST q,SND q)` SUBGOAL_TAC;
10091 DISCH_THEN (fun t-> PURE_REWRITE_TAC [t]);
10092 PURE_REWRITE_TAC[point_add;point_scale];
10093 REWRITE_TAC[v_edge;squ;point_inj;PAIR_SPLIT;];
10095 USE 0 (CONV_RULE (dropq_conv "u"));
10096 USE 0 (CONV_RULE (dropq_conv "v"));
10098 CONV_TAC (dropq_conv "u");
10099 CONV_TAC (dropq_conv "v");
10101 REWRITE_TAC[int_suc];
10102 ASSUME_TAC (real_poly_conv `t *x + (&1 - t)* x`);
10105 ASSUME_TAC (real_poly_conv `t *(y - &1) + (&1- t)* y`);
10115 let squ_closure_left_v = prove_by_refinement(
10116 `!p. (v_edge p SUBSET (closure top2 (squ (left p))))`,
10120 ASSUME_TAC squ_closure_right_v;
10122 USE 0 (REWRITE_RULE[right_left]);
10127 let squ_closure_hc = prove_by_refinement(
10128 `!p. (hc_edge p) SUBSET (closure top2 (squ p))`,
10133 REWRITE_TAC[GSYM h_edge_closure];
10134 IMATCH_MP_TAC closure_subset;
10135 ASSUME_TAC top2_top;
10136 ASM_REWRITE_TAC[squ_closure_h];
10137 IMATCH_MP_TAC closure_closed;
10138 ASM_REWRITE_TAC[top2_unions;squ_euclid];
10143 let squ_closure_up_hc = prove_by_refinement(
10144 `!p. (hc_edge (up p)) SUBSET (closure top2 (squ p))`,
10148 REWRITE_TAC[GSYM h_edge_closure];
10149 IMATCH_MP_TAC closure_subset;
10150 ASSUME_TAC top2_top;
10151 ASM_REWRITE_TAC[squ_closure_up_h];
10152 IMATCH_MP_TAC closure_closed;
10153 ASM_REWRITE_TAC[top2_unions;squ_euclid];
10157 let squ_closure_vc = prove_by_refinement(
10158 `!p. (vc_edge p) SUBSET (closure top2 (squ p))`,
10162 REWRITE_TAC[GSYM v_edge_closure];
10163 IMATCH_MP_TAC closure_subset;
10164 ASSUME_TAC top2_top;
10165 ASM_REWRITE_TAC[squ_closure_v];
10166 IMATCH_MP_TAC closure_closed;
10167 ASM_REWRITE_TAC[top2_unions;squ_euclid];
10171 let squ_closure = prove_by_refinement(
10172 `!p. (closure top2 (squ p)) = (squc p)`,
10177 ASSUME_TAC top2_top;
10178 IMATCH_MP_TAC SUBSET_ANTISYM;
10180 IMATCH_MP_TAC closure_subset;
10181 ASM_REWRITE_TAC[squc_closed];
10182 REWRITE_TAC[squc_union];
10183 REWRITE_TAC[SUBSET;UNION];
10185 REWRITE_TAC[squc_union];
10186 REWRITE_TAC[union_subset];
10187 ASSUME_TAC squ_closure_hc;
10189 ASSUME_TAC squ_closure_up_hc;
10191 USE 1 (REWRITE_RULE[hc_edge;plus_e12;union_subset]);
10192 USE 2 (REWRITE_RULE[hc_edge;plus_e12;up;union_subset]);
10193 ASM_REWRITE_TAC [up;right;squ_closure_v;REWRITE_RULE[right ] squ_closure_right_v ];
10194 ASM_SIMP_TAC[subset_closure];
10199 (* ------------------------------------------------------------------ *)
10201 (* ------------------------------------------------------------------ *)
10204 let adj_edge = jordan_def `adj_edge x y <=> (~(x = y)) /\
10206 (e SUBSET (closure top2 x)) /\ (e SUBSET (closure top2 y)))`;;
10208 let adj_edge_sym = prove_by_refinement(
10209 `!x y. (adj_edge x y = adj_edge y x)`,
10212 REWRITE_TAC[adj_edge];
10217 let adj_edge_left = prove_by_refinement(
10218 `!m. (adj_edge (squ m) (squ (left m)))`,
10222 REWRITE_TAC[adj_edge];
10223 REWRITE_TAC[squ_closure;squ_inj;];
10225 REWRITE_TAC[left ;PAIR_SPLIT;];
10227 TYPE_THEN `v_edge m` EXISTS_TAC;
10228 REWRITE_TAC[edge;v_edge_inj;];
10229 CONV_TAC (dropq_conv "m'");
10230 REWRITE_TAC[squc_union; SUBSET;UNION ;];
10231 REWRITE_TAC[right_left];
10236 let adj_edge_right = prove_by_refinement(
10237 `!m. (adj_edge (squ m) (squ (right m)))`,
10241 REWRITE_TAC[adj_edge];
10242 REWRITE_TAC[squ_closure;squ_inj;];
10244 REWRITE_TAC[right ;PAIR_SPLIT;];
10246 TYPE_THEN `v_edge (right m)` EXISTS_TAC;
10247 REWRITE_TAC[edge;v_edge_inj;];
10248 CONV_TAC (dropq_conv "m'");
10249 REWRITE_TAC[squc_union; SUBSET;UNION ;];
10254 let adj_edge_down = prove_by_refinement(
10255 `!m. (adj_edge (squ m) (squ (down m)))`,
10259 REWRITE_TAC[adj_edge];
10260 REWRITE_TAC[squ_closure;squ_inj;];
10262 REWRITE_TAC[down ;PAIR_SPLIT;];
10264 TYPE_THEN `h_edge m` EXISTS_TAC;
10265 REWRITE_TAC[edge;h_edge_inj;];
10266 CONV_TAC (dropq_conv "m'");
10267 REWRITE_TAC[squc_union; SUBSET;UNION ;];
10268 REWRITE_TAC[right_left];
10273 let adj_edge_right = prove_by_refinement(
10274 `!m. (adj_edge (squ m) (squ (up m)))`,
10278 REWRITE_TAC[adj_edge];
10279 REWRITE_TAC[squ_closure;squ_inj;];
10281 REWRITE_TAC[up ;PAIR_SPLIT;];
10283 TYPE_THEN `h_edge (up m)` EXISTS_TAC;
10284 REWRITE_TAC[edge;h_edge_inj;];
10285 CONV_TAC (dropq_conv "m'");
10286 REWRITE_TAC[squc_union; SUBSET;UNION ;];
10291 (* ------------------------------------------------------------------ *)
10293 (* ------------------------------------------------------------------ *)
10295 let rectangle_euclid = prove_by_refinement(
10296 `!p q. (rectangle p q SUBSET (euclid 2))`,
10299 REWRITE_TAC[rectangle;SUBSET ;];
10303 ASM_REWRITE_TAC[euclid_point];
10307 let component_unions = prove_by_refinement(
10308 `!U (x:A). (component U x SUBSET (UNIONS U))`,
10311 REWRITE_TAC[SUBSET; component_DEF; connected ;];
10316 let comp_h_rect = prove_by_refinement(
10317 `!G m x. (segment G /\
10318 (h_edge m SUBSET component (ctop G) x)) ==>
10319 (rectangle (FST m , SND m -: &:1) (FST m +: &:1,SND m +: &:1)
10320 SUBSET component (ctop G) x)`,
10324 IMATCH_MP_TAC convex_component;
10325 ASM_REWRITE_TAC[rectangle_convex; ctop_unions;];
10327 REWRITE_TAC[DIFF_SUBSET;rectangle_euclid];
10328 REWRITE_TAC[rectangle_h; EQ_EMPTY ;UNION ; INTER;];
10331 TYPE_THEN `~(squ (down m) x') /\ ~(squ m x')` SUBGOAL_TAC;
10332 USE 0(MATCH_MP curve_cell_squ_inter);
10338 REWRITE_TAC [EQ_EMPTY; INTER];
10342 TYPE_THEN `h_edge m SUBSET (UNIONS (ctop G))` SUBGOAL_TAC;
10343 IMATCH_MP_TAC SUBSET_TRANS;
10344 TYPE_THEN `component (ctop G) x` EXISTS_TAC;
10345 ASM_REWRITE_TAC[component_unions];
10346 REWRITE_TAC[ctop_unions ;DIFF_SUBSET; EQ_EMPTY ; h_edge_euclid; INTER;];
10348 REWRITE_TAC[rectangle_h; EMPTY_EXISTS; UNION ; INTER;];
10349 USE 1 (REWRITE_RULE[SUBSET]);
10350 TYPE_THEN `~(h_edge m = EMPTY)` SUBGOAL_TAC ;
10351 IMATCH_MP_TAC cell_nonempty;
10352 REWRITE_TAC[cell_rules];
10353 REWRITE_TAC[EMPTY_EXISTS];
10356 TYPE_THEN `u` EXISTS_TAC;
10361 let comp_v_rect = prove_by_refinement(
10362 `!G m x. (segment G /\
10363 (v_edge m SUBSET component (ctop G) x)) ==>
10364 (rectangle (FST m -: &:1, SND m ) (FST m +: &:1,SND m +: &:1)
10365 SUBSET component (ctop G) x)`,
10369 IMATCH_MP_TAC convex_component;
10370 ASM_REWRITE_TAC[rectangle_convex; ctop_unions;];
10372 REWRITE_TAC[DIFF_SUBSET;rectangle_euclid];
10373 REWRITE_TAC[rectangle_v; EQ_EMPTY ;UNION ; INTER;];
10376 TYPE_THEN `~(squ (left m) x') /\ ~(squ m x')` SUBGOAL_TAC;
10377 USE 0(MATCH_MP curve_cell_squ_inter);
10383 REWRITE_TAC [EQ_EMPTY; INTER];
10387 TYPE_THEN `v_edge m SUBSET (UNIONS (ctop G))` SUBGOAL_TAC;
10388 IMATCH_MP_TAC SUBSET_TRANS;
10389 TYPE_THEN `component (ctop G) x` EXISTS_TAC;
10390 ASM_REWRITE_TAC[component_unions];
10391 REWRITE_TAC[ctop_unions ;DIFF_SUBSET; EQ_EMPTY ; v_edge_euclid; INTER;];
10393 REWRITE_TAC[rectangle_v; EMPTY_EXISTS; UNION ; INTER;];
10394 USE 1 (REWRITE_RULE[SUBSET]);
10395 TYPE_THEN `~(v_edge m = EMPTY)` SUBGOAL_TAC ;
10396 IMATCH_MP_TAC cell_nonempty;
10397 REWRITE_TAC[cell_rules];
10398 REWRITE_TAC[EMPTY_EXISTS];
10401 TYPE_THEN `u` EXISTS_TAC;
10406 let long_v_convex = prove_by_refinement(
10407 `!p. (convex (long_v p))`,
10410 REWRITE_TAC[long_v_inter];
10412 IMATCH_MP_TAC convex_inter;
10413 REWRITE_TAC[line2D_F_convex];
10414 IMATCH_MP_TAC convex_inter;
10415 REWRITE_TAC[open_half_plane2D_LTS_convex;open_half_plane2D_SLT_convex];
10419 let long_v_euclid = prove_by_refinement(
10420 `!p. (long_v p SUBSET (euclid 2))`,
10423 REWRITE_TAC[long_v_union;union_subset;v_edge_euclid;single_subset;pointI;euclid_point];
10427 let comp_pointI_long = prove_by_refinement(
10428 `!G m x. (segment G /\ component (ctop G) x (pointI m)) ==>
10429 (long_v m SUBSET component (ctop G) x)`,
10433 IMATCH_MP_TAC convex_component;
10434 ASM_REWRITE_TAC[long_v_convex;ctop_unions;DIFF_SUBSET;long_v_euclid];
10436 REWRITE_TAC[long_v_union;EQ_EMPTY;UNION;INTER];
10438 TYPE_THEN `UNIONS (ctop G) (pointI m)` SUBGOAL_TAC;
10439 ASSUME_TAC (ISPEC `(ctop G)` component_unions);
10440 ASM_MESON_TAC[ISUBSET];
10441 REWRITE_TAC[ctop_unions;DIFF ;];
10444 TYPE_THEN `~(curve_cell G {(pointI m)})` SUBGOAL_TAC;
10445 USE 4(REWRITE_RULE[UNIONS]);
10447 TSPEC `{(pointI m)}` 4;
10448 USE 4(REWRITE_RULE [INR IN_SING;]);
10450 ASM_SIMP_TAC[curve_cell_not_point;];
10451 TYPE_THEN `FINITE G` SUBGOAL_TAC;
10452 ASM_SIMP_TAC[segment_finite];
10453 ASM_SIMP_TAC[num_closure0];
10456 REP_CASES_TAC; (* cases *)
10457 TYPE_THEN `~(v_edge (down m) INTER UNIONS (curve_cell G) = EMPTY)` SUBGOAL_TAC;
10458 REWRITE_TAC[EMPTY_EXISTS;INTER ];
10460 ASM_SIMP_TAC[curve_cell_v_inter];
10462 TSPEC `v_edge (down m)` 5;
10464 ASM_REWRITE_TAC[v_edge_closure;vc_edge;plus_e12;UNION; INR IN_SING; pointI_inj; down; PAIR_SPLIT ; INT_ARITH `x = x -: &:1 +: &:1`;];
10466 USE 7 (REWRITE_RULE[INR IN_SING]);
10468 TYPE_THEN `~(v_edge (m) INTER UNIONS (curve_cell G) = EMPTY)` SUBGOAL_TAC;
10469 REWRITE_TAC[EMPTY_EXISTS;INTER ];
10471 ASM_SIMP_TAC[curve_cell_v_inter];
10473 TSPEC `v_edge (m)` 5;
10475 ASM_REWRITE_TAC[v_edge_closure;vc_edge;plus_e12;UNION; INR IN_SING; pointI_inj; down; PAIR_SPLIT ; INT_ARITH `x = x -: &:1 +: &:1`;];
10477 REWRITE_TAC[long_v_union;EMPTY_EXISTS;];
10478 TYPE_THEN `(pointI m)` EXISTS_TAC;
10479 ASM_REWRITE_TAC[INTER;UNION;INR IN_SING;];
10483 let comp_h_squ = prove_by_refinement(
10484 `!G x m. (segment G /\ (h_edge m SUBSET (component (ctop G) x)) ==>
10485 (squ m SUBSET (component (ctop G ) x)))`,
10489 TYPE_THEN `(rectangle (FST m , SND m -: &:1) (FST m +: &:1,SND m +: &:1) SUBSET component (ctop G) x)` SUBGOAL_TAC;
10490 IMATCH_MP_TAC comp_h_rect;
10493 IMATCH_MP_TAC SUBSET_TRANS;
10494 TYPE_THEN `rectangle (FST m,SND m -: &:1) (FST m +: &:1,SND m +: &:1)` EXISTS_TAC;
10496 REWRITE_TAC[rectangle_h];
10497 REWRITE_TAC[SUBSET;UNION];
10502 let comp_v_squ = prove_by_refinement(
10503 `!G x m. (segment G /\ (v_edge m SUBSET (component (ctop G) x)) ==>
10504 (squ m SUBSET (component (ctop G ) x)))`,
10508 TYPE_THEN `(rectangle (FST m -: &:1 , SND m ) (FST m +: &:1,SND m +: &:1) SUBSET component (ctop G) x)` SUBGOAL_TAC;
10509 IMATCH_MP_TAC comp_v_rect;
10512 IMATCH_MP_TAC SUBSET_TRANS;
10513 TYPE_THEN `rectangle (FST m -: &:1 ,SND m) (FST m +: &:1,SND m +: &:1)` EXISTS_TAC;
10515 REWRITE_TAC[rectangle_v];
10516 REWRITE_TAC[SUBSET;UNION];
10521 let comp_p_squ = prove_by_refinement(
10522 `!G x m. (segment G /\ (component (ctop G) x (pointI m))) ==>
10523 (squ m SUBSET (component (ctop G ) x))`,
10527 TYPE_THEN `long_v m SUBSET component (ctop G) x` SUBGOAL_TAC;
10528 IMATCH_MP_TAC comp_pointI_long;
10530 REWRITE_TAC[long_v_union];
10531 REWRITE_TAC[union_subset];
10533 IMATCH_MP_TAC comp_v_squ;
10538 let comp_squ = prove_by_refinement(
10539 `!G x. (segment G /\ (~(component (ctop G) x = EMPTY)) ==>
10540 (?m. (squ m SUBSET (component (ctop G ) x))))`,
10545 USE 0 (MATCH_MP unions_cell_of);
10548 USE 1 (REWRITE_RULE[EMPTY_EXISTS]);
10551 DISCH_THEN (fun t-> USE 1 (ONCE_REWRITE_RULE[t]));
10552 USE 0 (REWRITE_RULE[cell_of;UNIONS]);
10556 USE 0 (REWRITE_RULE[cell]);
10561 USE 1 (REWRITE_RULE[single_subset]);
10562 ASM_MESON_TAC[comp_p_squ];
10563 ASM_MESON_TAC[comp_h_squ];
10564 ASM_MESON_TAC[comp_v_squ];
10569 let comp_squ_left_rect_v = prove_by_refinement(
10570 `!G m x. (segment G /\ ~(G (v_edge ( m))) /\
10571 (squ m SUBSET component (ctop G) x) ==>
10572 (rectangle (FST m -: &:1 ,SND m ) (FST m +: &:1,SND m +: &:1) SUBSET
10573 component (ctop G) x))`,
10578 ASM_SIMP_TAC[GSYM curve_cell_v];
10581 IMATCH_MP_TAC convex_component;
10582 ASM_REWRITE_TAC[rectangle_convex; ctop_unions;];
10584 REWRITE_TAC[DIFF_SUBSET;rectangle_euclid];
10585 REWRITE_TAC[rectangle_v; EQ_EMPTY ;UNION ; INTER;];
10588 TYPE_THEN `~(squ (left m) x') /\ ~(squ m x')` SUBGOAL_TAC;
10589 USE 0(MATCH_MP curve_cell_squ_inter);
10595 REWRITE_TAC [EQ_EMPTY; INTER];
10599 USE 3 (REWRITE_RULE[UNIONS;]);
10601 TYPE_THEN `cell u` SUBGOAL_TAC;
10602 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
10603 ASM_MESON_TAC[segment];
10604 ASM_MESON_TAC[ISUBSET; curve_cell_cell];
10606 TYPE_THEN `u = v_edge m ` SUBGOAL_TAC;
10607 IMATCH_MP_TAC cell_partition;
10608 ASM_REWRITE_TAC[EMPTY_EXISTS;INTER;cell_rules];
10611 REWRITE_TAC[rectangle_v;EMPTY_EXISTS;];
10612 TYPE_THEN `~(squ m = EMPTY )` SUBGOAL_TAC;
10613 ASM_MESON_TAC[cell_nonempty;cell_rules];
10614 REWRITE_TAC[EMPTY_EXISTS;UNION;INTER;];
10615 USE 2(REWRITE_RULE[ISUBSET]);
10620 let comp_squ_left_rect = prove_by_refinement(
10621 `!G m x. (segment G /\
10622 (~(?p e. (G e /\ e SUBSET closure top2 (squ p) /\
10623 (squ p SUBSET (component (ctop G) x))))) /\
10624 (squ m SUBSET component (ctop G) x)) ==>
10625 (rectangle (FST m -: &:1, SND m ) (FST m +: &:1,SND m +: &:1)
10626 SUBSET component (ctop G) x)`,
10633 TSPEC `v_edge m` 1;
10635 USE 1(REWRITE_RULE[squ_closure_v]);
10636 IMATCH_MP_TAC comp_squ_left_rect_v;
10641 let comp_squ_right_rect_v = prove_by_refinement(
10642 `!G m x. (segment G /\ ~(G (v_edge (right m))) /\
10643 (squ m SUBSET component (ctop G) x) ==>
10644 (rectangle (FST m,SND m ) (FST m +: &:2,SND m +: &:1) SUBSET
10645 component (ctop G) x))`,
10650 ASM_SIMP_TAC[GSYM curve_cell_v];
10653 IMATCH_MP_TAC convex_component;
10654 ASM_REWRITE_TAC[rectangle_convex; ctop_unions;];
10655 TYPE_THEN `rectangle m (FST m +: &:2,SND m +: &:1) = rectangle (FST (right m) -: &:1, SND (right m)) (FST (right m) +: &:1, SND (right m) +: &:1)` SUBGOAL_TAC;
10656 REWRITE_TAC[right ;INT_ARITH `(x +: &:1)-: &:1 = x`;INT_ARITH `(x +: &:1) +: &:1 = x +: &:2` ];
10657 DISCH_THEN_REWRITE;
10659 REWRITE_TAC[DIFF_SUBSET;rectangle_euclid];
10660 REWRITE_TAC[rectangle_v; EQ_EMPTY ;UNION ; INTER;];
10663 USE 4 (REWRITE_RULE[right_left]);
10664 TYPE_THEN `~(squ m x') /\ ~(squ (right m) x')` SUBGOAL_TAC;
10665 USE 0(MATCH_MP curve_cell_squ_inter);
10671 REWRITE_TAC [EQ_EMPTY; INTER];
10675 USE 3 (REWRITE_RULE[UNIONS;]);
10677 TYPE_THEN `cell u` SUBGOAL_TAC;
10678 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
10679 ASM_MESON_TAC[segment];
10680 ASM_MESON_TAC[ISUBSET; curve_cell_cell];
10682 TYPE_THEN `u = v_edge (right m) ` SUBGOAL_TAC;
10683 IMATCH_MP_TAC cell_partition;
10684 ASM_REWRITE_TAC[EMPTY_EXISTS;INTER;cell_rules];
10687 REWRITE_TAC[rectangle_v;EMPTY_EXISTS;];
10688 REWRITE_TAC[right_left];
10689 TYPE_THEN `~(squ m = EMPTY )` SUBGOAL_TAC;
10690 ASM_MESON_TAC[cell_nonempty;cell_rules];
10691 REWRITE_TAC[EMPTY_EXISTS;UNION;INTER;];
10692 USE 2(REWRITE_RULE[ISUBSET]);
10697 let comp_squ_right_rect = prove_by_refinement(
10698 `!G m x. (segment G /\
10699 (~(?p e. (G e /\ e SUBSET closure top2 (squ p) /\
10700 (squ p SUBSET (component (ctop G) x))))) /\
10701 (squ m SUBSET component (ctop G) x)) ==>
10702 (rectangle (FST m , SND m ) (FST m +: &:2,SND m +: &:1)
10703 SUBSET component (ctop G) x)`,
10710 TSPEC `v_edge (right m)` 1;
10712 USE 1(REWRITE_RULE[squ_closure_right_v]);
10713 IMATCH_MP_TAC comp_squ_right_rect_v;
10718 let comp_squ_down_rect_h = prove_by_refinement(
10719 `!G m x. (segment G /\ ~(G (h_edge m)) /\
10720 (squ m SUBSET component (ctop G) x) ==>
10721 (rectangle (FST m,SND m -: &:1) (FST m +: &:1,SND m +: &:1) SUBSET
10722 component (ctop G) x))`,
10727 ASM_SIMP_TAC[GSYM curve_cell_h];
10730 IMATCH_MP_TAC convex_component;
10731 ASM_REWRITE_TAC[rectangle_convex; ctop_unions;];
10733 REWRITE_TAC[DIFF_SUBSET;rectangle_euclid];
10734 REWRITE_TAC[rectangle_h; EQ_EMPTY ;UNION ; INTER;];
10737 TYPE_THEN `~(squ (down m) x') /\ ~(squ m x')` SUBGOAL_TAC;
10738 USE 0(MATCH_MP curve_cell_squ_inter);
10744 REWRITE_TAC [EQ_EMPTY; INTER];
10748 USE 3 (REWRITE_RULE[UNIONS;]);
10750 TYPE_THEN `cell u` SUBGOAL_TAC;
10751 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
10752 ASM_MESON_TAC[segment];
10753 ASM_MESON_TAC[ISUBSET; curve_cell_cell];
10755 TYPE_THEN `u = h_edge m ` SUBGOAL_TAC;
10756 IMATCH_MP_TAC cell_partition;
10757 ASM_REWRITE_TAC[EMPTY_EXISTS;INTER;cell_rules];
10760 REWRITE_TAC[rectangle_h;EMPTY_EXISTS;];
10761 TYPE_THEN `~(squ m = EMPTY )` SUBGOAL_TAC;
10762 ASM_MESON_TAC[cell_nonempty;cell_rules];
10763 REWRITE_TAC[EMPTY_EXISTS;UNION;INTER;];
10764 USE 2(REWRITE_RULE[ISUBSET]);
10769 let comp_squ_down_rect = prove_by_refinement(
10770 `!G m x. (segment G /\
10771 (~(?p e. (G e /\ e SUBSET closure top2 (squ p) /\
10772 (squ p SUBSET (component (ctop G) x))))) /\
10773 (squ m SUBSET component (ctop G) x)) ==>
10774 (rectangle (FST m , SND m -: &:1) (FST m +: &:1,SND m +: &:1)
10775 SUBSET component (ctop G) x)`,
10783 TSPEC `h_edge m` 1;
10785 USE 1(REWRITE_RULE[squ_closure_h]);
10786 ASM_MESON_TAC[comp_squ_down_rect_h];
10791 let comp_squ_up_rect_h = prove_by_refinement(
10792 `!G m x. (segment G /\ ~(G (h_edge (up m))) /\
10793 (squ m SUBSET component (ctop G) x) ==>
10794 (rectangle (FST m,SND m ) (FST m +: &:1,SND m +: &:2) SUBSET
10795 component (ctop G) x))`,
10800 ASM_SIMP_TAC[GSYM curve_cell_h];
10803 IMATCH_MP_TAC convex_component;
10804 ASM_REWRITE_TAC[rectangle_convex; ctop_unions;];
10805 TYPE_THEN `rectangle m (FST m +: &:1,SND m +: &:2) = rectangle (FST (up m) , SND (up m) -: &:1) (FST (up m) +: &:1, SND (up m) +: &:1)` SUBGOAL_TAC;
10806 REWRITE_TAC[up ;INT_ARITH `(x +: &:1)-: &:1 = x`;INT_ARITH `(x +: &:1) +: &:1 = x +: &:2` ];
10807 DISCH_THEN_REWRITE;
10809 REWRITE_TAC[DIFF_SUBSET;rectangle_euclid];
10810 REWRITE_TAC[rectangle_h; EQ_EMPTY ;UNION ; INTER;];
10813 USE 4 (REWRITE_RULE[right_left]);
10814 TYPE_THEN `~(squ m x') /\ ~(squ (up m) x')` SUBGOAL_TAC;
10815 USE 0(MATCH_MP curve_cell_squ_inter);
10821 REWRITE_TAC [EQ_EMPTY; INTER];
10825 USE 3 (REWRITE_RULE[UNIONS;]);
10827 TYPE_THEN `cell u` SUBGOAL_TAC;
10828 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
10829 ASM_MESON_TAC[segment];
10830 ASM_MESON_TAC[ISUBSET; curve_cell_cell];
10832 TYPE_THEN `u = h_edge (up m) ` SUBGOAL_TAC;
10833 IMATCH_MP_TAC cell_partition;
10834 ASM_REWRITE_TAC[EMPTY_EXISTS;INTER;cell_rules];
10837 REWRITE_TAC[rectangle_h;EMPTY_EXISTS;];
10838 REWRITE_TAC[right_left];
10839 TYPE_THEN `~(squ m = EMPTY )` SUBGOAL_TAC;
10840 ASM_MESON_TAC[cell_nonempty;cell_rules];
10841 REWRITE_TAC[EMPTY_EXISTS;UNION;INTER;];
10842 USE 2(REWRITE_RULE[ISUBSET]);
10847 let comp_squ_up_rect = prove_by_refinement(
10848 `!G m x. (segment G /\
10849 (~(?p e. (G e /\ e SUBSET closure top2 (squ p) /\
10850 (squ p SUBSET (component (ctop G) x))))) /\
10851 (squ m SUBSET component (ctop G) x)) ==>
10852 (rectangle (FST m , SND m ) (FST m +: &:1,SND m +: &:2)
10853 SUBSET component (ctop G) x)`,
10860 TSPEC `h_edge (up m)` 1;
10862 USE 1(REWRITE_RULE[squ_closure_up_h]);
10863 IMATCH_MP_TAC comp_squ_up_rect_h;
10868 let comp_squ_right_left = prove_by_refinement(
10869 `!G x m. (segment G /\ (squ m SUBSET (component (ctop G) x)) /\
10870 (~(?p e. (G e /\ e SUBSET closure top2 (squ p) /\
10871 (squ p SUBSET (component (ctop G) x)))))) ==>
10872 (squ (left m) SUBSET (component (ctop G) x)) /\
10873 (squ (right m) SUBSET (component (ctop G) x)) /\
10874 (squ (up m) SUBSET (component (ctop G) x)) /\
10875 (squ (down m) SUBSET (component (ctop G) x))`,
10881 WITH 0 (MATCH_MP comp_squ_up_rect);
10882 WITH 0 (MATCH_MP comp_squ_down_rect);
10883 WITH 0 (MATCH_MP comp_squ_left_rect);
10884 WITH 0 (MATCH_MP comp_squ_right_rect);
10885 TYPE_THEN `rectangle m (FST m +: &:1,SND m +: &:2) = rectangle (FST (up m) , SND (up m) -: &:1) (FST (up m) +: &:1, SND (up m) +: &:1)` SUBGOAL_TAC;
10886 REWRITE_TAC[up ;INT_ARITH `(x +: &:1)-: &:1 = x`;INT_ARITH `(x +: &:1) +: &:1 = x +: &:2` ];
10887 DISCH_THEN (fun t-> USE 1 (REWRITE_RULE[t]));
10888 TYPE_THEN `rectangle m (FST m +: &:2,SND m +: &:1) = rectangle (FST (right m) -: &:1, SND (right m)) (FST (right m) +: &:1, SND (right m) +: &:1)` SUBGOAL_TAC;
10889 REWRITE_TAC[right ;INT_ARITH `(x +: &:1)-: &:1 = x`;INT_ARITH `(x +: &:1) +: &:1 = x +: &:2` ];
10890 DISCH_THEN (fun t-> USE 4 (REWRITE_RULE[t]));
10891 RULE_ASSUM_TAC (REWRITE_RULE[rectangle_h;rectangle_v;union_subset;right_left ]);
10897 let suc_sum = prove_by_refinement(
10898 `!j a b. (SUC j = a+ b) ==> (?k. (SUC k = a) \/ (SUC k = b))`,
10902 PROOF_BY_CONTR_TAC;
10904 USE 1(REWRITE_RULE[DE_MORGAN_THM]);
10905 TYPE_THEN `a = 0 ` SUBGOAL_TAC;
10906 PROOF_BY_CONTR_TAC;
10907 ASM_MESON_TAC[num_CASES];
10908 TYPE_THEN `b = 0` SUBGOAL_TAC;
10909 ASM_MESON_TAC[num_CASES];
10915 let squ_induct = prove_by_refinement(
10917 ((SUC j) = (num_abs_of_int (FST m -: FST n) +
10918 num_abs_of_int (SND m -: SND n))) ==>
10919 ((j = (num_abs_of_int (FST p -: FST n) +
10920 num_abs_of_int (SND p -: SND n))) /\
10921 ((p = left m) \/ (p = right m) \/ (p = up m) \/ (p = down m))) `,
10927 WITH 0 (MATCH_MP suc_sum);
10930 DISCH_THEN DISJ_CASES_TAC;
10931 TYPE_THEN `~(num_abs_of_int (FST m -: FST n) = 0)` SUBGOAL_TAC;
10934 REWRITE_TAC[num_abs_of_int0];
10936 TYPE_THEN `FST m <: FST n \/ FST n <: FST m` SUBGOAL_TAC;
10939 DISCH_THEN DISJ_CASES_TAC;
10940 TYPE_THEN `right m` EXISTS_TAC;
10942 REWRITE_TAC[right ];
10943 ONCE_REWRITE_TAC[GSYM SUC_INJ];
10944 REWRITE_TAC[GSYM ADD];
10945 TYPE_THEN `(FST m +: &:1) -: FST n <=: &:0` SUBGOAL_TAC;
10948 ASM_SIMP_TAC[num_abs_of_int_pre];
10949 TYPE_THEN `(FST m +: &:1) -: FST n -: &:1 = FST m -: FST n` SUBGOAL_TAC;
10951 DISCH_THEN_REWRITE;
10953 TYPE_THEN `left m` EXISTS_TAC;
10955 REWRITE_TAC[left ];
10956 ONCE_REWRITE_TAC[GSYM SUC_INJ];
10957 REWRITE_TAC[GSYM ADD];
10958 TYPE_THEN `&:0 <=: (FST m -: &:1) -: FST n ` SUBGOAL_TAC;
10961 ASM_SIMP_TAC[num_abs_of_int_suc];
10962 TYPE_THEN `(FST m -: &:1 -: FST n +: &:1) = FST m -: FST n` SUBGOAL_TAC;
10964 DISCH_THEN_REWRITE;
10966 TYPE_THEN `~(num_abs_of_int (SND m -: SND n) = 0)` SUBGOAL_TAC;
10969 REWRITE_TAC[num_abs_of_int0];
10971 TYPE_THEN `SND m <: SND n \/ SND n <: SND m` SUBGOAL_TAC;
10974 DISCH_THEN DISJ_CASES_TAC;
10976 TYPE_THEN `up m` EXISTS_TAC;
10979 ONCE_REWRITE_TAC[GSYM SUC_INJ];
10980 REWRITE_TAC[GSYM ADD_SUC];
10981 TYPE_THEN `(SND m +: &:1) -: SND n <=: &:0` SUBGOAL_TAC;
10984 ASM_SIMP_TAC[num_abs_of_int_pre];
10985 TYPE_THEN `((SND m +: &:1) -: SND n -: &:1) = SND m -: SND n` SUBGOAL_TAC;
10987 DISCH_THEN_REWRITE;
10989 TYPE_THEN `down m` EXISTS_TAC;
10991 REWRITE_TAC[down ];
10992 ONCE_REWRITE_TAC[GSYM SUC_INJ];
10993 REWRITE_TAC[GSYM ADD_SUC];
10994 TYPE_THEN `&:0 <=: (SND m -: &:1) -: SND n ` SUBGOAL_TAC;
10997 ASM_SIMP_TAC[num_abs_of_int_suc];
10998 TYPE_THEN `(SND m -: &:1 -: SND n +: &:1) = SND m -: SND n` SUBGOAL_TAC;
11000 DISCH_THEN_REWRITE;
11004 let comp_squ_fill = prove_by_refinement(
11005 `!G x m. (segment G /\ (squ m SUBSET (component (ctop G ) x)) /\
11006 (~(?p e. (G e /\ e SUBSET closure top2 (squ p) /\
11007 (squ p SUBSET (component (ctop G) x)))))) ==>
11008 (!n. (squ n SUBSET (component (ctop G) x)))
11014 TYPE_THEN `(!j n. (j = (num_abs_of_int (FST n -: FST m) + num_abs_of_int (SND n -: SND m))) ==> (squ n SUBSET component (ctop G) x)) ==> (squ n SUBSET component (ctop G) x)` SUBGOAL_TAC;
11017 DISCH_THEN IMATCH_MP_TAC ;
11019 ONCE_REWRITE_TAC [EQ_SYM_EQ];
11020 REWRITE_TAC[ADD_EQ_0;num_abs_of_int0];
11023 TYPE_THEN `n = m` SUBGOAL_TAC;
11025 REWRITE_TAC[PAIR_SPLIT];
11029 USE 4 (MATCH_MP (CONV_RULE (quant_right_CONV "p") squ_induct));
11034 TYPE_THEN `(n = left p) \/ (n = right p) \/ (n = up p) \/ (n = down p)` SUBGOAL_TAC;
11036 REP_CASES_TAC THEN (ASM_REWRITE_TAC[right_left]);
11042 USE 0 (MATCH_MP comp_squ_right_left);
11047 let comp_squ_adj = prove_by_refinement(
11048 `!G x m. (segment G /\ (squ m SUBSET (component (ctop G ) x))) ==>
11049 (?p e. (G e /\ e SUBSET closure top2 (squ p) /\
11050 (squ p SUBSET (component (ctop G) x))))`,
11055 PROOF_BY_CONTR_TAC;
11056 TYPE_THEN `(!n. (squ n SUBSET (component (ctop G) x)))` SUBGOAL_TAC;
11057 ASM_MESON_TAC[comp_squ_fill];
11059 TYPE_THEN `?e. (G e /\ (edge e))` SUBGOAL_TAC;
11060 USE 0 (REWRITE_RULE [segment;EMPTY_EXISTS;SUBSET;]);
11067 TYPE_THEN `e` EXISTS_TAC;
11070 USE 2(REWRITE_RULE[edge]);
11073 DISCH_THEN DISJ_CASES_TAC;
11075 TYPE_THEN `m'` EXISTS_TAC;
11076 ASM_REWRITE_TAC[squ_closure_v;squ_closure_h];
11077 ASM_MESON_TAC[squ_closure_v;squ_closure_h];
11082 (* ------------------------------------------------------------------ *)
11085 let along_seg = jordan_def `along_seg G e x <=> G e /\
11086 (?p. (e SUBSET closure top2 (squ p) /\
11087 squ p SUBSET (component (ctop G) x) ))`;;
11089 let along_lemma1 = prove_by_refinement(
11090 `!G m x. (segment G /\ (squ m SUBSET component (ctop G) x) /\
11091 (G (v_edge m)) /\ (G (h_edge m))) ==>
11092 (?p. (h_edge m) SUBSET closure top2 (squ p) /\
11093 (squ p SUBSET (component (ctop G) x)))`,
11098 TYPE_THEN `m` EXISTS_TAC;
11099 ASM_MESON_TAC[squ_closure_h];
11104 let midpoint_exclusion = prove_by_refinement(
11105 `!G m e e' e''. (segment G /\ G e /\ G e' /\ G e'' /\ (~(e = e')) /\
11106 (closure top2 e (pointI m)) /\ (closure top2 e' (pointI m)) /\
11107 (closure top2 e'' (pointI m)) ==> ((e'' = e) \/ (e'' = e')))
11112 USE 0 (REWRITE_RULE[segment;INSERT; ]);
11115 TYPE_THEN `num_closure G (pointI m) = 2` SUBGOAL_TAC;
11121 USE 0 (MATCH_MP num_closure1);
11129 USE 0 (MATCH_MP num_closure0);
11130 TSPEC `pointI m` 0;
11135 USE 0 (MATCH_MP num_closure_size);
11136 TSPEC `pointI m` 0;
11138 TYPE_THEN `X = {C | G C /\ closure top2 C (pointI m)}` ABBREV_TAC ;
11139 TYPE_THEN `X e /\ X e' /\ X e''` SUBGOAL_TAC;
11144 MESON_TAC[two_exclusion];
11148 (* indexed to here *)
11149 let along_lemma2 = prove_by_refinement(
11150 `!G m. (segment G /\ G (v_edge m) /\ G (v_edge (down m)) ==>
11155 TYPE_THEN `(h_edge m = v_edge m) \/ (h_edge m = v_edge (down m))` SUBGOAL_TAC;
11156 IMATCH_MP_TAC midpoint_exclusion;
11157 TYPE_THEN `G` EXISTS_TAC;
11158 TYPE_THEN `m` EXISTS_TAC;
11159 ASM_REWRITE_TAC[v_edge_inj;down;v_edge_cpoint;h_edge_cpoint;PAIR_SPLIT;];
11161 REWRITE_TAC[hv_edgeV2;GSYM hv_edgeV2];
11165 let along_lemma3 = prove_by_refinement(
11166 `!G m. (segment G /\ G (v_edge m) /\ G(h_edge (left m)) ==>
11167 ~(G (h_edge m)) /\ ~(G (v_edge (down m))))`,
11172 PROOF_BY_CONTR_TAC;
11173 USE 3(REWRITE_RULE[]);
11174 TYPE_THEN `(h_edge m = v_edge m) \/ (h_edge m = h_edge (left m))` SUBGOAL_TAC;
11175 IMATCH_MP_TAC midpoint_exclusion;
11176 TYPE_THEN `G` EXISTS_TAC;
11177 TYPE_THEN `m` EXISTS_TAC;
11178 ASM_REWRITE_TAC[v_edge_inj;left;v_edge_cpoint;GSYM hv_edgeV2;h_edge_cpoint;PAIR_SPLIT;];
11180 REWRITE_TAC[hv_edgeV2;GSYM hv_edgeV2;left ;h_edge_inj;PAIR_SPLIT;];
11182 PROOF_BY_CONTR_TAC;
11183 USE 3(REWRITE_RULE[]);
11184 TYPE_THEN `(h_edge (left m) = v_edge m) \/ (h_edge (left m) = v_edge (down m))` SUBGOAL_TAC;
11185 IMATCH_MP_TAC midpoint_exclusion;
11186 TYPE_THEN `G` EXISTS_TAC;
11187 TYPE_THEN `m` EXISTS_TAC;
11188 ASM_REWRITE_TAC[v_edge_inj;down;left ;v_edge_cpoint;h_edge_cpoint;PAIR_SPLIT;];
11190 REWRITE_TAC[hv_edgeV2;GSYM hv_edgeV2];
11194 let along_lemma4 = prove_by_refinement(
11195 `!G m x. (segment G /\ (squ m SUBSET component (ctop G) x) /\
11196 (G (v_edge m)) /\ (G (v_edge (down m)))) ==>
11197 (?p. (v_edge (down m)) SUBSET closure top2 (squ p) /\
11198 (squ p SUBSET (component (ctop G) x)))`,
11202 TYPE_THEN `down m` EXISTS_TAC;
11204 ASM_MESON_TAC[squ_closure_v];
11205 TYPE_THEN `~(G (h_edge m))` SUBGOAL_TAC;
11206 ASM_MESON_TAC[along_lemma2];
11208 TYPE_THEN `(rectangle (FST m , SND m -: &:1) (FST m +: &:1,SND m +: &:1) SUBSET component (ctop G) x)` SUBGOAL_TAC ;
11209 IMATCH_MP_TAC comp_squ_down_rect_h;
11211 REWRITE_TAC[rectangle_h; union_subset];
11216 let along_lemma5 = prove_by_refinement(
11217 `!G m x. (segment G /\ (squ m SUBSET component (ctop G) x) /\
11218 (G (v_edge m)) /\ (G (h_edge (left m)))) ==>
11219 (?p. (h_edge (left m)) SUBSET closure top2 (squ p) /\
11220 (squ p SUBSET (component (ctop G) x)))`,
11224 TYPE_THEN `left (down m)` EXISTS_TAC;
11226 REWRITE_TAC[GSYM right_left];
11227 ASM_MESON_TAC[squ_closure_down_h];
11228 TYPE_THEN ` ~(G (h_edge m)) /\ ~(G (v_edge (down m)))` SUBGOAL_TAC;
11229 IMATCH_MP_TAC along_lemma3;
11232 TYPE_THEN `(rectangle (FST m , SND m -: &:1) (FST m +: &:1,SND m +: &:1) SUBSET component (ctop G) x)` SUBGOAL_TAC ;
11233 IMATCH_MP_TAC comp_squ_down_rect_h;
11235 REWRITE_TAC[rectangle_h; union_subset];
11237 TYPE_THEN `(rectangle (FST (down m) -: &:1,SND (down m)) (FST (down m) +: &:1,SND (down m) +: &:1) SUBSET component (ctop G) x)` SUBGOAL_TAC;
11238 IMATCH_MP_TAC comp_squ_left_rect_v;
11240 REWRITE_TAC[rectangle_v;union_subset;];
11246 let along_lemma6 = prove_by_refinement(
11247 `!G m x e. (segment G /\ (squ m SUBSET component (ctop G) x) /\
11248 (G (v_edge m)) /\ G e /\ (closure top2 e (pointI m)) ==>
11249 (?p. e SUBSET closure top2 (squ p) /\
11250 (squ p SUBSET (component (ctop G) x))))`,
11254 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC ;
11255 ASM_MESON_TAC[segment];
11257 TYPE_THEN `edge e` SUBGOAL_TAC;
11258 ASM_MESON_TAC[ISUBSET;];
11260 DISCH_THEN (CHOOSE_THEN DISJ_CASES_TAC);
11262 USE 4 (REWRITE_RULE[v_edge_cpoint]);
11265 TYPE_THEN `(m' = m) \/ (m' = (down m))` SUBGOAL_TAC;
11267 REWRITE_TAC[down;PAIR_SPLIT];
11270 DISCH_THEN DISJ_CASES_TAC;
11271 TYPE_THEN `m` EXISTS_TAC;
11272 ASM_REWRITE_TAC[squ_closure_v];
11274 IMATCH_MP_TAC along_lemma4;
11279 USE 4(REWRITE_RULE[h_edge_cpoint]);
11280 TYPE_THEN `(m' = m) \/ (m' = (left m))` SUBGOAL_TAC;
11282 REWRITE_TAC[left;PAIR_SPLIT];
11285 DISCH_THEN DISJ_CASES_TAC;
11287 IMATCH_MP_TAC along_lemma1;
11291 IMATCH_MP_TAC along_lemma5;
11297 (* ------------------------------------------------------------------ *)
11299 let reflAf = jordan_def
11300 `reflAf r (x:num->real) = point(&2 * (real_of_int r) - x 0, x 1)`;;
11302 let reflAi = jordan_def
11303 `reflAi r (x:int#int) = ((&:2 *: r) -: FST x,SND x)`;;
11305 let reflBf = jordan_def
11306 `reflBf r (x:num->real) = point( x 0 , &2 * (real_of_int r) - x 1)`;;
11308 let reflBi = jordan_def
11309 `reflBi r (x:int#int) = (FST x, (&:2 *: r) -: SND x)`;;
11311 let reflCf = jordan_def
11312 `reflCf (x:num->real) = point (x 1, x 0)`;;
11314 let reflCi = jordan_def
11315 `reflCi (x:int#int) = (SND x, FST x)`;;
11317 let reflAf_inv = prove_by_refinement(
11318 `!r m. (reflAf r (reflAf r (point m)) = (point m))`,
11323 REWRITE_TAC[reflAf;coord01;PAIR_SPLIT ;point_inj ;];
11329 let reflBf_inv = prove_by_refinement(
11330 `!r m. (reflBf r (reflBf r (point m)) = (point m))`,
11334 REWRITE_TAC[reflBf;coord01;PAIR_SPLIT ;point_inj ;];
11339 let reflCf_inv = prove_by_refinement(
11340 `!m. (reflCf (reflCf (point m)) = (point m))`,
11344 REWRITE_TAC[reflCf;coord01;PAIR_SPLIT ;point_inj ;];
11348 let reflAi_inv = prove_by_refinement(
11349 `!r x. (reflAi r (reflAi r x) = x)`,
11352 REWRITE_TAC[reflAi;PAIR_SPLIT;];
11357 let reflBi_inv = prove_by_refinement(
11358 `!r x. (reflBi r (reflBi r x) = x)`,
11361 REWRITE_TAC[reflBi;PAIR_SPLIT;];
11366 let reflCi_inv = prove_by_refinement(
11367 `!x. (reflCi (reflCi x) = x)`,
11370 REWRITE_TAC[reflCi;PAIR_SPLIT;];
11374 let invo_BIJ = prove_by_refinement(
11375 `!f. (!m . (f (f (point m)) = (point m))) /\
11376 (!x. (euclid 2 (f x))) ==>
11377 (BIJ f (euclid 2) (euclid 2))`,
11381 REWRITE_TAC[BIJ;INJ;SURJ;];
11387 USE 2 (MATCH_MP (point_onto));
11388 USE 3 (MATCH_MP (point_onto));
11392 TYPE_THEN `f` (USE 4 o AP_TERM );
11397 USE 4(MATCH_MP point_onto);
11400 TYPE_THEN ` f (point p)` EXISTS_TAC ;
11405 let reflA_BIJ = prove_by_refinement(
11406 `!r. (BIJ (reflAf r) (euclid 2) (euclid 2))`,
11410 IMATCH_MP_TAC invo_BIJ;
11411 REWRITE_TAC[reflAf_inv];
11412 REWRITE_TAC[reflAf;euclid_point;];
11416 let reflB_BIJ = prove_by_refinement(
11417 `!r. (BIJ (reflBf r) (euclid 2) (euclid 2))`,
11421 IMATCH_MP_TAC invo_BIJ;
11422 REWRITE_TAC[reflBf_inv];
11423 REWRITE_TAC[reflBf;euclid_point;];
11427 let reflC_BIJ = prove_by_refinement(
11428 `(BIJ (reflCf ) (euclid 2) (euclid 2))`,
11431 IMATCH_MP_TAC invo_BIJ;
11432 REWRITE_TAC[reflCf_inv];
11433 REWRITE_TAC[reflCf;euclid_point;];
11437 let invo_homeo = prove_by_refinement(
11438 `!U (f:A->A). (continuous f U U) /\ (BIJ f (UNIONS U) (UNIONS U)) /\
11439 (!x. (UNIONS U x ==> (f (f x ) = x))) ==> (homeomorphism f U U)`,
11444 IMATCH_MP_TAC bicont_homeomorphism;
11446 TYPE_THEN `!x. (UNIONS U x) ==> (INV f (UNIONS U) (UNIONS U) x = f x)` SUBGOAL_TAC;
11448 TYPE_THEN `UNIONS U (f x)` SUBGOAL_TAC;
11450 REWRITE_TAC[BIJ;SURJ];
11453 ASM_SIMP_TAC [(INR INVERSE_XY)];
11456 REWRITE_TAC[continuous];
11462 REWRITE_TAC[preimage];
11463 TYPE_THEN `{x | UNIONS U x /\ v (INV f (UNIONS U) (UNIONS U) x)} = {x | UNIONS U x /\ v (f x)}` SUBGOAL_TAC;
11464 IMATCH_MP_TAC EQ_EXT;
11467 IMATCH_MP_TAC (TAUT `(C ==> (A <=> B)) ==> ( C /\ A <=> C /\ B)`);
11470 DISCH_THEN_REWRITE;
11475 let d_euclid_point = prove_by_refinement(
11476 `!r s. (d_euclid (point r) (point s) =
11477 sqrt ((FST r - FST s) pow 2 + ((SND r - SND s) pow 2)))`,
11481 TYPE_THEN `euclid 2 (point r) /\ euclid 2 (point s)` SUBGOAL_TAC;
11482 REWRITE_TAC[euclid_point];
11484 USE 0(MATCH_MP d_euclid_n);
11487 REWRITE_TAC[ARITH_RULE `2 = SUC 1`];
11488 REWRITE_TAC[sum_DEF];
11490 REWRITE_TAC[ARITH_RULE `1 = SUC 0`];
11491 REWRITE_TAC[sum_DEF];
11493 REWRITE_TAC[ARITH_RULE `(SUC 0 =1) /\ (SUC (SUC 0) = 2)`];
11494 REWRITE_TAC[coord01];
11495 REWRITE_TAC[POW_2];
11499 let reflA_cont = prove_by_refinement(
11500 `!r. continuous (reflAf r) top2 top2`,
11505 TYPE_THEN `(IMAGE (reflAf r) (euclid 2)) SUBSET (euclid 2) /\ (metric_space (euclid 2,d_euclid))` SUBGOAL_TAC;
11506 REWRITE_TAC[IMAGE;SUBSET];
11507 ASM_SIMP_TAC[metric_euclid];
11508 CONV_TAC (dropq_conv "x");
11509 REWRITE_TAC[reflAf;euclid_point];
11511 ASM_SIMP_TAC[metric_continuous_continuous;metric_continuous;metric_continuous_pt;];
11513 TYPE_THEN `epsilon` EXISTS_TAC;
11517 USE 2(MATCH_MP point_onto);
11519 USE 3(MATCH_MP point_onto);
11522 ASM_REWRITE_TAC[reflAf;d_euclid_point;coord01;];
11523 TYPE_THEN `(&2 * real_of_int r - FST p - (&2 * real_of_int r - FST p')) = --. (FST p - FST p') ` SUBGOAL_TAC;
11525 DISCH_THEN_REWRITE;
11526 ONCE_REWRITE_TAC[GSYM REAL_POW2_ABS];
11527 REWRITE_TAC[ABS_NEG];
11531 let reflB_cont = prove_by_refinement(
11532 `!r. continuous (reflBf r) top2 top2`,
11537 TYPE_THEN `(IMAGE (reflBf r) (euclid 2)) SUBSET (euclid 2) /\ (metric_space (euclid 2,d_euclid))` SUBGOAL_TAC;
11538 REWRITE_TAC[IMAGE;SUBSET];
11539 ASM_SIMP_TAC[metric_euclid];
11540 CONV_TAC (dropq_conv "x");
11541 REWRITE_TAC[reflBf;euclid_point];
11543 ASM_SIMP_TAC[metric_continuous_continuous;metric_continuous;metric_continuous_pt;];
11545 TYPE_THEN `epsilon` EXISTS_TAC;
11549 USE 2(MATCH_MP point_onto);
11551 USE 3(MATCH_MP point_onto);
11554 ASM_REWRITE_TAC[reflBf;d_euclid_point;coord01;];
11555 TYPE_THEN `(&2 * real_of_int r - SND p - (&2 * real_of_int r - SND p')) = --. (SND p - SND p') ` SUBGOAL_TAC;
11557 DISCH_THEN_REWRITE;
11558 ONCE_REWRITE_TAC[GSYM REAL_POW2_ABS];
11559 REWRITE_TAC[ABS_NEG];
11563 let reflC_cont = prove_by_refinement(
11564 ` continuous (reflCf) top2 top2`,
11568 TYPE_THEN `(IMAGE (reflCf) (euclid 2)) SUBSET (euclid 2) /\ (metric_space (euclid 2,d_euclid))` SUBGOAL_TAC;
11569 REWRITE_TAC[IMAGE;SUBSET];
11570 ASM_SIMP_TAC[metric_euclid];
11571 CONV_TAC (dropq_conv "x");
11572 REWRITE_TAC[reflCf;euclid_point];
11574 ASM_SIMP_TAC[metric_continuous_continuous;metric_continuous;metric_continuous_pt;];
11576 TYPE_THEN `epsilon` EXISTS_TAC;
11580 USE 2(MATCH_MP point_onto);
11582 USE 3(MATCH_MP point_onto);
11585 ASM_REWRITE_TAC[reflCf;d_euclid_point;coord01;];
11586 REWRITE_TAC[REAL_ADD_AC];
11590 let reflA_homeo = prove_by_refinement(
11591 `!r. (homeomorphism (reflAf r) top2 top2)`,
11595 ASSUME_TAC reflA_BIJ;
11596 ASSUME_TAC top2_unions;
11597 IMATCH_MP_TAC invo_homeo;
11598 REWRITE_TAC[reflA_cont];
11601 USE 2(MATCH_MP point_onto);
11603 ASM_REWRITE_TAC[reflAf_inv];
11607 let reflB_homeo = prove_by_refinement(
11608 `!r. (homeomorphism (reflBf r) top2 top2)`,
11612 ASSUME_TAC reflB_BIJ;
11613 ASSUME_TAC top2_unions;
11614 IMATCH_MP_TAC invo_homeo;
11615 REWRITE_TAC[reflB_cont];
11618 USE 2(MATCH_MP point_onto);
11620 ASM_REWRITE_TAC[reflBf_inv];
11624 let reflC_homeo = prove_by_refinement(
11625 ` (homeomorphism (reflCf ) top2 top2)`,
11628 ASSUME_TAC reflC_BIJ;
11629 ASSUME_TAC top2_unions;
11630 IMATCH_MP_TAC invo_homeo;
11631 REWRITE_TAC[reflC_cont];
11634 USE 2(MATCH_MP point_onto);
11636 ASM_REWRITE_TAC[reflCf_inv];
11640 let IMAGE2 = new_definition
11641 `IMAGE2 (f:A->B) U = IMAGE (IMAGE (f:A->B)) U`;;
11643 let reflA_h_edge = prove_by_refinement(
11644 `!m r. IMAGE (reflAf r) (h_edge m) = h_edge (left (reflAi r m))`,
11647 REWRITE_TAC[edge;reflAf;reflAi;IMAGE ;left ;];
11649 IMATCH_MP_TAC EQ_EXT;
11650 REWRITE_TAC[h_edge];
11652 CONV_TAC (dropq_conv "x'");
11653 CONV_TAC (dropq_conv "v");
11654 REWRITE_TAC[coord01];
11656 DISCH_THEN CHOOSE_TAC;
11657 TYPE_THEN `&2 * real_of_int r - u` EXISTS_TAC;
11660 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
11665 DISCH_THEN CHOOSE_TAC;
11666 TYPE_THEN `&2 * real_of_int r - u` EXISTS_TAC;
11667 ASM_REWRITE_TAC[REAL_ARITH `y - (y - x) = x`];
11669 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
11677 let reflA_v_edge = prove_by_refinement(
11678 `!m r. IMAGE (reflAf r) (v_edge m) = v_edge ( (reflAi r m))`,
11681 REWRITE_TAC[edge;reflAf;reflAi;IMAGE ;left ;];
11683 IMATCH_MP_TAC EQ_EXT;
11684 REWRITE_TAC[v_edge];
11686 CONV_TAC (dropq_conv "x'");
11687 CONV_TAC (dropq_conv "u");
11688 REWRITE_TAC[coord01];
11689 REWRITE_TAC[int_sub_th;int_mul_th;int_of_num_th;];
11694 let reflA_edge = prove_by_refinement(
11695 `!r e. (edge e ==> edge (IMAGE (reflAf r) e))`,
11702 DISCH_THEN DISJ_CASES_TAC;
11704 MESON_TAC[reflA_v_edge];
11706 MESON_TAC[reflA_h_edge];
11710 let reflB_v_edge = prove_by_refinement(
11711 `!m r. IMAGE (reflBf r) (v_edge m) = v_edge (down (reflBi r m))`,
11714 REWRITE_TAC[edge;reflBf;reflBi;IMAGE ;down ;];
11716 IMATCH_MP_TAC EQ_EXT;
11717 REWRITE_TAC[v_edge];
11719 CONV_TAC (dropq_conv "x'");
11720 CONV_TAC (dropq_conv "u");
11721 REWRITE_TAC[coord01];
11723 DISCH_THEN CHOOSE_TAC;
11724 TYPE_THEN `&2 * real_of_int r - v` EXISTS_TAC;
11727 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
11732 DISCH_THEN CHOOSE_TAC;
11733 TYPE_THEN `&2 * real_of_int r - v` EXISTS_TAC;
11734 ASM_REWRITE_TAC[REAL_ARITH `y - (y - x) = x`];
11736 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
11744 let reflB_h_edge = prove_by_refinement(
11745 `!m r. IMAGE (reflBf r) (h_edge m) = h_edge ( (reflBi r m))`,
11748 REWRITE_TAC[edge;reflBf;reflBi;IMAGE ;down ;];
11750 IMATCH_MP_TAC EQ_EXT;
11751 REWRITE_TAC[h_edge];
11753 CONV_TAC (dropq_conv "x'");
11754 CONV_TAC (dropq_conv "v");
11755 REWRITE_TAC[coord01];
11756 REWRITE_TAC[int_sub_th;int_mul_th;int_of_num_th;];
11761 let reflB_edge = prove_by_refinement(
11762 `!r e. (edge e ==> edge (IMAGE (reflBf r) e))`,
11769 DISCH_THEN DISJ_CASES_TAC;
11771 MESON_TAC[reflB_v_edge];
11773 MESON_TAC[reflB_h_edge];
11777 let reflC_vh_edge = prove_by_refinement(
11778 `!m . IMAGE (reflCf) (v_edge m) = h_edge ( (reflCi m))`,
11781 REWRITE_TAC[edge;reflCf;reflCi;IMAGE ;down ;];
11783 IMATCH_MP_TAC EQ_EXT;
11784 REWRITE_TAC[v_edge;h_edge];
11786 CONV_TAC (dropq_conv "x'");
11787 CONV_TAC (dropq_conv "u");
11788 CONV_TAC (dropq_conv "v");
11789 REWRITE_TAC[coord01];
11794 let reflC_hv_edge = prove_by_refinement(
11795 `!m . IMAGE (reflCf) (h_edge m) = v_edge ( (reflCi m))`,
11798 REWRITE_TAC[edge;reflCf;reflCi;IMAGE ;down ;];
11800 IMATCH_MP_TAC EQ_EXT;
11801 REWRITE_TAC[v_edge;h_edge];
11803 CONV_TAC (dropq_conv "x'");
11804 CONV_TAC (dropq_conv "u");
11805 CONV_TAC (dropq_conv "v");
11806 REWRITE_TAC[coord01];
11811 let reflC_edge = prove_by_refinement(
11812 `!e. (edge e ==> edge (IMAGE (reflCf ) e))`,
11819 DISCH_THEN DISJ_CASES_TAC;
11821 MESON_TAC[reflC_vh_edge];
11823 MESON_TAC[reflC_hv_edge];
11827 let homeo_bij = prove_by_refinement(
11828 `!(f:A->B) U V. (homeomorphism f U V) ==> (BIJ (IMAGE f) U V)`,
11831 REWRITE_TAC[BIJ;homeomorphism;continuous;preimage;];
11835 ASM_REWRITE_TAC[IMAGE;];
11838 USE 6 (REWRITE_RULE[]);
11839 USE 6(CONV_RULE NAME_CONFLICT_CONV);
11840 IMATCH_MP_TAC EQ_EXT;
11847 TYPE_THEN `(?x''. x x'' /\ (f x' = f x''))` SUBGOAL_TAC;
11848 TYPE_THEN `x'` EXISTS_TAC;
11857 TYPE_THEN `(UNIONS U) x'' /\ (UNIONS U) x'''` SUBGOAL_TAC;
11858 REWRITE_TAC[UNIONS;];
11861 TYPE_THEN `(UNIONS U x')` SUBGOAL_TAC;
11862 REWRITE_TAC[UNIONS;];
11865 TYPE_THEN `x' = x'''` SUBGOAL_TAC;
11866 USE 0(REWRITE_RULE[INJ]);
11869 TYPE_THEN `x' = x''` SUBGOAL_TAC;
11870 USE 0(REWRITE_RULE[INJ]);
11877 TYPE_THEN `(?x''. y x'' /\ (f x' = f x''))` SUBGOAL_TAC;
11878 TYPE_THEN `x'` EXISTS_TAC;
11887 TYPE_THEN `(UNIONS U) x'' /\ (UNIONS U) x'''` SUBGOAL_TAC;
11888 REWRITE_TAC[UNIONS;];
11891 TYPE_THEN `(UNIONS U x')` SUBGOAL_TAC;
11892 REWRITE_TAC[UNIONS;];
11895 TYPE_THEN `x' = x'''` SUBGOAL_TAC;
11896 USE 0(REWRITE_RULE[INJ]);
11899 TYPE_THEN `x' = x''` SUBGOAL_TAC;
11900 USE 0(REWRITE_RULE[INJ]);
11904 REWRITE_TAC[INJ;SURJ];
11908 TYPE_THEN `{z | UNIONS U z /\ x (f z)}` EXISTS_TAC;
11911 DISCH_THEN IMATCH_MP_TAC ;
11913 IMATCH_MP_TAC SUBSET_ANTISYM;
11915 REWRITE_TAC[IMAGE;SUBSET ;];
11917 CONV_TAC (dropq_conv "x''");
11919 REWRITE_TAC[SUBSET;IMAGE];
11926 TYPE_THEN `UNIONS V x'` SUBGOAL_TAC;
11927 REWRITE_TAC[UNIONS;];
11936 let homeo_unions = prove_by_refinement(
11937 `!(f:A->B) U V. (homeomorphism f U V) ==>
11938 (IMAGE f (UNIONS U) = (UNIONS V))`,
11941 REWRITE_TAC[homeomorphism;BIJ;SURJ;IMAGE;];
11943 IMATCH_MP_TAC EQ_EXT;
11957 let homeo_closed = prove_by_refinement(
11958 `!(f:A->B) U V A. (homeomorphism f U V /\ (A SUBSET (UNIONS U)) ==>
11959 (closed_ V (IMAGE f A) = closed_ U A))`,
11963 TYPE_THEN `BIJ f (UNIONS U) (UNIONS V)` SUBGOAL_TAC;
11964 ASM_MESON_TAC[homeomorphism];
11966 USE 2(MATCH_MP DIFF_SURJ);
11969 ASM_REWRITE_TAC[closed;open_DEF];
11972 USE 0(REWRITE_RULE[homeomorphism;continuous]);
11977 TSPEC `IMAGE f (UNIONS U DIFF A)` 5;
11979 TYPE_THEN `preimage (UNIONS U) f (IMAGE f (UNIONS U DIFF A)) = UNIONS U DIFF A` SUBGOAL_TAC;
11980 IMATCH_MP_TAC EQ_EXT ;
11982 REWRITE_TAC[INR in_preimage;IMAGE;DIFF;];
11983 USE 0(REWRITE_RULE[BIJ;INJ]);
11993 USE 0 (REWRITE_RULE[homeomorphism;BIJ;SURJ]);
11994 REWRITE_TAC[IMAGE;SUBSET];
11998 REWRITE_TAC[SUBSET];
12000 USE 0(REWRITE_RULE[homeomorphism]);
12006 (* ------------------------------------------------------------------ *)
12008 (* ------------------------------------------------------------------ *)
12011 let IMAGE_INTERS = prove_by_refinement(
12012 `!(f:A->B) A X . (INJ f X UNIV) /\ (UNIONS A SUBSET X) /\
12014 ((IMAGE f) (INTERS A) = (INTERS (IMAGE2 f A)))`,
12019 REWRITE_TAC[IMAGE2;INTERS;IMAGE;];
12020 IMATCH_MP_TAC EQ_EXT;
12034 TYPE_THEN `x'` EXISTS_TAC;
12037 USE 3 (CONV_RULE (dropq_conv "u'"));
12038 USE 3 (CONV_RULE (dropq_conv "y'"));
12039 USE 2(REWRITE_RULE[EMPTY_EXISTS]);
12045 TYPE_THEN `x'` EXISTS_TAC;
12048 USE 0(REWRITE_RULE[INJ]);
12052 TYPEL_THEN [`x'`;`x''`] (USE 0 o ISPECL);
12053 USE 1(REWRITE_RULE[UNIONS;ISUBSET]);
12059 let homeo_closure = prove_by_refinement(
12060 `!(f:A->B) U V A. (homeomorphism f U V) /\ (A SUBSET (UNIONS U)) /\
12062 (IMAGE f (closure U A) = closure V (IMAGE f A))`,
12067 REWRITE_TAC[closure];
12068 TYPE_THEN `INJ f (UNIONS U) (UNIV)` SUBGOAL_TAC;
12069 USE 0(REWRITE_RULE[homeomorphism;BIJ;INJ;]);
12070 ASM_REWRITE_TAC[INJ];
12072 TYPE_THEN `C = {B | closed_ U B /\ A SUBSET B}` ABBREV_TAC ;
12073 TYPE_THEN `(UNIONS C SUBSET UNIONS U)` SUBGOAL_TAC;
12074 REWRITE_TAC[SUBSET;];
12076 REWRITE_TAC[closed];
12077 TYPE_THEN `X = UNIONS U` ABBREV_TAC ;
12078 REWRITE_TAC[UNIONS];
12079 MESON_TAC[ISUBSET];
12081 TYPE_THEN `~(C = EMPTY)` SUBGOAL_TAC;
12082 REWRITE_TAC[EMPTY_EXISTS];
12083 TYPE_THEN `UNIONS U` EXISTS_TAC;
12085 ASM_REWRITE_TAC[closed; ISUBSET; DIFF_EQ_EMPTY;];
12086 ASM_SIMP_TAC[INR open_EMPTY];
12090 USE 3 (MATCH_MP IMAGE_INTERS);
12093 REWRITE_TAC[IMAGE2];
12095 IMATCH_MP_TAC EQ_EXT;
12097 TYPE_THEN `g = IMAGE f` ABBREV_TAC ;
12098 REWRITE_TAC[IMAGE];
12101 DISCH_THEN CHOOSE_TAC;
12105 TYPE_THEN `x' SUBSET (UNIONS U)` SUBGOAL_TAC;
12106 USE 6(REWRITE_RULE[closed]);
12108 ASM_SIMP_TAC[homeo_closed];
12110 REWRITE_TAC[ISUBSET;IMAGE];
12112 ASM_MESON_TAC[ISUBSET];
12114 TYPE_THEN `preimage (UNIONS U) f x` EXISTS_TAC;
12115 TYPE_THEN `x = g (preimage (UNIONS U) f x)` SUBGOAL_TAC;
12116 REWRITE_TAC[preimage];
12118 IMATCH_MP_TAC EQ_EXT;
12122 REWRITE_TAC[IMAGE];
12124 USE 0 (REWRITE_RULE[homeomorphism;BIJ;SURJ]);
12128 TYPE_THEN `UNIONS V x'` SUBGOAL_TAC;
12129 USE 6(REWRITE_RULE[closed]);
12130 ASM_MESON_TAC[ISUBSET];
12134 REWRITE_TAC[IMAGE];
12135 DISCH_THEN CHOOSE_TAC;
12139 ONCE_ASM_REWRITE_TAC[];
12142 TYPE_THEN `preimage (UNIONS U) f x SUBSET (UNIONS U)` SUBGOAL_TAC;
12143 REWRITE_TAC[preimage;SUBSET;];
12145 ASM_SIMP_TAC[GSYM homeo_closed];
12146 REWRITE_TAC[preimage;SUBSET];
12149 ASM_MESON_TAC[ISUBSET];
12152 REWRITE_TAC[IMAGE;ISUBSET;];
12159 let INJ_IMAGE = prove_by_refinement(
12160 `!(f :A->B) A B X . (A SUBSET X) /\ (B SUBSET X) /\
12161 (INJ f X UNIV) ==> ((IMAGE f A = IMAGE f B) <=> (A = B))`,
12167 IMATCH_MP_TAC SUBSET_ANTISYM;
12168 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE]);
12170 RULE_ASSUM_TAC (REWRITE_RULE[]);
12172 REWRITE_TAC[SUBSET];
12173 PROOF_BY_CONTR_TAC;
12174 USE 4(REWRITE_RULE [DE_MORGAN_THM]);
12175 FIRST_ASSUM (DISJ_CASES_TAC);
12180 TYPE_THEN `A x` SUBGOAL_TAC;
12183 TYPE_THEN `(?x'. A x' /\ (f x = f x'))` SUBGOAL_TAC;
12186 TYPE_THEN `(?x'. B x' /\ (f x = f x'))` SUBGOAL_TAC;
12190 USE 0(REWRITE_RULE[BIJ;INJ]);
12191 TYPE_THEN `x = x'` SUBGOAL_TAC;
12192 ASM_MESON_TAC[ISUBSET];
12198 TYPE_THEN `B x` SUBGOAL_TAC;
12201 TYPE_THEN `(?x'. B x' /\ (f x = f x'))` SUBGOAL_TAC;
12204 TYPE_THEN `(?x'. A x' /\ (f x = f x'))` SUBGOAL_TAC;
12208 USE 0(REWRITE_RULE[BIJ;INJ]);
12209 TYPE_THEN `x = x'` SUBGOAL_TAC;
12210 ASM_MESON_TAC[ISUBSET];
12212 DISCH_THEN_REWRITE;
12216 let INJ_UNIV = prove_by_refinement(
12217 `!(f: A->B) X Y. (INJ f X Y) ==> (INJ f X UNIV)`,
12226 let homeo_adj = prove_by_refinement(
12227 `!f X Y. (homeomorphism f top2 top2) /\ (X SUBSET euclid 2) /\
12228 (Y SUBSET euclid 2)
12229 ==> (adj X Y ==> (adj (IMAGE f X) (IMAGE f Y)))`,
12232 REWRITE_TAC[adj;INTER;EMPTY_EXISTS];
12234 ASSUME_TAC top2_top;
12235 ASSUME_TAC top2_unions;
12236 TYPE_THEN `X SUBSET (UNIONS top2) /\ Y SUBSET (UNIONS (top2))` SUBGOAL_TAC;
12238 TYPE_THEN `closure top2 (IMAGE f X) = IMAGE f (closure top2 X)` SUBGOAL_TAC;
12239 ASM_MESON_TAC[GSYM homeo_closure];
12240 DISCH_THEN_REWRITE;
12241 TYPE_THEN `closure top2 (IMAGE f Y) = IMAGE f (closure top2 Y)` SUBGOAL_TAC;
12242 ASM_MESON_TAC[GSYM homeo_closure];
12243 DISCH_THEN_REWRITE;
12246 PROOF_BY_CONTR_TAC;
12247 RULE_ASSUM_TAC (REWRITE_RULE[]);
12251 TYPE_THEN `INJ f (euclid 2) UNIV` SUBGOAL_TAC;
12252 IMATCH_MP_TAC INJ_UNIV;
12253 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ]);
12258 ASM_MESON_TAC[INJ_IMAGE];
12259 (* done WITH both *)
12260 TYPE_THEN `f u` EXISTS_TAC;
12261 REWRITE_TAC[IMAGE];
12267 let homeomorphism_inv = prove_by_refinement(
12268 `!(f:A->B) U V. homeomorphism f U V ==>
12269 (homeomorphism (INV f (UNIONS U) (UNIONS V)) V U)`,
12273 REWRITE_TAC[homeomorphism];
12274 ASM_SIMP_TAC[INV_homeomorphism];
12275 USE 0(REWRITE_RULE [homeomorphism;continuous;]);
12277 ASM_SIMP_TAC[INVERSE_BIJ];
12281 TYPE_THEN `g = INV f (UNIONS U) (UNIONS V)` ABBREV_TAC ;
12282 TYPE_THEN `BIJ g (UNIONS V) (UNIONS U)` SUBGOAL_TAC;
12284 IMATCH_MP_TAC INVERSE_BIJ;
12286 TYPE_THEN `!x'. (A x' ==> (f (g x') = x'))` SUBGOAL_TAC;
12288 TYPEL_THEN [`f`;`UNIONS U`;`UNIONS V`] (fun t-> ASSUME_TAC (ISPECL t (INR INVERSE_DEF)));
12289 RULE_ASSUM_TAC (REWRITE_RULE[BIJ]);
12292 FIRST_ASSUM IMATCH_MP_TAC ;
12293 REWRITE_TAC[UNIONS];
12298 TYPE_THEN `(IMAGE g A) = preimage (UNIONS U) f A` SUBGOAL_TAC;
12299 REWRITE_TAC[IMAGE;preimage];
12300 IMATCH_MP_TAC EQ_EXT;
12309 USE 2(MATCH_MP INVERSE_BIJ);
12310 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
12312 FIRST_ASSUM IMATCH_MP_TAC ;
12313 REWRITE_TAC [UNIONS];
12316 TYPE_THEN `f x` EXISTS_TAC;
12318 TYPE_THEN `f x = f (g (f x))` SUBGOAL_TAC;
12321 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
12323 FIRST_ASSUM IMATCH_MP_TAC ;
12327 TYPE_THEN `UNIONS V (f x)` SUBGOAL_TAC;
12328 FIRST_ASSUM IMATCH_MP_TAC ;
12331 FIRST_ASSUM IMATCH_MP_TAC ;
12337 let inv_comp_left = prove_by_refinement(
12338 `!(f:A->B) X Y x. (BIJ f X Y /\ X x) ==> (INV f X Y (f x) = x)`,
12342 TYPE_THEN `Y (f x)` SUBGOAL_TAC;
12343 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
12345 ASM_MESON_TAC[INR INVERSE_XY];
12349 let inv_comp_right = prove_by_refinement(
12350 `!(f:A->B) X Y y. (BIJ f X Y /\ Y y) ==> (f (INV f X Y y) = y)`,
12354 RULE_ASSUM_TAC (REWRITE_RULE[BIJ]);
12355 ASM_MESON_TAC[INR INVERSE_DEF;];
12359 let image_inv_image = prove_by_refinement(
12360 `!(f:A->B) A X Y. (BIJ f X Y) /\ (A SUBSET X) ==>
12361 (IMAGE (INV f X Y) (IMAGE f A) = A)`,
12365 REWRITE_TAC[IMAGE];
12366 IMATCH_MP_TAC EQ_EXT;
12370 CONV_TAC (dropq_conv "x''");
12373 TYPE_THEN `x = x'` SUBGOAL_TAC;
12375 ASM_MESON_TAC [inv_comp_left;ISUBSET;];
12378 TYPE_THEN `x` EXISTS_TAC;
12380 ONCE_REWRITE_TAC[EQ_SYM_EQ];
12381 IMATCH_MP_TAC inv_comp_left;
12382 ASM_MESON_TAC[ISUBSET];
12386 let homeo_adj_eq = prove_by_refinement(
12387 `!f X Y. (homeomorphism f top2 top2) /\ (X SUBSET euclid 2) /\
12388 (Y SUBSET euclid 2)
12389 ==> (adj X Y = (adj (IMAGE f X) (IMAGE f Y)))`,
12394 ASM_MESON_TAC[homeo_adj];
12395 TYPEL_THEN [`INV f (euclid 2) (euclid 2)`;`IMAGE f X`;`IMAGE f Y`] (fun t-> MP_TAC (ISPECL t homeo_adj));
12396 ASSUME_TAC top2_unions;
12397 TYPE_THEN `homeomorphism (INV f (euclid 2) (euclid 2)) top2 top2` SUBGOAL_TAC;
12398 ASM_MESON_TAC[homeomorphism_inv];
12399 DISCH_THEN_REWRITE;
12400 TYPE_THEN `BIJ f (euclid 2) (euclid 2)` SUBGOAL_TAC;
12401 ASM_MESON_TAC[homeomorphism];
12403 ASM_SIMP_TAC[image_inv_image];
12405 TYPE_THEN `IMAGE f X SUBSET euclid 2 /\ IMAGE f Y SUBSET euclid 2` SUBGOAL_TAC;
12406 REWRITE_TAC[IMAGE;SUBSET];
12408 CONJ_TAC THEN (CONV_TAC (dropq_conv "x''")) THEN (RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]));
12409 ASM_MESON_TAC[ISUBSET];
12410 ASM_MESON_TAC[ISUBSET];
12416 let finite_num_closure = prove_by_refinement(
12417 `!G top (x:A). FINITE G ==> (FINITE {C | G C /\ closure top C x})`,
12421 IMATCH_MP_TAC FINITE_SUBSET;
12422 TYPE_THEN `G` EXISTS_TAC;
12423 ASM_REWRITE_TAC[SUBSET];
12428 let image_powerset = prove_by_refinement(
12429 `!(f:A->B) X Y. (BIJ f X Y ==>
12430 (BIJ (IMAGE f) {z | z SUBSET X} { z | z SUBSET Y}))`,
12440 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
12442 REWRITE_TAC[IMAGE;SUBSET;];
12443 ASM_MESON_TAC[ISUBSET ;];
12444 REWRITE_TAC[IMAGE;SUBSET;];
12446 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
12448 IMATCH_MP_TAC EQ_EXT;
12452 USE 1(REWRITE_RULE[]);
12459 TYPE_THEN `(?x''. x x'' /\ (f x' = f x''))` SUBGOAL_TAC;
12461 DISCH_THEN_REWRITE;
12463 TYPE_THEN `x' = x''` SUBGOAL_TAC;
12464 FIRST_ASSUM IMATCH_MP_TAC ;
12472 TYPE_THEN `(?x''. y x'' /\ (f x' = f x''))` SUBGOAL_TAC;
12474 DISCH_THEN_REWRITE;
12476 TYPE_THEN `x' = x''` SUBGOAL_TAC;
12477 FIRST_ASSUM IMATCH_MP_TAC ;
12480 REWRITE_TAC[INJ;SURJ];
12484 TYPE_THEN `{z | X z /\ x (f z) }` EXISTS_TAC;
12486 REWRITE_TAC[SUBSET];
12489 REWRITE_TAC[IMAGE];
12490 IMATCH_MP_TAC EQ_EXT ;
12498 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
12501 USE 3(REWRITE_RULE[SUBSET]);
12506 TYPE_THEN `y` EXISTS_TAC;
12511 let image_power_inj = prove_by_refinement(
12512 `!(f:A->B) X Y A B. (BIJ f X Y /\ A SUBSET X /\ B SUBSET X ==>
12513 ((IMAGE f A = IMAGE f B) <=> (A = B)))`,
12517 TYPEL_THEN [`f`;`X`;`Y`] (fun t -> ASSUME_TAC (ISPECL t image_powerset ));
12519 USE 3(REWRITE_RULE[BIJ;INJ;]);
12523 DISCH_THEN_REWRITE;
12527 let image_power_surj = prove_by_refinement(
12528 `!(f:A->B) X Y B. (BIJ f X Y /\ B SUBSET Y ==>
12529 (?A. (A SUBSET X /\ (IMAGE f A = B))))`,
12533 TYPEL_THEN [`f`;`X`;`Y`] (fun t -> ASSUME_TAC (ISPECL t image_powerset ));
12535 USE 2(REWRITE_RULE[BIJ;SURJ]);
12541 let segment_euclid = prove_by_refinement(
12542 `!G e. (segment G /\ G e) ==> (e SUBSET (euclid 2))`,
12546 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
12548 USE 3(REWRITE_RULE[SUBSET]);
12551 USE 3(REWRITE_RULE[edge]);
12553 ASM_MESON_TAC[h_edge_euclid;v_edge_euclid];
12557 let image_app = prove_by_refinement(
12558 `!(f:A->B) X Y x t. INJ f X Y /\ x SUBSET X /\ (X t) ==>
12559 (IMAGE f x (f t) = x t)`,
12562 REWRITE_TAC[INJ;IMAGE;SUBSET ;];
12570 let homeo_num_closure = prove_by_refinement(
12571 `!G f m. (homeomorphism f top2 top2 /\ segment G) ==>
12572 (num_closure G (pointI m) =
12573 (num_closure (IMAGE2 f G) (f (pointI m))))`,
12577 ASSUME_TAC top2_unions;
12578 ASSUME_TAC top2_top;
12579 TYPE_THEN `BIJ f (euclid 2) (euclid 2)` SUBGOAL_TAC;
12580 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism]);
12583 TYPE_THEN `G` (fun t-> ASSUME_TAC (ISPEC t segment_euclid));
12584 REWRITE_TAC[num_closure];
12585 IMATCH_MP_TAC BIJ_CARD;
12586 TYPE_THEN `IMAGE f` EXISTS_TAC;
12588 IMATCH_MP_TAC finite_num_closure;
12589 ASM_MESON_TAC[segment_finite];
12596 REWRITE_TAC[IMAGE2];
12598 REWRITE_TAC[IMAGE];
12599 TYPE_THEN `x` EXISTS_TAC;
12601 TYPE_THEN `x SUBSET (UNIONS top2)` SUBGOAL_TAC;
12604 TYPE_THEN `IMAGE f (closure top2 x) = closure top2 (IMAGE f x)` SUBGOAL_TAC;
12605 ASM_MESON_TAC [homeo_closure];
12606 DISCH_THEN (fun t->REWRITE_TAC[GSYM t]);
12607 REWRITE_TAC[IMAGE];
12610 TYPE_THEN `x SUBSET (euclid 2) /\ y SUBSET (euclid 2)` SUBGOAL_TAC;
12613 ASM_MESON_TAC[image_power_inj];
12614 REWRITE_TAC[INJ;SURJ];
12618 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE2]);
12620 TYPE_THEN `g = IMAGE f` ABBREV_TAC ;
12621 REWRITE_TAC[IMAGE];
12624 TYPE_THEN `x'` EXISTS_TAC;
12628 TYPE_THEN `x' SUBSET (UNIONS top2)` SUBGOAL_TAC;
12631 TYPE_THEN `closure top2 (g x') = IMAGE f (closure top2 x')` SUBGOAL_TAC;
12632 ASM_MESON_TAC [GSYM homeo_closure];
12633 DISCH_THEN_REWRITE;
12635 TYPE_THEN `INJ f (euclid 2) (euclid 2) /\ (closure top2 x' SUBSET (euclid 2)) /\ (euclid 2 (pointI m))` SUBGOAL_TAC;
12636 RULE_ASSUM_TAC (REWRITE_RULE[BIJ]);
12637 ASM_REWRITE_TAC[pointI;euclid_point];
12638 IMATCH_MP_TAC c_edge_euclid;
12639 ASM_MESON_TAC[segment;ISUBSET];
12641 USE 12 (MATCH_MP image_app);
12646 (* ------------------------------------------------------------------ *)
12648 (* ------------------------------------------------------------------ *)
12650 let reflA_pointI = prove_by_refinement(
12651 `!r m. (reflAf r (pointI m) = pointI (reflAi r m))`,
12655 REWRITE_TAC[reflAi;reflAf;pointI];
12656 REWRITE_TAC[point_inj;PAIR_SPLIT;];
12657 REWRITE_TAC[int_of_num_th;int_add_th;int_mul_th;int_sub_th;coord01];
12661 let reflB_pointI = prove_by_refinement(
12662 `!r m. (reflBf r (pointI m) = pointI (reflBi r m))`,
12666 REWRITE_TAC[reflBi;reflBf;pointI];
12667 REWRITE_TAC[point_inj;PAIR_SPLIT;];
12668 REWRITE_TAC[int_of_num_th;int_add_th;int_mul_th;int_sub_th;coord01];
12672 let reflC_pointI = prove_by_refinement(
12673 `!m. (reflCf (pointI m) = pointI (reflCi m))`,
12677 REWRITE_TAC[reflCi;reflCf;pointI];
12678 REWRITE_TAC[point_inj;PAIR_SPLIT;];
12679 REWRITE_TAC[int_of_num_th;int_add_th;int_mul_th;int_sub_th;coord01];
12683 let edge_euclid2 = prove_by_refinement(
12684 `!e. (edge e ==> e SUBSET (euclid 2))`,
12687 MESON_TAC [edge;h_edge_euclid;v_edge_euclid;];
12691 let reflA_segment = prove_by_refinement(
12692 `!G r. (segment G ==> (segment (IMAGE2 (reflAf r) G)))`,
12696 REWRITE_TAC[segment];
12698 USE 0(REWRITE_RULE[segment]);
12700 TYPE_THEN `homeomorphism (reflAf r) top2 top2` SUBGOAL_TAC;
12701 REWRITE_TAC[reflA_homeo];
12703 ASSUME_TAC top2_top;
12704 ASSUME_TAC top2_unions;
12705 TYPE_THEN `BIJ (reflAf r) (euclid 2) (euclid 2)` SUBGOAL_TAC;
12706 ASM_MESON_TAC[homeomorphism];
12708 TYPE_THEN `INJ (IMAGE (reflAf r)) edge edge` SUBGOAL_TAC;
12709 REWRITE_TAC[INJ;reflA_edge;];
12711 TYPE_THEN `y SUBSET (euclid 2) /\ x SUBSET (euclid 2)` SUBGOAL_TAC;
12712 ASM_MESON_TAC[edge_euclid2];
12714 ASM_MESON_TAC[image_power_inj];
12718 REWRITE_TAC[IMAGE2];
12719 IMATCH_MP_TAC FINITE_IMAGE;
12723 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
12725 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE2; EQ_EMPTY]);
12726 TSPEC `IMAGE (reflAf r) u` 4;
12729 TYPE_THEN `IMAGE (IMAGE (reflAf r)) G (IMAGE (reflAf r) u) = G u` SUBGOAL_TAC;
12730 IMATCH_MP_TAC image_app;
12734 ASM_MESON_TAC[ISUBSET];
12738 ASM_MESON_TAC[image_power_inj];
12741 ASM_MESON_TAC[ISUBSET];
12746 REWRITE_TAC[IMAGE2;SUBSET];
12748 GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV ) [IMAGE];
12752 IMATCH_MP_TAC reflA_edge;
12753 ASM_MESON_TAC[ISUBSET;];
12755 (* num closure clause *)
12758 TYPE_THEN `pointI m = reflAf r (pointI (reflAi r m))` SUBGOAL_TAC;
12759 REWRITE_TAC[reflA_pointI;reflAi_inv];
12760 DISCH_THEN_REWRITE;
12761 TYPE_THEN `num_closure (IMAGE2 (reflAf r) G) (reflAf r (pointI (reflAi r m))) = num_closure G (pointI (reflAi r m))` SUBGOAL_TAC;
12762 IMATCH_MP_TAC (GSYM homeo_num_closure);
12764 DISCH_THEN_REWRITE;
12766 (* inductive_set clause *)
12769 USE 16(REWRITE_RULE[IMAGE2]);
12770 USE 16 (MATCH_MP SUBSET_PREIMAGE);
12773 TYPE_THEN `Z SUBSET G /\ ~(Z = {}) /\ (!C C'. Z C /\ G C' /\ adj C C' ==> Z C')` SUBGOAL_TAC;
12776 PROOF_BY_CONTR_TAC;
12777 RULE_ASSUM_TAC (REWRITE_RULE[]);
12779 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE_CLAUSES]);
12782 TYPE_THEN `D = IMAGE (reflAf r) C` ABBREV_TAC ;
12783 TYPE_THEN `D' = IMAGE (reflAf r) C'` ABBREV_TAC ;
12784 TSPEC `D` 14; (* *)
12786 TYPE_THEN `S D /\ IMAGE2 (reflAf r) G D' /\ adj D D'` SUBGOAL_TAC;
12790 TYPE_THEN `IMAGE (IMAGE (reflAf r)) Z (IMAGE (reflAf r) C) = Z C` SUBGOAL_TAC;
12791 IMATCH_MP_TAC image_app;
12792 TYPE_THEN `edge` EXISTS_TAC;
12793 TYPE_THEN `edge` EXISTS_TAC;
12796 IMATCH_MP_TAC SUBSET_TRANS;
12797 TYPE_THEN `G` EXISTS_TAC;
12799 REWRITE_TAC[SUBSET];
12800 DISCH_THEN IMATCH_MP_TAC ;
12802 DISCH_THEN_REWRITE;
12808 REWRITE_TAC[IMAGE2;IMAGE];
12810 TYPE_THEN `C'` EXISTS_TAC;
12815 TYPE_THEN `C SUBSET (euclid 2) /\ (C' SUBSET (euclid 2))` SUBGOAL_TAC;
12816 ASM_MESON_TAC[ISUBSET;edge_euclid2];
12818 TYPE_THEN `(adj C C' ==> adj (IMAGE (reflAf r) C) (IMAGE (reflAf r) C'))` SUBGOAL_TAC;
12819 IMATCH_MP_TAC homeo_adj;
12821 DISCH_THEN IMATCH_MP_TAC ;
12827 TYPE_THEN `IMAGE (IMAGE (reflAf r)) Z (IMAGE (reflAf r) C') = Z C'` SUBGOAL_TAC;
12828 IMATCH_MP_TAC image_app;
12829 TYPE_THEN `edge` EXISTS_TAC;
12830 TYPE_THEN `edge` EXISTS_TAC;
12833 IMATCH_MP_TAC SUBSET_TRANS;
12834 TYPE_THEN `G` EXISTS_TAC;
12839 ASM_MESON_TAC[ISUBSET];
12843 ASM_REWRITE_TAC[IMAGE2];
12847 let reflB_segment = prove_by_refinement(
12848 `!G r. (segment G ==> (segment (IMAGE2 (reflBf r) G)))`,
12852 REWRITE_TAC[segment];
12854 USE 0(REWRITE_RULE[segment]);
12856 TYPE_THEN `homeomorphism (reflBf r) top2 top2` SUBGOAL_TAC;
12857 REWRITE_TAC[reflB_homeo];
12859 ASSUME_TAC top2_top;
12860 ASSUME_TAC top2_unions;
12861 TYPE_THEN `BIJ (reflBf r) (euclid 2) (euclid 2)` SUBGOAL_TAC;
12862 ASM_MESON_TAC[homeomorphism];
12864 TYPE_THEN `INJ (IMAGE (reflBf r)) edge edge` SUBGOAL_TAC;
12865 REWRITE_TAC[INJ;reflB_edge;];
12867 TYPE_THEN `y SUBSET (euclid 2) /\ x SUBSET (euclid 2)` SUBGOAL_TAC;
12868 ASM_MESON_TAC[edge_euclid2];
12870 ASM_MESON_TAC[image_power_inj];
12874 REWRITE_TAC[IMAGE2];
12875 IMATCH_MP_TAC FINITE_IMAGE;
12879 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
12881 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE2; EQ_EMPTY]);
12882 TSPEC `IMAGE (reflBf r) u` 4;
12885 TYPE_THEN `IMAGE (IMAGE (reflBf r)) G (IMAGE (reflBf r) u) = G u` SUBGOAL_TAC;
12886 IMATCH_MP_TAC image_app;
12890 ASM_MESON_TAC[ISUBSET];
12894 ASM_MESON_TAC[image_power_inj];
12897 ASM_MESON_TAC[ISUBSET];
12902 REWRITE_TAC[IMAGE2;SUBSET];
12904 GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV ) [IMAGE];
12908 IMATCH_MP_TAC reflB_edge;
12909 ASM_MESON_TAC[ISUBSET;];
12911 (* num closure clause *)
12914 TYPE_THEN `pointI m = reflBf r (pointI (reflBi r m))` SUBGOAL_TAC;
12915 REWRITE_TAC[reflB_pointI;reflBi_inv];
12916 DISCH_THEN_REWRITE;
12917 TYPE_THEN `num_closure (IMAGE2 (reflBf r) G) (reflBf r (pointI (reflBi r m))) = num_closure G (pointI (reflBi r m))` SUBGOAL_TAC;
12918 IMATCH_MP_TAC (GSYM homeo_num_closure);
12920 DISCH_THEN_REWRITE;
12922 (* inductive_set clause *)
12925 USE 16(REWRITE_RULE[IMAGE2]);
12926 USE 16 (MATCH_MP SUBSET_PREIMAGE);
12929 TYPE_THEN `Z SUBSET G /\ ~(Z = {}) /\ (!C C'. Z C /\ G C' /\ adj C C' ==> Z C')` SUBGOAL_TAC;
12932 PROOF_BY_CONTR_TAC;
12933 RULE_ASSUM_TAC (REWRITE_RULE[]);
12935 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE_CLAUSES]);
12938 TYPE_THEN `D = IMAGE (reflBf r) C` ABBREV_TAC ;
12939 TYPE_THEN `D' = IMAGE (reflBf r) C'` ABBREV_TAC ;
12940 TSPEC `D` 14; (* *)
12942 TYPE_THEN `S D /\ IMAGE2 (reflBf r) G D' /\ adj D D'` SUBGOAL_TAC;
12946 TYPE_THEN `IMAGE (IMAGE (reflBf r)) Z (IMAGE (reflBf r) C) = Z C` SUBGOAL_TAC;
12947 IMATCH_MP_TAC image_app;
12948 TYPE_THEN `edge` EXISTS_TAC;
12949 TYPE_THEN `edge` EXISTS_TAC;
12952 IMATCH_MP_TAC SUBSET_TRANS;
12953 TYPE_THEN `G` EXISTS_TAC;
12955 REWRITE_TAC[SUBSET];
12956 DISCH_THEN IMATCH_MP_TAC ;
12958 DISCH_THEN_REWRITE;
12964 REWRITE_TAC[IMAGE2;IMAGE];
12966 TYPE_THEN `C'` EXISTS_TAC;
12971 TYPE_THEN `C SUBSET (euclid 2) /\ (C' SUBSET (euclid 2))` SUBGOAL_TAC;
12972 ASM_MESON_TAC[ISUBSET;edge_euclid2];
12974 TYPE_THEN `(adj C C' ==> adj (IMAGE (reflBf r) C) (IMAGE (reflBf r) C'))` SUBGOAL_TAC;
12975 IMATCH_MP_TAC homeo_adj;
12977 DISCH_THEN IMATCH_MP_TAC ;
12983 TYPE_THEN `IMAGE (IMAGE (reflBf r)) Z (IMAGE (reflBf r) C') = Z C'` SUBGOAL_TAC;
12984 IMATCH_MP_TAC image_app;
12985 TYPE_THEN `edge` EXISTS_TAC;
12986 TYPE_THEN `edge` EXISTS_TAC;
12989 IMATCH_MP_TAC SUBSET_TRANS;
12990 TYPE_THEN `G` EXISTS_TAC;
12995 ASM_MESON_TAC[ISUBSET];
12999 ASM_REWRITE_TAC[IMAGE2];
13003 let reflC_segment = prove_by_refinement(
13004 `!G . (segment G ==> (segment (IMAGE2 (reflCf) G)))`,
13009 REWRITE_TAC[segment];
13011 USE 0(REWRITE_RULE[segment]);
13013 TYPE_THEN `homeomorphism (reflCf) top2 top2` SUBGOAL_TAC;
13014 REWRITE_TAC[reflC_homeo];
13016 ASSUME_TAC top2_top;
13017 ASSUME_TAC top2_unions;
13018 TYPE_THEN `BIJ (reflCf) (euclid 2) (euclid 2)` SUBGOAL_TAC;
13019 ASM_MESON_TAC[homeomorphism];
13021 TYPE_THEN `INJ (IMAGE (reflCf)) edge edge` SUBGOAL_TAC;
13022 REWRITE_TAC[INJ;reflC_edge;];
13024 TYPE_THEN `y SUBSET (euclid 2) /\ x SUBSET (euclid 2)` SUBGOAL_TAC;
13025 ASM_MESON_TAC[edge_euclid2];
13027 ASM_MESON_TAC[image_power_inj];
13031 REWRITE_TAC[IMAGE2];
13032 IMATCH_MP_TAC FINITE_IMAGE;
13036 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
13038 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE2; EQ_EMPTY]);
13039 TSPEC `IMAGE (reflCf) u` 4;
13042 TYPE_THEN `IMAGE (IMAGE (reflCf)) G (IMAGE (reflCf) u) = G u` SUBGOAL_TAC;
13043 IMATCH_MP_TAC image_app;
13047 ASM_MESON_TAC[ISUBSET];
13051 ASM_MESON_TAC[image_power_inj];
13054 ASM_MESON_TAC[ISUBSET];
13059 REWRITE_TAC[IMAGE2;SUBSET];
13061 GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV ) [IMAGE];
13065 IMATCH_MP_TAC reflC_edge;
13066 ASM_MESON_TAC[ISUBSET;];
13068 (* num closure clause *)
13071 TYPE_THEN `pointI m = reflCf (pointI (reflCi m))` SUBGOAL_TAC;
13072 REWRITE_TAC[reflC_pointI;reflCi_inv];
13073 DISCH_THEN_REWRITE;
13074 TYPE_THEN `num_closure (IMAGE2 (reflCf) G) (reflCf (pointI (reflCi m))) = num_closure G (pointI (reflCi m))` SUBGOAL_TAC;
13075 IMATCH_MP_TAC (GSYM homeo_num_closure);
13077 DISCH_THEN_REWRITE;
13079 (* inductive_set clause *)
13082 USE 16(REWRITE_RULE[IMAGE2]);
13083 USE 16 (MATCH_MP SUBSET_PREIMAGE);
13086 TYPE_THEN `Z SUBSET G /\ ~(Z = {}) /\ (!C C'. Z C /\ G C' /\ adj C C' ==> Z C')` SUBGOAL_TAC;
13089 PROOF_BY_CONTR_TAC;
13090 RULE_ASSUM_TAC (REWRITE_RULE[]);
13092 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE_CLAUSES]);
13095 TYPE_THEN `D = IMAGE (reflCf) C` ABBREV_TAC ;
13096 TYPE_THEN `D' = IMAGE (reflCf) C'` ABBREV_TAC ;
13097 TSPEC `D` 14; (* *)
13099 TYPE_THEN `S D /\ IMAGE2 (reflCf) G D' /\ adj D D'` SUBGOAL_TAC;
13103 TYPE_THEN `IMAGE (IMAGE (reflCf)) Z (IMAGE (reflCf) C) = Z C` SUBGOAL_TAC;
13104 IMATCH_MP_TAC image_app;
13105 TYPE_THEN `edge` EXISTS_TAC;
13106 TYPE_THEN `edge` EXISTS_TAC;
13109 IMATCH_MP_TAC SUBSET_TRANS;
13110 TYPE_THEN `G` EXISTS_TAC;
13112 REWRITE_TAC[SUBSET];
13113 DISCH_THEN IMATCH_MP_TAC ;
13115 DISCH_THEN_REWRITE;
13121 REWRITE_TAC[IMAGE2;IMAGE];
13123 TYPE_THEN `C'` EXISTS_TAC;
13128 TYPE_THEN `C SUBSET (euclid 2) /\ (C' SUBSET (euclid 2))` SUBGOAL_TAC;
13129 ASM_MESON_TAC[ISUBSET;edge_euclid2];
13131 TYPE_THEN `(adj C C' ==> adj (IMAGE (reflCf) C) (IMAGE (reflCf) C'))` SUBGOAL_TAC;
13132 IMATCH_MP_TAC homeo_adj;
13134 DISCH_THEN IMATCH_MP_TAC ;
13140 TYPE_THEN `IMAGE (IMAGE (reflCf)) Z (IMAGE (reflCf) C') = Z C'` SUBGOAL_TAC;
13141 IMATCH_MP_TAC image_app;
13142 TYPE_THEN `edge` EXISTS_TAC;
13143 TYPE_THEN `edge` EXISTS_TAC;
13146 IMATCH_MP_TAC SUBSET_TRANS;
13147 TYPE_THEN `G` EXISTS_TAC;
13152 ASM_MESON_TAC[ISUBSET];
13156 ASM_REWRITE_TAC[IMAGE2];
13161 let point_x = prove_by_refinement(
13162 `!x m. (x = point m) <=> (euclid 2 x /\ (FST m = x 0) /\ (SND m = x 1))`,
13167 DISCH_THEN_REWRITE;
13168 REWRITE_TAC[coord01;euclid_point];
13170 USE 2 (MATCH_MP point_onto );
13172 ASM_REWRITE_TAC[point_inj];
13173 REWRITE_TAC[PAIR_SPLIT];
13174 ASM_REWRITE_TAC[coord01];
13178 (* next IMAGE of square *)
13180 let reflA_squ = prove_by_refinement(
13181 `!m r. IMAGE (reflAf r) (squ m) = squ (left (reflAi r m))`,
13184 REWRITE_TAC[squ;reflAf;reflAi;IMAGE ;left ;];
13186 IMATCH_MP_TAC EQ_EXT;
13189 CONV_TAC (dropq_conv "x'");
13190 REWRITE_TAC[coord01;];
13191 REWRITE_TAC[point_x];
13192 CONV_TAC (dropq_conv "v");
13195 TYPE_THEN `&2 * real_of_int r - u` EXISTS_TAC;
13200 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
13204 TYPE_THEN `&2 * real_of_int r - u` EXISTS_TAC;
13205 ASM_REWRITE_TAC[REAL_ARITH `y - (y - x) = x`];
13209 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
13214 let reflB_squ = prove_by_refinement(
13215 `!m r. IMAGE (reflBf r) (squ m) = squ (down (reflBi r m))`,
13218 REWRITE_TAC[squ;reflBf;reflBi;IMAGE ;down ;];
13220 IMATCH_MP_TAC EQ_EXT;
13223 CONV_TAC (dropq_conv "x'");
13224 REWRITE_TAC[coord01;];
13225 REWRITE_TAC[point_x];
13226 CONV_TAC (dropq_conv "u");
13229 TYPE_THEN `&2 * real_of_int r - v` EXISTS_TAC;
13234 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
13238 TYPE_THEN `&2 * real_of_int r - v` EXISTS_TAC;
13239 ASM_REWRITE_TAC[REAL_ARITH `y - (y - x) = x`];
13243 ASM_REWRITE_TAC[int_sub_th;int_of_num_th;int_add_th;int_mul_th;];
13248 let reflC_squ = prove_by_refinement(
13249 `!m. IMAGE (reflCf) (squ m) = squ ( (reflCi m))`,
13252 REWRITE_TAC[squ;reflCf;reflCi;IMAGE ; ];
13254 IMATCH_MP_TAC EQ_EXT;
13257 CONV_TAC (dropq_conv "x'");
13258 REWRITE_TAC[coord01;];
13259 REWRITE_TAC[point_x];
13260 CONV_TAC (dropq_conv "u");
13261 CONV_TAC (dropq_conv "v");
13267 let powerset = jordan_def `powerset (X:A->bool) = { z | z SUBSET X }`;;
13269 let image_sing = prove_by_refinement(
13270 `!(f:A -> B) x. (IMAGE f {x} = {(f x)})`,
13273 REWRITE_TAC[IMAGE;INSERT];
13274 CONV_TAC (dropq_conv "x'");
13278 let image_unions = prove_by_refinement(
13280 (IMAGE f (UNIONS U) = UNIONS (IMAGE (IMAGE f) U))`,
13284 REWRITE_TAC[IMAGE;UNIONS;];
13285 IMATCH_MP_TAC EQ_EXT;
13290 CONV_TAC (dropq_conv "u");
13303 let segment_euclid = prove_by_refinement(
13304 `!G. (segment G) ==> (closure top2 (UNIONS G) SUBSET euclid 2)`,
13308 IMATCH_MP_TAC closure_subset;
13309 ASM_REWRITE_TAC[top2_top;GSYM top2_unions];
13311 IMATCH_MP_TAC closed_UNIV;
13312 REWRITE_TAC[top2_top];
13313 REWRITE_TAC[top2_unions;SUBSET;UNIONS;];
13315 TYPE_THEN `edge u` SUBGOAL_TAC;
13316 ASM_MESON_TAC[segment;ISUBSET];
13317 ASM_MESON_TAC[edge_euclid2;ISUBSET];
13321 let image_curve_cell_reflA = prove_by_refinement(
13322 `!G r. (segment G) ==>
13323 (curve_cell (IMAGE2 (reflAf r) G) =
13324 IMAGE2 (reflAf r) (curve_cell G))`,
13328 REWRITE_TAC[curve_cell];
13329 REWRITE_TAC[IMAGE2;IMAGE_UNION;];
13331 IMATCH_MP_TAC EQ_EXT;
13334 TYPE_THEN `UNIONS G SUBSET (euclid 2)` SUBGOAL_TAC;
13335 REWRITE_TAC[SUBSET;UNIONS;];
13337 TYPE_THEN `edge u` SUBGOAL_TAC;
13338 ASM_MESON_TAC[segment;ISUBSET;];
13339 ASM_MESON_TAC[edge_euclid2;ISUBSET];
13341 ASSUME_TAC top2_top;
13342 ASSUME_TAC top2_unions;
13344 TYPE_THEN `UNIONS (IMAGE (IMAGE (reflAf r)) G) = IMAGE (reflAf r) (UNIONS G)` SUBGOAL_TAC;
13345 REWRITE_TAC[GSYM image_unions];
13346 DISCH_THEN_REWRITE ;
13348 TYPE_THEN `closure top2 (IMAGE (reflAf r) (UNIONS G)) = IMAGE (reflAf r) (closure top2 (UNIONS G))` SUBGOAL_TAC;
13349 IMATCH_MP_TAC (GSYM homeo_closure);
13350 ASM_REWRITE_TAC[top2_top;reflA_homeo;top2_unions;];
13351 DISCH_THEN_REWRITE;
13353 TYPE_THEN `!n. IMAGE (reflAf r) (closure top2 (UNIONS G)) (pointI n) = closure top2 (UNIONS G) (pointI (reflAi r n))` SUBGOAL_TAC;
13355 TYPE_THEN `n' = reflAi r n` ABBREV_TAC ;
13356 TYPE_THEN `pointI n = reflAf r (pointI n')` SUBGOAL_TAC;
13359 ASM_REWRITE_TAC[reflA_pointI;reflAi_inv];
13360 DISCH_THEN_REWRITE;
13361 IMATCH_MP_TAC image_app;
13362 TYPE_THEN `(euclid 2)` EXISTS_TAC;
13363 TYPE_THEN `(euclid 2)` EXISTS_TAC;
13364 REWRITE_TAC[pointI;euclid_point];
13365 ASSUME_TAC reflA_homeo;
13366 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ;top2_unions;]);
13368 IMATCH_MP_TAC segment_euclid;
13370 DISCH_THEN_REWRITE;
13372 REWRITE_TAC[IMAGE;];
13373 CONV_TAC (dropq_conv "x'");
13374 (**** Modified by JRH to avoid GSPEC
13375 REWRITE_TAC[INR IN_SING;GSPEC;];
13377 REWRITE_TAC[INR IN_SING; UNWIND_THM2];
13379 CONV_TAC (dropq_conv "x'");
13380 CONV_TAC (dropq_conv "y'");
13381 (**** Removed by JRH
13382 REWRITE_TAC[GSPEC];
13387 TYPE_THEN `reflAi r n'` EXISTS_TAC;
13389 IMATCH_MP_TAC EQ_EXT;
13390 REWRITE_TAC[INR IN_SING; reflA_pointI; reflAi_inv;];
13391 (*** Removed by JRH
13396 TYPE_THEN `reflAi r n'` EXISTS_TAC;
13397 ASM_REWRITE_TAC[reflAi_inv;];
13398 IMATCH_MP_TAC EQ_EXT;
13399 REWRITE_TAC[INR IN_SING;reflA_pointI;];
13400 (*** Removed by JRH
13406 let image_curve_cell_reflB = prove_by_refinement(
13407 `!G r. (segment G) ==>
13408 (curve_cell (IMAGE2 (reflBf r) G) =
13409 IMAGE2 (reflBf r) (curve_cell G))`,
13413 REWRITE_TAC[curve_cell];
13414 REWRITE_TAC[IMAGE2;IMAGE_UNION;];
13416 IMATCH_MP_TAC EQ_EXT;
13419 TYPE_THEN `UNIONS G SUBSET (euclid 2)` SUBGOAL_TAC;
13420 REWRITE_TAC[SUBSET;UNIONS;];
13422 TYPE_THEN `edge u` SUBGOAL_TAC;
13423 ASM_MESON_TAC[segment;ISUBSET;];
13424 ASM_MESON_TAC[edge_euclid2;ISUBSET];
13426 ASSUME_TAC top2_top;
13427 ASSUME_TAC top2_unions;
13429 TYPE_THEN `UNIONS (IMAGE (IMAGE (reflBf r)) G) = IMAGE (reflBf r) (UNIONS G)` SUBGOAL_TAC;
13430 REWRITE_TAC[GSYM image_unions];
13431 DISCH_THEN_REWRITE ;
13433 TYPE_THEN `closure top2 (IMAGE (reflBf r) (UNIONS G)) = IMAGE (reflBf r) (closure top2 (UNIONS G))` SUBGOAL_TAC;
13434 IMATCH_MP_TAC (GSYM homeo_closure);
13435 ASM_REWRITE_TAC[top2_top;reflB_homeo;top2_unions;];
13436 DISCH_THEN_REWRITE;
13438 TYPE_THEN `!n. IMAGE (reflBf r) (closure top2 (UNIONS G)) (pointI n) = closure top2 (UNIONS G) (pointI (reflBi r n))` SUBGOAL_TAC;
13440 TYPE_THEN `n' = reflBi r n` ABBREV_TAC ;
13441 TYPE_THEN `pointI n = reflBf r (pointI n')` SUBGOAL_TAC;
13444 ASM_REWRITE_TAC[reflB_pointI;reflBi_inv];
13445 DISCH_THEN_REWRITE;
13446 IMATCH_MP_TAC image_app;
13447 TYPE_THEN `(euclid 2)` EXISTS_TAC;
13448 TYPE_THEN `(euclid 2)` EXISTS_TAC;
13449 REWRITE_TAC[pointI;euclid_point];
13450 ASSUME_TAC reflB_homeo;
13451 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ;top2_unions;]);
13453 IMATCH_MP_TAC segment_euclid;
13455 DISCH_THEN_REWRITE;
13457 REWRITE_TAC[IMAGE;];
13458 CONV_TAC (dropq_conv "x'");
13460 (*** JRH changed this line to avoid GSPEC
13461 REWRITE_TAC[INR IN_SING;GSPEC;];
13463 REWRITE_TAC[INR IN_SING; UNWIND_THM2];
13465 CONV_TAC (dropq_conv "x'");
13466 CONV_TAC (dropq_conv "y'");
13467 (*** JRH removed this to avoid GSPEC
13468 REWRITE_TAC[GSPEC];
13473 TYPE_THEN `reflBi r n'` EXISTS_TAC;
13475 IMATCH_MP_TAC EQ_EXT;
13476 REWRITE_TAC[INR IN_SING; reflB_pointI; reflBi_inv;];
13477 (*** Removed by JRH
13482 TYPE_THEN `reflBi r n'` EXISTS_TAC;
13483 ASM_REWRITE_TAC[reflBi_inv;];
13484 IMATCH_MP_TAC EQ_EXT;
13485 REWRITE_TAC[INR IN_SING;reflB_pointI;];
13486 (*** Removed by JRH
13492 let image_curve_cell_reflC = prove_by_refinement(
13493 `!G . (segment G) ==>
13494 (curve_cell (IMAGE2 (reflCf ) G) =
13495 IMAGE2 (reflCf) (curve_cell G))`,
13499 REWRITE_TAC[curve_cell];
13500 REWRITE_TAC[IMAGE2;IMAGE_UNION;];
13502 IMATCH_MP_TAC EQ_EXT;
13505 TYPE_THEN `UNIONS G SUBSET (euclid 2)` SUBGOAL_TAC;
13506 REWRITE_TAC[SUBSET;UNIONS;];
13508 TYPE_THEN `edge u` SUBGOAL_TAC;
13509 ASM_MESON_TAC[segment;ISUBSET;];
13510 ASM_MESON_TAC[edge_euclid2;ISUBSET];
13512 ASSUME_TAC top2_top;
13513 ASSUME_TAC top2_unions;
13515 TYPE_THEN `UNIONS (IMAGE (IMAGE (reflCf)) G) = IMAGE (reflCf) (UNIONS G)` SUBGOAL_TAC;
13516 REWRITE_TAC[GSYM image_unions];
13517 DISCH_THEN_REWRITE ;
13519 TYPE_THEN `closure top2 (IMAGE (reflCf) (UNIONS G)) = IMAGE (reflCf) (closure top2 (UNIONS G))` SUBGOAL_TAC;
13520 IMATCH_MP_TAC (GSYM homeo_closure);
13521 ASM_REWRITE_TAC[top2_top;reflC_homeo;top2_unions;];
13522 DISCH_THEN_REWRITE;
13524 TYPE_THEN `!n. IMAGE (reflCf) (closure top2 (UNIONS G)) (pointI n) = closure top2 (UNIONS G) (pointI (reflCi n))` SUBGOAL_TAC;
13526 TYPE_THEN `n' = reflCi n` ABBREV_TAC ;
13527 TYPE_THEN `pointI n = reflCf (pointI n')` SUBGOAL_TAC;
13530 ASM_REWRITE_TAC[reflC_pointI;reflCi_inv];
13531 DISCH_THEN_REWRITE;
13532 IMATCH_MP_TAC image_app;
13533 TYPE_THEN `(euclid 2)` EXISTS_TAC;
13534 TYPE_THEN `(euclid 2)` EXISTS_TAC;
13535 REWRITE_TAC[pointI;euclid_point];
13536 ASSUME_TAC reflC_homeo;
13537 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ;top2_unions;]);
13539 IMATCH_MP_TAC segment_euclid;
13541 DISCH_THEN_REWRITE;
13543 REWRITE_TAC[IMAGE;];
13544 CONV_TAC (dropq_conv "x'");
13545 (*** This line changed by JRH to avoid GSPEC
13546 REWRITE_TAC[INR IN_SING;GSPEC;];
13548 REWRITE_TAC[INR IN_SING; UNWIND_THM2];
13550 CONV_TAC (dropq_conv "x'");
13551 CONV_TAC (dropq_conv "y'");
13552 (*** Removed by JRH to avoid GSPEC
13553 REWRITE_TAC[GSPEC];
13558 TYPE_THEN `reflCi n'` EXISTS_TAC;
13560 IMATCH_MP_TAC EQ_EXT;
13561 REWRITE_TAC[INR IN_SING; reflC_pointI; reflCi_inv;];
13562 (*** Removed by JRH
13567 TYPE_THEN `reflCi n'` EXISTS_TAC;
13568 ASM_REWRITE_TAC[reflCi_inv;];
13569 IMATCH_MP_TAC EQ_EXT;
13570 REWRITE_TAC[INR IN_SING;reflC_pointI;];
13571 (*** Removed by JRH
13577 let inj_inter = prove_by_refinement(
13578 `!(f:A->B) X Y A B. (INJ f X Y) /\ (A SUBSET X) /\ (B SUBSET X) ==>
13579 (IMAGE f (A INTER B) = (IMAGE f A) INTER (IMAGE f B))`,
13583 REWRITE_TAC[IMAGE;INTER ];
13584 IMATCH_MP_TAC EQ_EXT;
13590 ASM_MESON_TAC[ISUBSET;];
13592 TYPE_THEN `x' = x''` SUBGOAL_TAC;
13593 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
13595 FIRST_ASSUM IMATCH_MP_TAC ;
13596 ASM_MESON_TAC[ISUBSET;];
13598 TYPE_THEN `x'` EXISTS_TAC;
13603 let homeomorphism_induced_top = prove_by_refinement(
13604 `!(f:A->B) U V A. (homeomorphism f U V) /\ (A SUBSET (UNIONS U)) ==>
13605 (IMAGE2 f (induced_top U A) = induced_top V (IMAGE f A))`,
13609 REWRITE_TAC[induced_top;];
13611 USE 1 (MATCH_MP homeo_bij);
13612 IMATCH_MP_TAC EQ_EXT;
13614 REWRITE_TAC[IMAGE2];
13615 TYPE_THEN `g = IMAGE f` ABBREV_TAC ;
13616 REWRITE_TAC[IMAGE];
13618 CONV_TAC (dropq_conv "x''");
13620 TYPE_THEN `!t. U t ==> (g (t INTER A) = g t INTER g A)` SUBGOAL_TAC;
13623 IMATCH_MP_TAC inj_inter;
13624 TYPE_THEN `(UNIONS U)` EXISTS_TAC;
13625 TYPE_THEN `(UNIONS V)` EXISTS_TAC;
13626 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ]);
13628 IMATCH_MP_TAC sub_union;
13638 TYPE_THEN `g x'` EXISTS_TAC;
13640 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
13645 TYPE_THEN `?t. U t /\ (g t = x')` SUBGOAL_TAC;
13646 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
13650 TYPE_THEN `t` EXISTS_TAC;
13658 let ctop_reflA = prove_by_refinement(
13659 `!G r. (segment G) ==>
13660 (IMAGE2 (reflAf r) (ctop G) = ctop (IMAGE2 (reflAf r) G))`,
13665 ASSUME_TAC reflA_homeo;
13666 TYPE_THEN `euclid 2 DIFF UNIONS (curve_cell G) SUBSET (UNIONS top2)` SUBGOAL_TAC;
13667 REWRITE_TAC[top2_unions;DIFF;SUBSET;];
13671 TYPE_THEN `IMAGE2 (reflAf r) (induced_top top2 (euclid 2 DIFF UNIONS (curve_cell G))) = induced_top top2 (IMAGE (reflAf r) (euclid 2 DIFF (UNIONS (curve_cell G))))` SUBGOAL_TAC;
13672 IMATCH_MP_TAC homeomorphism_induced_top;
13674 DISCH_THEN_REWRITE;
13678 TYPE_THEN `IMAGE (reflAf r) (euclid 2 DIFF UNIONS (curve_cell G)) = euclid 2 DIFF (IMAGE (reflAf r) (UNIONS (curve_cell G)))` SUBGOAL_TAC;
13679 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;top2_unions;]);
13681 USE 4 (MATCH_MP DIFF_SURJ);
13682 FIRST_ASSUM IMATCH_MP_TAC ;
13683 REWRITE_TAC[UNIONS;SUBSET;];
13685 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
13686 ASM_MESON_TAC[segment];
13688 TYPE_THEN `cell u` SUBGOAL_TAC;
13689 USE 7 (MATCH_MP curve_cell_cell);
13690 ASM_MESON_TAC[ISUBSET;];
13691 ASM_MESON_TAC[ISUBSET;cell_euclid];
13692 DISCH_THEN_REWRITE;
13694 REWRITE_TAC[image_unions];
13696 ASM_SIMP_TAC[image_curve_cell_reflA];
13697 REWRITE_TAC[IMAGE2];
13701 let ctop_reflB = prove_by_refinement(
13702 `!G r. (segment G) ==>
13703 (IMAGE2 (reflBf r) (ctop G) = ctop (IMAGE2 (reflBf r) G))`,
13708 ASSUME_TAC reflB_homeo;
13709 TYPE_THEN `euclid 2 DIFF UNIONS (curve_cell G) SUBSET (UNIONS top2)` SUBGOAL_TAC;
13710 REWRITE_TAC[top2_unions;DIFF;SUBSET;];
13714 TYPE_THEN `IMAGE2 (reflBf r) (induced_top top2 (euclid 2 DIFF UNIONS (curve_cell G))) = induced_top top2 (IMAGE (reflBf r) (euclid 2 DIFF (UNIONS (curve_cell G))))` SUBGOAL_TAC;
13715 IMATCH_MP_TAC homeomorphism_induced_top;
13717 DISCH_THEN_REWRITE;
13721 TYPE_THEN `IMAGE (reflBf r) (euclid 2 DIFF UNIONS (curve_cell G)) = euclid 2 DIFF (IMAGE (reflBf r) (UNIONS (curve_cell G)))` SUBGOAL_TAC;
13722 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;top2_unions;]);
13724 USE 4 (MATCH_MP DIFF_SURJ);
13725 FIRST_ASSUM IMATCH_MP_TAC ;
13726 REWRITE_TAC[UNIONS;SUBSET;];
13728 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
13729 ASM_MESON_TAC[segment];
13731 TYPE_THEN `cell u` SUBGOAL_TAC;
13732 USE 7 (MATCH_MP curve_cell_cell);
13733 ASM_MESON_TAC[ISUBSET;];
13734 ASM_MESON_TAC[ISUBSET;cell_euclid];
13735 DISCH_THEN_REWRITE;
13737 REWRITE_TAC[image_unions];
13739 ASM_SIMP_TAC[image_curve_cell_reflB];
13740 REWRITE_TAC[IMAGE2];
13744 let ctop_reflC = prove_by_refinement(
13745 `!G . (segment G) ==>
13746 (IMAGE2 (reflCf) (ctop G) = ctop (IMAGE2 (reflCf) G))`,
13751 ASSUME_TAC reflC_homeo;
13752 TYPE_THEN `euclid 2 DIFF UNIONS (curve_cell G) SUBSET (UNIONS top2)` SUBGOAL_TAC;
13753 REWRITE_TAC[top2_unions;DIFF;SUBSET;];
13757 TYPE_THEN `IMAGE2 (reflCf) (induced_top top2 (euclid 2 DIFF UNIONS (curve_cell G))) = induced_top top2 (IMAGE (reflCf) (euclid 2 DIFF (UNIONS (curve_cell G))))` SUBGOAL_TAC;
13758 IMATCH_MP_TAC homeomorphism_induced_top;
13760 DISCH_THEN_REWRITE;
13763 TYPE_THEN `IMAGE (reflCf) (euclid 2 DIFF UNIONS (curve_cell G)) = euclid 2 DIFF (IMAGE (reflCf) (UNIONS (curve_cell G)))` SUBGOAL_TAC;
13764 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;top2_unions;]);
13766 USE 4 (MATCH_MP DIFF_SURJ);
13767 FIRST_ASSUM IMATCH_MP_TAC ;
13768 REWRITE_TAC[UNIONS;SUBSET;];
13770 TYPE_THEN `G SUBSET edge` SUBGOAL_TAC;
13771 ASM_MESON_TAC[segment];
13773 TYPE_THEN `cell u` SUBGOAL_TAC;
13774 USE 7 (MATCH_MP curve_cell_cell);
13775 ASM_MESON_TAC[ISUBSET;];
13776 ASM_MESON_TAC[ISUBSET;cell_euclid];
13777 DISCH_THEN_REWRITE;
13779 REWRITE_TAC[image_unions];
13781 ASM_SIMP_TAC[image_curve_cell_reflC];
13782 REWRITE_TAC[IMAGE2];
13786 let connected_homeo = prove_by_refinement(
13787 `!(f:A->B) U V Z. (homeomorphism f U V /\ (Z SUBSET UNIONS U) ==>
13788 (connected V (IMAGE f Z) = connected U Z))`,
13792 TYPE_THEN `g = INV f (UNIONS U) (UNIONS V)` ABBREV_TAC ;
13793 TYPE_THEN `Z = IMAGE g (IMAGE f Z)` SUBGOAL_TAC;
13794 IMATCH_MP_TAC EQ_EXT;
13796 REWRITE_TAC[IMAGE];
13799 CONV_TAC (dropq_conv "x''");
13800 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism]);
13802 TYPE_THEN `!x'. (UNIONS U x') ==> (INV f (UNIONS U) (UNIONS V) (f x') = x')` SUBGOAL_TAC;
13804 IMATCH_MP_TAC inv_comp_left;
13810 TYPE_THEN ` x` EXISTS_TAC;
13813 ASM_MESON_TAC[ISUBSET;];
13816 TYPE_THEN `UNIONS U x'` SUBGOAL_TAC;
13817 ASM_MESON_TAC[ISUBSET];
13825 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
13826 IMATCH_MP_TAC connect_image;
13827 TYPE_THEN `V` EXISTS_TAC;
13831 IMATCH_MP_TAC INV_homeomorphism;
13833 REWRITE_TAC[IMAGE;SUBSET;];
13839 TYPE_THEN `UNIONS U x''` SUBGOAL_TAC;
13840 ASM_MESON_TAC[ISUBSET];
13842 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism]);
13843 TYPE_THEN `x = x''` SUBGOAL_TAC;
13844 ASM_MESON_TAC[inv_comp_left];
13847 IMATCH_MP_TAC connect_image;
13848 TYPE_THEN `U` EXISTS_TAC;
13850 RULE_ASSUM_TAC (REWRITE_RULE [homeomorphism;BIJ;INJ]);
13852 ASM_REWRITE_TAC[SUBSET;IMAGE;];
13854 CONV_TAC (dropq_conv "x''");
13855 ASM_MESON_TAC[ISUBSET;];
13859 (* start here , Tues Jun 8 , 2004 *)
13861 let component = prove_by_refinement(
13862 `!U (x:A) . (component U x = {y | ?Z. connected U Z /\ Z x /\ Z y})`,
13866 IMATCH_MP_TAC EQ_EXT;
13867 REWRITE_TAC[component_DEF ;];
13871 let component_homeo = prove_by_refinement(
13872 `!(f:A->B) U V x. (homeomorphism f U V) /\ (UNIONS U x) ==>
13873 (IMAGE f (component U x) = (component V (f x)))`,
13877 REWRITE_TAC[component ;IMAGE ; ];
13878 IMATCH_MP_TAC EQ_EXT ;
13881 CONV_TAC (dropq_conv "x'");
13884 TYPE_THEN `IMAGE f Z` EXISTS_TAC;
13886 TYPE_THEN `Z SUBSET UNIONS U` SUBGOAL_TAC;
13887 RULE_ASSUM_TAC (REWRITE_RULE[connected]);
13889 ASM_SIMP_TAC[connected_homeo];
13891 REWRITE_TAC[IMAGE];
13896 TYPE_THEN `?A. A SUBSET (UNIONS U) /\ (IMAGE f A = Z)` SUBGOAL_TAC;
13897 IMATCH_MP_TAC image_power_surj;
13898 TYPE_THEN `UNIONS V` EXISTS_TAC;
13899 ASM_MESON_TAC[connected;homeomorphism];
13901 TYPE_THEN `A` EXISTS_TAC;
13903 WITH 5 (REWRITE_RULE[IMAGE]);
13907 TYPE_THEN `x''` EXISTS_TAC;
13911 TYPE_THEN ` x = x'''` SUBGOAL_TAC;
13912 RULE_ASSUM_TAC (REWRITE_RULE [homeomorphism;BIJ;INJ]);
13914 FIRST_ASSUM IMATCH_MP_TAC ;
13916 ASM_MESON_TAC[ISUBSET];
13917 DISCH_THEN_REWRITE;
13920 ASM_SIMP_TAC[GSYM connected_homeo];
13924 let bij_homeo = prove_by_refinement(
13925 `!(f:A->B) U V. (BIJ f (UNIONS U) (UNIONS V)) /\
13926 (BIJ (IMAGE f) U V) ==> (homeomorphism f U V)`,
13930 REWRITE_TAC[homeomorphism;continuous;];
13931 ASM_REWRITE_TAC[preimage;];
13936 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ;SURJ]);
13942 TYPE_THEN `{x | UNIONS U x /\ IMAGE f y (f x)} = y` SUBGOAL_TAC;
13943 IMATCH_MP_TAC EQ_EXT;
13948 TYPE_THEN `IMAGE f y (f x) = y x` SUBGOAL_TAC;
13949 IMATCH_MP_TAC image_app ;
13950 TYPE_THEN `(UNIONS U)` EXISTS_TAC;
13951 TYPE_THEN `(UNIONS V)` EXISTS_TAC;
13952 RULE_ASSUM_TAC (REWRITE_RULE[BIJ]);
13954 ASM_MESON_TAC[sub_union];
13958 ASM_MESON_TAC[sub_union;ISUBSET];
13959 REWRITE_TAC[IMAGE];
13961 DISCH_THEN_REWRITE;
13965 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
13971 let homeomorphism_subset = prove_by_refinement(
13972 `!(f:A->B) U V C. (homeomorphism f U V) /\ (C SUBSET U) ==>
13973 (homeomorphism f C (IMAGE2 f C))`,
13978 IMATCH_MP_TAC bij_homeo;
13980 TYPE_THEN `UNIONS C SUBSET UNIONS U` SUBGOAL_TAC;
13981 IMATCH_MP_TAC UNIONS_UNIONS ;
13984 REWRITE_TAC[IMAGE2 ;GSYM image_unions;];
13985 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ]);
13992 TYPE_THEN `IMAGE f (UNIONS C) (f x) = (UNIONS C) x` SUBGOAL_TAC;
13993 IMATCH_MP_TAC (image_app);
13994 TYPE_THEN `(UNIONS U)` EXISTS_TAC;
13995 TYPE_THEN `(UNIONS V)` EXISTS_TAC;
13997 ASM_MESON_TAC[ISUBSET];
13998 DISCH_THEN_REWRITE;
14002 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
14004 FIRST_ASSUM IMATCH_MP_TAC ;
14005 ASM_MESON_TAC [ISUBSET];
14011 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE]);
14015 WITH_FIRST (MATCH_MP homeo_bij);
14020 REWRITE_TAC[IMAGE2;];
14021 TYPE_THEN `g = IMAGE f` ABBREV_TAC ;
14022 REWRITE_TAC[IMAGE];
14025 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
14027 FIRST_ASSUM IMATCH_MP_TAC ;
14029 ASM_MESON_TAC[ISUBSET];
14030 REWRITE_TAC[INJ;SURJ];
14034 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE2]);
14035 TYPE_THEN `g = IMAGE f` ABBREV_TAC ;
14037 REWRITE_TAC[IMAGE];
14043 let component_reflA = prove_by_refinement(
14044 `!(f:A->B) G r x. (segment G) /\ (UNIONS (ctop G) x) ==>
14045 (IMAGE (reflAf r) (component (ctop G) x) =
14046 (component (ctop (IMAGE2 (reflAf r) G)) (reflAf r x)))`,
14050 IMATCH_MP_TAC component_homeo;
14052 TYPE_THEN `ctop (IMAGE2 (reflAf r) G) = IMAGE2 (reflAf r) (ctop G)` SUBGOAL_TAC ;
14053 ASM_MESON_TAC[ctop_reflA];
14054 DISCH_THEN_REWRITE;
14055 IMATCH_MP_TAC homeomorphism_subset;
14056 TYPE_THEN `top2` EXISTS_TAC;
14057 TYPE_THEN `top2` EXISTS_TAC;
14058 REWRITE_TAC[reflA_homeo];
14059 REWRITE_TAC[SUBSET];
14060 ASM_MESON_TAC[ctop_top2];
14064 let component_reflB = prove_by_refinement(
14065 `!(f:A->B) G r x. (segment G) /\ (UNIONS (ctop G) x) ==>
14066 (IMAGE (reflBf r) (component (ctop G) x) =
14067 (component (ctop (IMAGE2 (reflBf r) G)) (reflBf r x)))`,
14071 IMATCH_MP_TAC component_homeo;
14073 TYPE_THEN `ctop (IMAGE2 (reflBf r) G) = IMAGE2 (reflBf r) (ctop G)` SUBGOAL_TAC ;
14074 ASM_MESON_TAC[ctop_reflB];
14075 DISCH_THEN_REWRITE;
14076 IMATCH_MP_TAC homeomorphism_subset;
14077 TYPE_THEN `top2` EXISTS_TAC;
14078 TYPE_THEN `top2` EXISTS_TAC;
14079 REWRITE_TAC[reflB_homeo];
14080 REWRITE_TAC[SUBSET];
14081 ASM_MESON_TAC[ctop_top2];
14085 let component_reflC = prove_by_refinement(
14086 `!(f:A->B) G x. (segment G) /\ (UNIONS (ctop G) x) ==>
14087 (IMAGE (reflCf) (component (ctop G) x) =
14088 (component (ctop (IMAGE2 (reflCf) G)) (reflCf x)))`,
14092 IMATCH_MP_TAC component_homeo;
14094 TYPE_THEN `ctop (IMAGE2 (reflCf) G) = IMAGE2 (reflCf) (ctop G)` SUBGOAL_TAC ;
14095 ASM_MESON_TAC[ctop_reflC];
14096 DISCH_THEN_REWRITE;
14097 IMATCH_MP_TAC homeomorphism_subset;
14098 TYPE_THEN `top2` EXISTS_TAC;
14099 TYPE_THEN `top2` EXISTS_TAC;
14100 REWRITE_TAC[reflC_homeo];
14101 REWRITE_TAC[SUBSET];
14102 ASM_MESON_TAC[ctop_top2];
14106 let subset_union_inter = prove_by_refinement(
14107 `!(X:A->bool) A B. (X SUBSET (A UNION B) ==>
14108 (~(X INTER A = EMPTY )) \/ (~(X INTER B = EMPTY)) \/ (X = EMPTY ))`,
14111 (REWRITE_TAC [EMPTY_EXISTS;SUBSET;UNION;INTER;EQ_EMPTY ; ]);
14116 let squ_disj = prove_by_refinement(
14117 `!m n. ((squ m INTER squ n = {}) <=> ~(m = n))`,
14124 RULE_ASSUM_TAC (REWRITE_RULE[INTER_IDEMPOT;]);
14125 ASM_MESON_TAC[cell_nonempty;cell_rules];
14127 PROOF_BY_CONTR_TAC;
14128 TYPE_THEN `squ m = squ n` SUBGOAL_TAC;
14129 IMATCH_MP_TAC cell_partition;
14130 ASM_MESON_TAC[cell_rules];
14131 ASM_REWRITE_TAC[squ_inj];
14136 let cell_clauses = prove_by_refinement(
14137 `(!m. (~(v_edge m = EMPTY ) /\ ~(h_edge m = EMPTY )
14138 /\ ~(squ m = EMPTY ) /\ ~({(pointI m)} = EMPTY ))) /\
14139 (!m n. (v_edge m INTER {(pointI n)} = EMPTY ) /\
14140 ({(pointI n)} INTER v_edge m = EMPTY ) /\
14141 (h_edge m INTER {(pointI n)} = EMPTY ) /\
14142 ({(pointI n)} INTER h_edge m = EMPTY ) /\
14143 (squ m INTER {(pointI n)} = EMPTY ) /\
14144 ({(pointI n)} INTER squ m = EMPTY ) /\
14145 ((v_edge m INTER v_edge n = EMPTY ) <=> ~(m = n) ) /\
14146 ((h_edge m INTER h_edge n = EMPTY ) <=> ~(m = n) ) /\
14147 ((squ m INTER squ n = EMPTY ) <=> ~(m = n) ) /\
14148 (squ m INTER h_edge n = EMPTY ) /\
14149 (h_edge n INTER squ m = EMPTY ) /\
14150 (squ m INTER v_edge n = EMPTY ) /\
14151 ( v_edge n INTER squ m = EMPTY ) /\
14152 (h_edge m INTER v_edge n = EMPTY ) /\
14153 ( v_edge n INTER h_edge m = EMPTY ) /\
14154 (({(pointI n)} INTER {(pointI m)} = EMPTY ) <=> ~(n = m)) /\
14155 (({(pointI n)} = {(pointI m)} ) <=> (n = m)) /\
14156 ~(h_edge n = {(pointI m)}) /\
14157 ~(v_edge n = {(pointI m)}) /\
14158 ~(squ n = {(pointI m)}) /\
14159 ~( {(pointI m)} = h_edge n) /\
14160 ~( {(pointI m)} = v_edge n) /\
14161 ~( {(pointI m)} = squ n) /\
14162 ~(h_edge m = v_edge n) /\
14163 ((h_edge m = h_edge n) <=> (m = n)) /\
14164 ~(h_edge m = squ n) /\
14165 ~(v_edge m = h_edge n) /\
14166 ((v_edge m = v_edge n) <=> (m = n)) /\
14167 ~(v_edge m = squ n) /\
14168 ~(squ m = h_edge n) /\
14169 ((squ m = squ n) <=> (m = n)) /\
14170 ~(squ m = v_edge n) /\
14171 ~(squ m (pointI n)) /\
14172 ~(v_edge m (pointI n)) /\
14173 ~(h_edge m (pointI n)) /\
14174 ((pointI n = pointI m) <=> (n = m))) `,
14177 (let notrr = REWRITE_RULE[not_eq] in
14178 let interc = ONCE_REWRITE_RULE[INTER_COMM] in
14181 ASM_MESON_TAC[cell_nonempty;cell_rules];
14183 ASM_REWRITE_TAC[INTER_ACI;notrr v_edge_disj;notrr h_edge_disj;interc square_h_edge;square_h_edge;interc square_v_edge;square_v_edge;square_disj;single_inter;h_edge_inj;v_edge_inj;notrr squ_inj;INR IN_SING;hv_edgeV2; square_h_edgeV2; square_v_edgeV2;hv_edge;square_pointIv2;v_edge_pointIv2;h_edge_pointIv2;notrr single_inter;v_edge_pointI;h_edge_pointI;square_pointI;pointI_inj;squ_disj];
14184 REWRITE_TAC[eq_sing;INR IN_SING;pointI_inj;];
14185 CONV_TAC (dropq_conv "u");
14186 ASM_MESON_TAC[pointI_inj];
14190 let inter_union = prove_by_refinement(
14191 `!X A (B:A->bool). ~(X INTER (A UNION B) = EMPTY) ==>
14192 ~(X INTER A = EMPTY) \/ ~(X INTER B = EMPTY)`,
14195 REWRITE_TAC[INTER;UNION;EMPTY_EXISTS;];
14200 let squc_v = prove_by_refinement(
14201 `!m n. (v_edge m SUBSET squc n) ==> (n = m) \/ (n = left m)`,
14204 REWRITE_TAC[squc_union;];
14206 USE_FIRST (MATCH_MP subset_union_inter) THEN (RULE_ASSUM_TAC (REWRITE_RULE[cell_clauses])) ;
14207 REPEAT (USE_FIRST (MATCH_MP inter_union) THEN (RULE_ASSUM_TAC (REWRITE_RULE[cell_clauses]))) ;
14208 FIRST_ASSUM DISJ_CASES_TAC;
14211 USE_FIRST (MATCH_MP inter_union) THEN (RULE_ASSUM_TAC (REWRITE_RULE[cell_clauses])) ;
14212 ASM_REWRITE_TAC[right_left];
14217 let squc_h = prove_by_refinement(
14218 `!m n. (h_edge m SUBSET squc n) ==> (n = m) \/ (n = down m)`,
14221 REWRITE_TAC[squc_union;];
14223 USE_FIRST (MATCH_MP subset_union_inter) THEN (RULE_ASSUM_TAC (REWRITE_RULE[cell_clauses])) ;
14224 REPEAT (USE_FIRST (MATCH_MP inter_union) THEN (RULE_ASSUM_TAC (REWRITE_RULE[cell_clauses]))) ;
14225 FIRST_ASSUM DISJ_CASES_TAC;
14228 USE_FIRST (MATCH_MP inter_union) THEN (RULE_ASSUM_TAC (REWRITE_RULE[cell_clauses])) ;
14229 FIRST_ASSUM DISJ_CASES_TAC;
14230 ASM_REWRITE_TAC[right_left];
14232 REPEAT (USE_FIRST (MATCH_MP inter_union) THEN (RULE_ASSUM_TAC (REWRITE_RULE[cell_clauses]))) ;
14238 let component_empty = prove_by_refinement(
14239 `!U (x:A). (topology_ U) ==> ((component U x = EMPTY) = ~(UNIONS U x))`,
14243 REWRITE_TAC[component ;EQ_EMPTY;];
14247 ASM_MESON_TAC[connected_sing;INR IN_SING;];
14249 RULE_ASSUM_TAC (REWRITE_RULE[connected]);
14251 ASM_MESON_TAC[ISUBSET];
14255 let image_imp = prove_by_refinement(
14256 `!(f:A->B) X t. X t ==> (IMAGE f X) (f t)`,
14260 REWRITE_TAC[IMAGE];
14265 let image_inj = prove_by_refinement(
14266 `!(f:A->B) X A B. (INJ f X UNIV) /\ (A SUBSET X ) /\ (B SUBSET X) /\
14267 (IMAGE f A SUBSET IMAGE f B) ==> (A SUBSET B)`,
14270 REWRITE_TAC[INJ;IMAGE;SUBSET;];
14276 let closure_euclid = prove_by_refinement(
14277 `closure (top2) (euclid 2) = euclid 2`,
14280 REWRITE_TAC[closure;top2];
14281 IMATCH_MP_TAC SUBSET_ANTISYM;
14283 IMATCH_MP_TAC INTERS_SUBSET;
14284 REWRITE_TAC[SUBSET_REFL;];
14285 ASM_MESON_TAC[closed_UNIV;top_of_metric_top;metric_euclid;top_of_metric_unions;];
14286 REWRITE_TAC[INTERS;SUBSET];
14288 FIRST_ASSUM IMATCH_MP_TAC ;
14293 let closure_euclid = prove_by_refinement(
14294 `!A. (A SUBSET (euclid 2) ==> (closure top2 A SUBSET (euclid 2)))`,
14298 ONCE_REWRITE_TAC [GSYM closure_euclid];
14299 IMATCH_MP_TAC subset_of_closure;
14300 ASM_REWRITE_TAC[top2_top];
14304 let along_lemma7 = prove_by_refinement(
14305 `!G m n x e. (segment G /\ (squ n SUBSET component (ctop G) x) /\
14306 (v_edge m SUBSET squc n) /\
14307 (G (v_edge m)) /\ G e /\ (closure top2 e (pointI m)) ==>
14308 (?p. e SUBSET closure top2 (squ p) /\
14309 (squ p SUBSET (component (ctop G) x))))`,
14313 WITH_FIRST (MATCH_MP squc_v);
14314 FIRST_ASSUM (DISJ_CASES_TAC);
14316 IMATCH_MP_TAC along_lemma6;
14317 TYPE_THEN `m` EXISTS_TAC;
14325 TYPE_THEN `e' = IMAGE (reflAf (&:0)) e ` ABBREV_TAC ;
14326 TYPE_THEN `G' = IMAGE2 (reflAf (&:0)) G` ABBREV_TAC ;
14327 TYPE_THEN `x' = reflAf (&:0) x` ABBREV_TAC ;
14328 TYPE_THEN `UNIONS (ctop G) x` SUBGOAL_TAC;
14329 TYPE_THEN `~(component (ctop G) x = EMPTY)` SUBGOAL_TAC;
14330 USE 4(REWRITE_RULE[SUBSET]);
14331 TYPE_THEN `~(squ (left m) = EMPTY)` SUBGOAL_TAC;
14332 ASM_MESON_TAC[cell_nonempty;cell_rules];
14333 REWRITE_TAC[EMPTY_EXISTS];
14338 TYPE_THEN `topology_ (ctop G)` SUBGOAL_TAC;
14339 ASM_MESON_TAC[ctop_top];
14340 ASM_SIMP_TAC [component_empty];
14342 TYPE_THEN `component (ctop G') x' = IMAGE (reflAf (&:0)) (component (ctop G) x)` SUBGOAL_TAC;
14343 ASM_MESON_TAC[component_reflA;];
14346 TYPE_THEN `?p'. e' SUBSET closure top2 (squ p') /\ squ p' SUBSET component (ctop G') x'` SUBGOAL_TAC;
14347 IMATCH_MP_TAC along_lemma6;
14348 TYPE_THEN `reflAi (&:0) m` EXISTS_TAC;
14352 IMATCH_MP_TAC reflA_segment;
14359 USE 4(MATCH_MP (ISPEC `reflAf (&:0)` IMAGE_SUBSET ));
14360 TYPE_THEN `squ(reflAi (&:0) m) = IMAGE (reflAf (&:0)) (squ (left m))` SUBGOAL_TAC;
14361 REWRITE_TAC[reflA_squ];
14363 REWRITE_TAC[reflAi;left ;PAIR_SPLIT; ];
14368 REWRITE_TAC[GSYM reflA_v_edge];
14370 REWRITE_TAC[IMAGE2];
14373 MESON_TAC[image_imp];
14378 REWRITE_TAC[IMAGE2];
14379 ASM_MESON_TAC[image_imp];
14381 TYPE_THEN `closure top2 (IMAGE (reflAf (&:0)) e) = IMAGE (reflAf (&:0)) (closure top2 e)` SUBGOAL_TAC;
14382 IMATCH_MP_TAC (GSYM homeo_closure);
14383 ASM_REWRITE_TAC[top2_top;reflA_homeo;top2_unions;];
14384 TYPE_THEN `edge e ` SUBGOAL_TAC;
14385 ASM_MESON_TAC[segment;ISUBSET];
14386 MESON_TAC[ISUBSET;edge_euclid2;];
14387 DISCH_THEN_REWRITE;
14388 REWRITE_TAC[GSYM reflA_pointI];
14389 IMATCH_MP_TAC image_imp;
14393 TYPE_THEN `p = left (reflAi (&:0) p')` ABBREV_TAC ;
14394 TYPE_THEN `squ p' = IMAGE (reflAf (&:0) ) (squ p)` SUBGOAL_TAC;
14395 ASM_REWRITE_TAC[reflA_squ;];
14398 REWRITE_TAC[left ;reflAi;PAIR_SPLIT;];
14401 TYPE_THEN `p` EXISTS_TAC;
14403 ASSUME_TAC top2_top;
14404 TYPE_THEN `homeomorphism (reflAf (&:0)) top2 top2` SUBGOAL_TAC;
14405 ASM_MESON_TAC[reflA_homeo];
14407 ASSUME_TAC top2_unions;
14408 TYPE_THEN `squ p SUBSET (UNIONS (top2))` SUBGOAL_TAC;
14409 MESON_TAC[squ_euclid;top2_unions];
14411 CONJ_TAC; (* split *)
14415 TYPE_THEN `closure top2 (IMAGE (reflAf (&:0)) (squ p)) = IMAGE (reflAf (&:0)) (closure top2 (squ p))` SUBGOAL_TAC;
14416 IMATCH_MP_TAC (GSYM homeo_closure);
14418 DISCH_THEN_REWRITE;
14421 IMATCH_MP_TAC (ISPEC `reflAf (&:0)` image_inj);
14422 TYPE_THEN `euclid 2` EXISTS_TAC;
14425 IMATCH_MP_TAC INJ_UNIV;
14426 TYPE_THEN `(euclid 2)` EXISTS_TAC;
14427 REWRITE_TAC [REWRITE_RULE[homeomorphism;BIJ;top2_unions] reflA_homeo;];
14429 TYPE_THEN `edge e ` SUBGOAL_TAC;
14430 ASM_MESON_TAC[segment;ISUBSET];
14431 MESON_TAC[ISUBSET;edge_euclid2;];
14432 IMATCH_MP_TAC closure_euclid;
14433 REWRITE_TAC[squ_euclid];
14435 IMATCH_MP_TAC (ISPEC `reflAf (&:0)` image_inj);
14436 TYPE_THEN `euclid 2` EXISTS_TAC;
14439 IMATCH_MP_TAC INJ_UNIV;
14440 TYPE_THEN `(euclid 2)` EXISTS_TAC;
14441 REWRITE_TAC [REWRITE_RULE[homeomorphism;BIJ;top2_unions] reflA_homeo;];
14443 REWRITE_TAC[squ_euclid];
14445 IMATCH_MP_TAC SUBSET_TRANS;
14446 TYPE_THEN `UNIONS (ctop G)` EXISTS_TAC;
14447 ASM_REWRITE_TAC[component_unions;ctop_unions];
14448 REWRITE_TAC[DIFF;SUBSET];
14454 let v_edge_cases = prove_by_refinement(
14455 `!j m. closure top2 (v_edge j) (pointI m) ==> (j = m) \/ (j = down m)`,
14458 REWRITE_TAC[v_edge_closure;vc_edge];
14460 RULE_ASSUM_TAC (REWRITE_RULE[UNION;cell_clauses;INR IN_SING;plus_e12]);
14461 FIRST_ASSUM DISJ_CASES_TAC;
14464 ASM_REWRITE_TAC[down;PAIR_SPLIT;];
14469 let squ_squc = prove_by_refinement(
14470 `!r n m. (IMAGE (reflBf r) (squ n) = squ m) ==>
14471 (IMAGE (reflBf r) (squc n) = squc m)`,
14475 REWRITE_TAC[GSYM squ_closure];
14476 TYPE_THEN `IMAGE (reflBf r) (closure top2 (squ n)) = closure top2 (IMAGE (reflBf r) (squ n))` SUBGOAL_TAC;
14477 IMATCH_MP_TAC homeo_closure;
14478 ASM_REWRITE_TAC[top2_top;top2_unions;reflB_homeo;squ_euclid;];
14479 DISCH_THEN_REWRITE;
14484 let squ_squc_C = prove_by_refinement(
14485 `!n m. (IMAGE (reflCf) (squ n) = squ m) ==>
14486 (IMAGE (reflCf) (squc n) = squc m)`,
14490 REWRITE_TAC[GSYM squ_closure];
14491 TYPE_THEN `IMAGE (reflCf) (closure top2 (squ n)) = closure top2 (IMAGE (reflCf) (squ n))` SUBGOAL_TAC;
14492 IMATCH_MP_TAC homeo_closure;
14493 ASM_REWRITE_TAC[top2_top;top2_unions;reflC_homeo;squ_euclid;];
14494 DISCH_THEN_REWRITE;
14499 let along_lemma8 = prove_by_refinement(
14500 `!G m n j x e. (segment G /\ (squ n SUBSET component (ctop G) x) /\
14501 (v_edge j SUBSET squc n) /\ (closure top2 (v_edge j) (pointI m)) /\
14502 (G (v_edge j)) /\ G e /\ (closure top2 e (pointI m)) ==>
14503 (?p. e SUBSET closure top2 (squ p) /\
14504 (squ p SUBSET (component (ctop G) x))))`,
14508 USE_FIRST (MATCH_MP v_edge_cases);
14509 FIRST_ASSUM (DISJ_CASES_TAC);
14510 IMATCH_MP_TAC along_lemma7;
14516 (* INSERT lemmas here *)
14517 TYPE_THEN `e' = IMAGE (reflBf (&:0)) e ` ABBREV_TAC ;
14518 TYPE_THEN `G' = IMAGE2 (reflBf (&:0)) G` ABBREV_TAC ;
14519 TYPE_THEN `x' = reflBf (&:0) x` ABBREV_TAC ;
14520 TYPE_THEN `UNIONS (ctop G) x` SUBGOAL_TAC;
14521 TYPE_THEN `~(component (ctop G) x = EMPTY)` SUBGOAL_TAC;
14522 USE 5(REWRITE_RULE[SUBSET]);
14523 TYPE_THEN `~(squ (n) = EMPTY)` SUBGOAL_TAC;
14524 ASM_MESON_TAC[cell_nonempty;cell_rules];
14525 REWRITE_TAC[EMPTY_EXISTS];
14528 TYPE_THEN `topology_ (ctop G)` SUBGOAL_TAC;
14529 ASM_MESON_TAC[ctop_top];
14530 ASM_SIMP_TAC [component_empty];
14532 TYPE_THEN `component (ctop G') x' = IMAGE (reflBf (&:0)) (component (ctop G) x)` SUBGOAL_TAC;
14533 ASM_MESON_TAC[component_reflB;];
14536 TYPE_THEN `?p'. e' SUBSET closure top2 (squ p') /\ squ p' SUBSET component (ctop G') x'` SUBGOAL_TAC;
14537 IMATCH_MP_TAC along_lemma7;
14538 TYPE_THEN `(reflBi (&:0)) m` EXISTS_TAC;
14539 TYPE_THEN `down (reflBi (&:0) n)` EXISTS_TAC;
14543 IMATCH_MP_TAC reflB_segment;
14548 ASM_REWRITE_TAC[GSYM reflB_squ];
14550 IMATCH_MP_TAC (ISPEC `reflBf (&:0)` IMAGE_SUBSET );
14553 TYPE_THEN `squc (down (reflBi (&:0) n)) = IMAGE (reflBf (&:0)) (squc n)` SUBGOAL_TAC;
14554 IMATCH_MP_TAC (GSYM squ_squc);
14555 REWRITE_TAC[reflB_squ];
14556 DISCH_THEN_REWRITE; (* end *)
14557 TYPE_THEN `v_edge (reflBi (&:0) m) = IMAGE (reflBf (&:0)) (v_edge (down m))` SUBGOAL_TAC;
14558 REWRITE_TAC[reflB_v_edge];
14560 REWRITE_TAC[reflBi;down;PAIR_SPLIT ];
14562 DISCH_THEN_REWRITE;
14564 IMATCH_MP_TAC IMAGE_SUBSET;
14569 REWRITE_TAC[IMAGE2];
14572 MESON_TAC[image_imp];
14577 REWRITE_TAC[IMAGE2];
14578 ASM_MESON_TAC[image_imp];
14581 TYPE_THEN `closure top2 (IMAGE (reflBf (&:0)) e) = IMAGE (reflBf (&:0)) (closure top2 e)` SUBGOAL_TAC;
14582 IMATCH_MP_TAC (GSYM homeo_closure);
14583 ASM_REWRITE_TAC[top2_top;reflB_homeo;top2_unions;];
14584 TYPE_THEN `edge e ` SUBGOAL_TAC;
14585 ASM_MESON_TAC[segment;ISUBSET];
14586 MESON_TAC[ISUBSET;edge_euclid2;];
14587 DISCH_THEN_REWRITE;
14588 REWRITE_TAC[GSYM reflB_pointI];
14589 IMATCH_MP_TAC image_imp;
14593 TYPE_THEN `p = down (reflBi (&:0) p')` ABBREV_TAC ;
14594 TYPE_THEN `squ p' = IMAGE (reflBf (&:0) ) (squ p)` SUBGOAL_TAC;
14595 ASM_REWRITE_TAC[reflB_squ;];
14598 REWRITE_TAC[down ;reflBi;PAIR_SPLIT;];
14601 TYPE_THEN `p` EXISTS_TAC;
14603 ASSUME_TAC top2_top;
14604 TYPE_THEN `homeomorphism (reflBf (&:0)) top2 top2` SUBGOAL_TAC;
14605 ASM_MESON_TAC[reflB_homeo];
14607 ASSUME_TAC top2_unions;
14608 TYPE_THEN `squ p SUBSET (UNIONS (top2))` SUBGOAL_TAC;
14609 MESON_TAC[squ_euclid;top2_unions];
14611 CONJ_TAC; (* split *)
14615 TYPE_THEN `closure top2 (IMAGE (reflBf (&:0)) (squ p)) = IMAGE (reflBf (&:0)) (closure top2 (squ p))` SUBGOAL_TAC;
14616 IMATCH_MP_TAC (GSYM homeo_closure);
14618 DISCH_THEN_REWRITE;
14621 IMATCH_MP_TAC (ISPEC `reflBf (&:0)` image_inj);
14622 TYPE_THEN `euclid 2` EXISTS_TAC;
14625 IMATCH_MP_TAC INJ_UNIV;
14626 TYPE_THEN `(euclid 2)` EXISTS_TAC;
14627 REWRITE_TAC [REWRITE_RULE[homeomorphism;BIJ;top2_unions] reflB_homeo;];
14629 TYPE_THEN `edge e ` SUBGOAL_TAC;
14630 ASM_MESON_TAC[segment;ISUBSET];
14631 MESON_TAC[ISUBSET;edge_euclid2;];
14632 IMATCH_MP_TAC closure_euclid;
14633 REWRITE_TAC[squ_euclid];
14635 IMATCH_MP_TAC (ISPEC `reflBf (&:0)` image_inj);
14636 TYPE_THEN `euclid 2` EXISTS_TAC;
14639 IMATCH_MP_TAC INJ_UNIV;
14640 TYPE_THEN `(euclid 2)` EXISTS_TAC;
14641 REWRITE_TAC [REWRITE_RULE[homeomorphism;BIJ;top2_unions] reflB_homeo;];
14643 REWRITE_TAC[squ_euclid];
14645 IMATCH_MP_TAC SUBSET_TRANS;
14646 TYPE_THEN `UNIONS (ctop G)` EXISTS_TAC;
14647 ASM_REWRITE_TAC[component_unions;ctop_unions];
14648 REWRITE_TAC[DIFF;SUBSET];
14654 let along_lemma9 = prove_by_refinement(
14655 `!G m n e' x e. (segment G /\ (squ n SUBSET component (ctop G) x) /\
14656 (e' SUBSET squc n) /\ (closure top2 e' (pointI m)) /\ (edge e') /\
14657 (G e') /\ G e /\ (closure top2 e (pointI m)) ==>
14658 (?p. e SUBSET closure top2 (squ p) /\
14659 (squ p SUBSET (component (ctop G) x))))`,
14663 RULE_ASSUM_TAC (REWRITE_RULE[edge]);
14665 FIRST_ASSUM (DISJ_CASES_TAC);
14666 IMATCH_MP_TAC along_lemma8;
14668 TYPE_THEN `edge e` SUBGOAL_TAC;
14669 ASM_MESON_TAC[segment;ISUBSET];
14677 (* INSERT lemmas here *)
14678 TYPE_THEN `e' = IMAGE (reflCf) e ` ABBREV_TAC ;
14679 TYPE_THEN `G' = IMAGE2 (reflCf) G` ABBREV_TAC ;
14680 TYPE_THEN `x' = reflCf x` ABBREV_TAC ;
14681 TYPE_THEN `UNIONS (ctop G) x` SUBGOAL_TAC;
14682 TYPE_THEN `~(component (ctop G) x = EMPTY)` SUBGOAL_TAC;
14683 USE 6(REWRITE_RULE[SUBSET]);
14684 TYPE_THEN `~(squ (n) = EMPTY)` SUBGOAL_TAC;
14685 ASM_MESON_TAC[cell_nonempty;cell_rules];
14686 REWRITE_TAC[EMPTY_EXISTS];
14689 TYPE_THEN `topology_ (ctop G)` SUBGOAL_TAC;
14690 ASM_MESON_TAC[ctop_top];
14691 ASM_SIMP_TAC [component_empty];
14693 TYPE_THEN `component (ctop G') x' = IMAGE (reflCf) (component (ctop G) x)` SUBGOAL_TAC;
14694 ASM_MESON_TAC[component_reflC;];
14697 TYPE_THEN `?p'. e' SUBSET closure top2 (squ p') /\ squ p' SUBSET component (ctop G') x'` SUBGOAL_TAC;
14698 IMATCH_MP_TAC along_lemma8;
14699 TYPE_THEN `(reflCi) m` EXISTS_TAC;
14700 TYPE_THEN `(reflCi n)` EXISTS_TAC;
14701 TYPE_THEN `reflCi m'` EXISTS_TAC;
14705 IMATCH_MP_TAC reflC_segment;
14710 ASM_REWRITE_TAC[GSYM reflC_squ];
14712 IMATCH_MP_TAC (ISPEC `reflCf` IMAGE_SUBSET );
14715 TYPE_THEN `squc ( (reflCi n)) = IMAGE (reflCf) (squc n)` SUBGOAL_TAC;
14716 IMATCH_MP_TAC (GSYM squ_squc_C);
14717 REWRITE_TAC[reflC_squ];
14718 DISCH_THEN_REWRITE; (* end *)
14719 TYPE_THEN `v_edge (reflCi m') = IMAGE (reflCf ) (h_edge ( m'))` SUBGOAL_TAC;
14720 REWRITE_TAC[reflC_hv_edge];
14721 DISCH_THEN_REWRITE;
14723 IMATCH_MP_TAC IMAGE_SUBSET;
14727 TYPE_THEN `!e. (edge e) ==> (closure top2 (IMAGE (reflCf ) e) = IMAGE (reflCf) (closure top2 e))` SUBGOAL_TAC;
14729 IMATCH_MP_TAC (GSYM homeo_closure);
14730 ASM_REWRITE_TAC[top2_top;reflC_homeo;top2_unions;];
14731 IMATCH_MP_TAC edge_euclid2;
14734 TYPE_THEN `edge (h_edge m')` SUBGOAL_TAC;
14735 ASM_MESON_TAC[edge];
14738 REWRITE_TAC[GSYM reflC_pointI];
14740 ASM_MESON_TAC[image_imp];
14744 REWRITE_TAC[IMAGE2];
14747 MESON_TAC[image_imp];
14752 REWRITE_TAC[IMAGE2];
14753 ASM_MESON_TAC[image_imp];
14757 IMATCH_MP_TAC image_imp;
14761 TYPE_THEN `p = reflCi p'` ABBREV_TAC ;
14762 TYPE_THEN `squ p' = IMAGE (reflCf ) (squ p)` SUBGOAL_TAC;
14763 ASM_REWRITE_TAC[reflC_squ;];
14766 REWRITE_TAC[reflCi_inv;PAIR_SPLIT;];
14768 TYPE_THEN `p` EXISTS_TAC;
14770 ASSUME_TAC top2_top;
14771 TYPE_THEN `homeomorphism (reflCf) top2 top2` SUBGOAL_TAC;
14772 ASM_MESON_TAC[reflC_homeo];
14774 ASSUME_TAC top2_unions;
14775 TYPE_THEN `squ p SUBSET (UNIONS (top2))` SUBGOAL_TAC;
14776 MESON_TAC[squ_euclid;top2_unions];
14778 TYPE_THEN `closure top2 (IMAGE (reflCf) (squ p)) = IMAGE (reflCf) (closure top2 (squ p))` SUBGOAL_TAC;
14779 IMATCH_MP_TAC (GSYM homeo_closure);
14782 CONJ_TAC; (* split *)
14783 IMATCH_MP_TAC (ISPEC `reflCf` image_inj);
14784 TYPE_THEN `euclid 2` EXISTS_TAC;
14787 IMATCH_MP_TAC INJ_UNIV;
14788 TYPE_THEN `(euclid 2)` EXISTS_TAC;
14789 REWRITE_TAC [REWRITE_RULE[homeomorphism;BIJ;top2_unions] reflC_homeo;];
14791 ASM_MESON_TAC[edge_euclid2];
14793 IMATCH_MP_TAC closure_euclid;
14794 REWRITE_TAC[squ_euclid];
14796 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
14797 REWRITE_TAC[reflC_squ];
14798 TYPE_THEN `reflCi p = p'` SUBGOAL_TAC;
14800 REWRITE_TAC[reflCi_inv];
14801 DISCH_THEN_REWRITE;
14807 IMATCH_MP_TAC (ISPEC `reflCf` image_inj);
14808 TYPE_THEN `euclid 2` EXISTS_TAC;
14811 IMATCH_MP_TAC INJ_UNIV;
14812 TYPE_THEN `(euclid 2)` EXISTS_TAC;
14813 REWRITE_TAC [REWRITE_RULE[homeomorphism;BIJ;top2_unions] reflC_homeo;];
14815 REWRITE_TAC[squ_euclid];
14816 IMATCH_MP_TAC SUBSET_TRANS;
14817 TYPE_THEN `UNIONS (ctop G)` EXISTS_TAC;
14818 ASM_REWRITE_TAC[component_unions;ctop_unions];
14819 REWRITE_TAC[DIFF;SUBSET];
14824 let along_lemma10 = prove_by_refinement(
14825 `!G x. (segment G /\ ~(component (ctop G) x = EMPTY) ) ==>
14827 { e | (G e /\ (?p. (e SUBSET squc p) /\
14828 (squ p SUBSET component (ctop G) x)) ) } `,
14832 TYPE_THEN `S = { e | (G e /\ (?p. (e SUBSET squc p) /\ (squ p SUBSET component (ctop G) x)) ) } ` ABBREV_TAC ;
14833 REWRITE_TAC[inductive_set];
14836 REWRITE_TAC[SUBSET];
14839 TYPE_THEN `(?m. squ m SUBSET (component (ctop G) x))` SUBGOAL_TAC;
14840 IMATCH_MP_TAC comp_squ;
14843 TYPE_THEN `(?p e. G e /\ e SUBSET closure top2 (squ p) /\ squ p SUBSET component (ctop G) x)` SUBGOAL_TAC;
14844 IMATCH_MP_TAC comp_squ_adj;
14848 REWRITE_TAC[EMPTY_EXISTS ];
14851 REWRITE_TAC [squ_closure];
14852 TYPE_THEN `e` EXISTS_TAC;
14854 TYPE_THEN `p` EXISTS_TAC;
14855 ASM_REWRITE_TAC[GSYM squ_closure];
14862 TYPE_THEN `edge C /\ edge C'` SUBGOAL_TAC;
14863 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
14865 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET]);
14868 TYPE_THEN `(?m. closure top2 C INTER closure top2 C' = {(pointI m)})` SUBGOAL_TAC;
14869 IMATCH_MP_TAC edge_inter;
14872 REWRITE_TAC[GSYM squ_closure];
14873 IMATCH_MP_TAC along_lemma9;
14874 RULE_ASSUM_TAC (REWRITE_RULE[INTER;eq_sing;]);
14875 TYPE_THEN `m` EXISTS_TAC;
14876 TYPE_THEN `p` EXISTS_TAC;
14877 TYPE_THEN `C` EXISTS_TAC;
14882 let along_lemma11 = prove_by_refinement(
14883 `!G x e . (segment G /\ ~(component (ctop G) x = EMPTY) /\
14885 (?p. (e SUBSET squc p) /\ (squ p SUBSET component (ctop G) x))`,
14889 TYPE_THEN `S = {e | (G e /\ (?p. (e SUBSET squc p) /\ (squ p SUBSET component (ctop G) x)) ) }` ABBREV_TAC ;
14890 TYPE_THEN ` S = G` SUBGOAL_TAC;
14893 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
14895 FIRST_ASSUM IMATCH_MP_TAC ;
14896 TYPE_THEN `inductive_set G S` SUBGOAL_TAC;
14898 IMATCH_MP_TAC along_lemma10;
14900 ASM_REWRITE_TAC[inductive_set];
14904 PROOF_BY_CONTR_TAC;
14907 ONCE_ASM_REWRITE_TAC[];
14915 is essentially the proof that there are only two connected
14916 components (because there are only two possible instantiations of p
14917 Come back and finish the proof of the Jordan curve. *)
14920 (* ------------------------------------------------------------------ *)
14922 (* ------------------------------------------------------------------ *)
14924 (* ALL about graphs *)
14926 (*** JRH systematically changed (Y,X)graph to (X,Y)graph for all X and Y,
14927 and made corresponding changes to other type annotations.
14928 The core now alphabetically sorts the type variables in a definition.
14931 let (mk_graph_t,dest_graph_t) = abbrev_type
14932 `:(A->bool)#(B->bool)#(B->(A->bool))` "graph_t";;
14934 let graph_vertex = jordan_def
14935 `graph_vertex (G:(A,B)graph_t) = FST (dest_graph_t G)`;;
14937 let graph_edge = jordan_def
14938 `graph_edge (G:(A,B)graph_t) = part1 (dest_graph_t G)`;;
14940 let graph_inc = jordan_def
14941 `graph_inc (G:(A,B)graph_t) = drop1 (dest_graph_t G)`;;
14943 let graph = jordan_def `graph (G:(A,B)graph_t) <=>
14944 (IMAGE (graph_inc G) (graph_edge G)) SUBSET
14945 { s | (s SUBSET (graph_vertex G)) /\ (s HAS_SIZE 2) }`;;
14947 let graph_incident = jordan_def `graph_incident
14948 (G:(A,B)graph_t) e x <=>
14949 (graph_edge G e) /\ (graph_inc G e x)`;;
14951 let graph_iso = jordan_def
14952 `graph_iso f (G:(A,B)graph_t) (H:(A',B')graph_t) <=>
14953 (?u v. (f = (u,v)) /\ (BIJ u (graph_vertex G) (graph_vertex H)) /\
14954 (BIJ v (graph_edge G) (graph_edge H)) /\
14955 (!e. (graph_edge G e) ==>
14956 (graph_inc H (v e) = IMAGE u (graph_inc G e))))`;;
14958 (* specify a graph by
14959 { {a,b}, .... } of endpoints of edges. *)
14961 let mk_simple_graph = jordan_def `mk_simple_graph (E:(A->bool)->bool) =
14963 (UNIONS E, (E:(A->bool)->bool),
14964 (\ (x:A->bool) (y:A). (x y)))`;;
14966 let K33 = jordan_def `K33 = mk_simple_graph
14967 { {1,10}, {2,10}, {3,10},
14968 {1,20}, {2,20}, {3,20},
14969 {1,30}, {2,30}, {3,30} }`;;
14971 let graph_del = jordan_def `graph_del (G:(A,B)graph_t) V E =
14973 ((graph_vertex G DIFF V),
14975 (E UNION { (e:B) | ?(v:A). (V v /\ graph_incident G e v ) })),
14978 let graph_path = jordan_def `graph_path (G:(A,B)graph_t) f n <=>
14979 (?v e . (f = (v,e)) /\ (INJ v { m | m <=| n } (graph_vertex G)) /\
14980 (INJ e { m | m <| n } (graph_edge G)) /\
14982 (graph_inc G (e i) = {(v i), (v (SUC i))})))`;;
14984 let graph_cycle = jordan_def `graph_cycle (G:(A,B)graph_t) f n <=>
14985 (?v e . (f = (v,e)) /\ (INJ v { m | m <| n } (graph_vertex G)) /\
14986 (INJ e { m | m <| n } (graph_edge G)) /\
14988 (graph_inc G (e i) = {(v i), (v ((SUC i) %| (n)))})))`;;
14990 let graph_connected = jordan_def `graph_connected (G:(A,B)graph_t) <=>
14991 !v v'. (graph_vertex G v) /\ (graph_vertex G v') /\ ~(v = v') ==>
14992 (?f n. (graph_path G f n) /\ (FST f 0 = v) /\ (FST f n = v'))`;;
14994 let graph_2_connected = jordan_def `graph_2_connected (G:(A,B)graph_t) <=>
14995 (graph_connected G) /\
14996 (!v. (graph_vertex G v) ==> (graph_connected
14997 (graph_del G {v} EMPTY)))`;;
14999 let simple_arc = jordan_def `simple_arc (U:(A->bool)->bool) C <=>
15000 (?f. (C = IMAGE f { x | &.0 <= x /\ x <= &.1}) /\
15001 (continuous f (top_of_metric(UNIV,d_real)) U) /\
15002 (INJ f { x | &.0 <= x /\ x <= &.1} (UNIONS U)))`;;
15004 let simple_closed_curve = jordan_def
15005 `simple_closed_curve (U:(A->bool)->bool) C <=>
15006 (?f. (C = IMAGE f { x | &.0 <= x /\ x <= &.1}) /\
15007 (continuous f (top_of_metric(UNIV,d_real)) U) /\
15008 (INJ f { x | &.0 <= x /\ x < &.1} (UNIONS U)) /\
15009 (f (&.0) = f (&.1)))`;;
15011 let simple_polygonal_arc = jordan_def
15012 `simple_polygonal_arc PE C <=>
15013 (simple_arc (top_of_metric(euclid 2,d_euclid)) C) /\
15014 (?E. (C SUBSET UNIONS E) /\ (FINITE E) /\ (PE E))`;;
15016 let simple_polygonal_curve = jordan_def
15017 `simple_polygonal_curve PE C <=>
15018 (simple_closed_curve (top_of_metric(euclid 2,d_euclid)) C) /\
15019 (?E. (C SUBSET UNIONS E) /\ (FINITE E) /\ (PE E))`;;
15021 let hv_line = jordan_def
15022 `hv_line E <=> (!e. (E e) ==> (?x y. (e = mk_line (point x) (point y)) /\
15023 ((FST x = FST y) \/ (SND x = SND y))))`;;
15025 let p_conn = jordan_def
15026 `p_conn A x y <=> (?C. (simple_polygonal_arc hv_line C) /\
15027 (C SUBSET A) /\ (C x) /\ (C y))`;;
15029 let subf = jordan_def
15030 `subf A (f:A->B) g x = if (A x) then (f x) else (g x)`;;
15032 let min_real_le = prove_by_refinement(
15033 `!x y. (min_real x y <= x) /\ (min_real x y <= y)`,
15037 REWRITE_TAC[min_real];
15046 let subf_lemma = prove_by_refinement(
15048 (metric_space (X,dX)) /\ (closed_ (top_of_metric(X,dX)) B) /\
15049 (~(B x)) /\ (X x) ==>
15050 (?delta. (&0 < delta) /\ (!y. (dX x y < delta) ==> (~(B y))))`,
15054 REWRITE_TAC[closed;open_DEF ];
15058 ASM_SIMP_TAC[GSYM top_of_metric_unions];
15060 TYPE_THEN `(X DIFF B) x` SUBGOAL_TAC;
15064 TYPEL_THEN [`X`;`dX`;`(X DIFF B)`;`x`] (fun t-> ASSUME_TAC (ISPECL t open_ball_nbd)); (* // *)
15067 TYPE_THEN `e` EXISTS_TAC;
15069 REWRITE_TAC[open_ball;SUBSET;DIFF;];
15073 ASM_MESON_TAC[ISUBSET ;];
15078 let subf_cont = prove_by_refinement(
15079 `!X dX Y dY A B (f:A->B) g.
15080 ((metric_space (X,dX)) /\ (metric_space (Y,dY)) /\
15081 (closed_ (top_of_metric(X,dX)) A ) /\
15082 (closed_ (top_of_metric(X,dX)) B ) /\
15083 (metric_continuous f (A,dX) (Y,dY)) /\
15084 (metric_continuous g (B,dX) (Y,dY)) /\
15085 (!x. (A x /\ B x) ==> (f x = g x))) ==>
15086 (metric_continuous (subf A f g) (A UNION B,dX) (Y,dY))`,
15089 REWRITE_TAC[metric_continuous;metric_continuous_pt];
15094 REWRITE_TAC[UNION];
15095 TYPE_THEN `(A x \/ ~(A x)) /\ (B x \/ (~(B x)))` (fun t-> MP_TAC (TAUT t ));
15096 DISCH_THEN (fun t -> MP_TAC (REWRITE_RULE[GSYM DISJ_ASSOC;RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR] t));
15098 TYPEL_THEN [`x`;`epsilon`] (USE 4 o ISPECL);
15099 TYPEL_THEN [`x`;`epsilon`] (USE 5 o ISPECL);
15103 TYPE_THEN `min_real delta delta'` EXISTS_TAC;
15105 REWRITE_TAC[min_real];
15110 TYPE_THEN `A y \/ (~(A y) /\ B y)` SUBGOAL_TAC;
15113 DISCH_THEN DISJ_CASES_TAC;
15117 DISCH_THEN IMATCH_MP_TAC ;
15120 (* save_goal "ss" *)
15121 TYPE_THEN `min_real delta delta' <= delta'` SUBGOAL_TAC;
15122 REWRITE_TAC[min_real_le];
15127 TYPE_THEN `f x = g x` SUBGOAL_TAC;
15129 DISCH_THEN_REWRITE;
15131 DISCH_THEN IMATCH_MP_TAC ;
15134 TYPE_THEN `min_real delta delta' <= delta` SUBGOAL_TAC;
15135 REWRITE_TAC[min_real_le];
15138 TYPE_THEN `X x` SUBGOAL_TAC;
15140 REWRITE_TAC[closed;open_DEF;SUBSET ;];
15146 SIMP_TAC[GSYM top_of_metric_unions];
15148 TYPE_THEN `(?delta. (&0 < delta) /\ (!y. (dX x y < delta) ==> (~(B y))))` SUBGOAL_TAC;
15149 IMATCH_MP_TAC subf_lemma;
15150 TYPE_THEN `X` EXISTS_TAC;
15153 TYPEL_THEN [`x`;`epsilon`] (USE 4 o ISPECL);
15156 TYPE_THEN `min_real delta delta'` EXISTS_TAC;
15158 REWRITE_TAC[min_real];
15163 TYPE_THEN `A y` SUBGOAL_TAC;
15164 TYPE_THEN `~(B y) ==> A y` SUBGOAL_TAC;
15166 DISCH_THEN IMATCH_MP_TAC ;
15167 FIRST_ASSUM IMATCH_MP_TAC ;
15169 TYPE_THEN `min_real delta delta' <= delta` SUBGOAL_TAC;
15170 REWRITE_TAC[min_real_le];
15175 FIRST_ASSUM IMATCH_MP_TAC ;
15178 TYPE_THEN `min_real delta delta' <= delta'` SUBGOAL_TAC;
15179 REWRITE_TAC[min_real_le];
15182 TYPE_THEN `X x` SUBGOAL_TAC;
15184 REWRITE_TAC[closed;open_DEF;SUBSET ;];
15190 SIMP_TAC[GSYM top_of_metric_unions];
15192 TYPE_THEN `(?delta. (&0 < delta) /\ (!y. (dX x y < delta) ==> (~(A y))))` SUBGOAL_TAC;
15193 IMATCH_MP_TAC subf_lemma;
15194 TYPE_THEN `X` EXISTS_TAC;
15197 TYPEL_THEN [`x`;`epsilon`] (USE 5 o ISPECL);
15200 TYPE_THEN `min_real delta delta'` EXISTS_TAC;
15202 REWRITE_TAC[min_real];
15207 TYPE_THEN `~(A y)` SUBGOAL_TAC;
15208 FIRST_ASSUM IMATCH_MP_TAC ;
15210 TYPE_THEN `min_real delta delta' <= delta` SUBGOAL_TAC;
15211 REWRITE_TAC[min_real_le];
15216 FIRST_ASSUM IMATCH_MP_TAC ;
15217 TYPE_THEN `B y` SUBGOAL_TAC;
15219 DISCH_THEN_REWRITE;
15221 TYPE_THEN `min_real delta delta' <= delta'` SUBGOAL_TAC;
15222 REWRITE_TAC[min_real_le];
15225 TYPE_THEN `&1` EXISTS_TAC;
15226 ASM_MESON_TAC [REAL_ARITH `&0 < &1`];
15230 let p_conn_subset = prove_by_refinement(
15231 `!A B x y. (A SUBSET B) /\ (p_conn A x y) ==> (p_conn B x y)`,
15234 REWRITE_TAC[p_conn];
15236 TYPE_THEN `C` EXISTS_TAC;
15238 ASM_MESON_TAC[ISUBSET];
15242 let mk_line_symm = prove_by_refinement(
15243 `!x y. mk_line x y = mk_line y x`,
15246 REWRITE_TAC[mk_line];
15248 IMATCH_MP_TAC EQ_EXT;
15253 TYPE_THEN `(&1 - t)` EXISTS_TAC;
15254 ONCE_REWRITE_TAC [euclid_add_comm];
15255 ASM_REWRITE_TAC[REAL_ARITH `(&1 - (&1 - t)) = t`];
15257 TYPE_THEN `(&1 - t)` EXISTS_TAC;
15258 ONCE_REWRITE_TAC [euclid_add_comm];
15259 ASM_REWRITE_TAC[REAL_ARITH `(&1 - (&1 - t)) = t`];
15263 let mk_line_sub = prove_by_refinement(
15264 `!x y z. ( ~(x = z) /\ (mk_line x y z)) ==>
15265 (mk_line x y = mk_line x z)`,
15268 REWRITE_TAC[mk_line];
15270 IMATCH_MP_TAC EQ_EXT;
15275 TYPE_THEN `~(t = &1)` SUBGOAL_TAC;
15280 REWRITE_TAC[euclid_scale0;euclid_scale_one;euclid_rzero];
15283 TYPE_THEN `s = (&1 /(&1 - t))` ABBREV_TAC;
15284 TYPE_THEN `(t' - t)*s` EXISTS_TAC;
15285 ASM_REWRITE_TAC[euclid_ldistrib;GSYM euclid_add_assoc;euclid_scale_act;GSYM euclid_rdistrib;];
15286 TYPE_THEN `(&1 - t) * s = &1` SUBGOAL_TAC;
15288 IMATCH_MP_TAC REAL_DIV_LMUL;
15292 TYPE_THEN `(t' - t) * s + (&1 - (t' - t) * s) * t = (t' - t) *((&1- t)* s) + t ` SUBGOAL_TAC;
15294 DISCH_THEN_REWRITE;
15296 TYPE_THEN `(&1 - (t' - t) * s)*(&1 - t) = (&1 - t) - (t' - t)*(&1-t)*s` SUBGOAL_TAC;
15298 DISCH_THEN_REWRITE;
15300 REWRITE_TAC[REAL_ARITH `((t' - t)* &1 + t = t') /\ (&1 - t - (t' - t)* &1 = (&1 - t'))`];
15304 ASM_REWRITE_TAC[euclid_ldistrib;GSYM euclid_add_assoc;euclid_scale_act;GSYM euclid_rdistrib;];
15305 DISCH_THEN_REWRITE;
15306 TYPE_THEN `t' + (&1 - t')*t` EXISTS_TAC;
15307 TYPE_THEN `(&1 - (t' + (&1 - t') * t)) = ((&1 - t') * (&1 - t))` SUBGOAL_TAC;
15309 DISCH_THEN_REWRITE;
15313 let mk_line_2 = prove_by_refinement(
15314 `!x y p q. (mk_line x y p) /\ (mk_line x y q) /\ (~(p = q)) ==>
15315 (mk_line x y = mk_line p q)`,
15319 TYPE_THEN `x = p` ASM_CASES_TAC ;
15321 IMATCH_MP_TAC mk_line_sub;
15323 ASM_MESON_TAC[mk_line_sub;mk_line_symm];
15327 let mk_line_inter = prove_by_refinement(
15328 `!x y p q. ~(mk_line x y = mk_line p q) ==>
15329 (?z. (mk_line x y INTER mk_line p q) SUBSET {z} )`,
15333 TYPE_THEN `(?z. (mk_line x y INTER mk_line p q) z)` ASM_CASES_TAC;
15335 TYPE_THEN `z` EXISTS_TAC;
15336 REWRITE_TAC[INTER;SUBSET;INR IN_SING;];
15339 REWRITE_TAC[INTER];
15341 ASM_MESON_TAC[mk_line_2];
15342 REWRITE_TAC[SUBSET;INR IN_SING];
15347 let mk_line_fin_inter = prove_by_refinement(
15348 `!E. (FINITE E) /\ (!e. (E e) ==> (?x y. e = mk_line x y)) ==>
15350 (!e f z. (E e) /\ (E f) /\ ~(e = f) /\ e z /\ f z ==> (X z)))`,
15354 TYPE_THEN `E2 = { (e,f) | (E e) /\ (E f) /\ (~(e = f)) }` ABBREV_TAC;
15355 TYPE_THEN `EE = { (e,f) | (E e) /\ (E f) }` ABBREV_TAC;
15357 TYPE_THEN `FINITE EE` SUBGOAL_TAC;
15359 IMATCH_MP_TAC (INR FINITE_PRODUCT);
15363 TYPE_THEN `FINITE E2` SUBGOAL_TAC;
15365 IMATCH_MP_TAC FINITE_SUBSET;
15366 TYPE_THEN `EE` EXISTS_TAC;
15370 REWRITE_TAC[SUBSET;];
15374 TYPE_THEN `E3 = IMAGE (\u. (FST u INTER SND u)) E2` ABBREV_TAC;
15375 TYPE_THEN `FINITE E3` SUBGOAL_TAC;
15377 IMATCH_MP_TAC FINITE_IMAGE;
15381 TYPE_THEN `UNIONS E3` EXISTS_TAC;
15383 ASM_SIMP_TAC[FINITE_FINITE_UNIONS];
15387 REWRITE_TAC[IMAGE];
15388 CONV_TAC (dropq_conv "x");
15391 TYPE_THEN `e` (WITH 0 o ISPEC);
15392 TYPE_THEN `f` (USE 0 o ISPEC);
15399 TYPE_THEN `(?z. (mk_line x y INTER mk_line x' y') SUBSET {z} )` SUBGOAL_TAC;
15400 IMATCH_MP_TAC mk_line_inter;
15403 IMATCH_MP_TAC FINITE_SUBSET;
15404 TYPE_THEN `{z}` EXISTS_TAC;
15405 ASM_REWRITE_TAC[FINITE_SING ];
15409 REWRITE_TAC[IMAGE];
15410 REWRITE_TAC[UNIONS];
15411 CONV_TAC (dropq_conv "x");
15412 CONV_TAC (dropq_conv "u");
15413 REWRITE_TAC[INTER];
15414 TYPE_THEN `e` EXISTS_TAC;
15415 TYPE_THEN `f` EXISTS_TAC;
15420 let euclid_euclid0 = prove_by_refinement(
15421 `!n. (euclid n (euclid0))`,
15424 REWRITE_TAC[euclid0;euclid];
15428 let euclid0_point = prove_by_refinement(
15429 `euclid0 = point(&0,&0)`,
15432 REWRITE_TAC[point_split;euclid_euclid0];
15433 REWRITE_TAC[euclid0];
15437 let EVEN2 = prove_by_refinement(
15438 `EVEN 0 /\ ~(EVEN 1) /\ (EVEN 2) /\ ~(EVEN 3) /\
15439 (EVEN 4) /\ ~(EVEN 5)`,
15442 REWRITE_TAC[EVEN; ARITH_RULE `(1 = SUC 0) /\ (2 = SUC 1) /\ (3 = SUC 2) /\ (4 = SUC 3) /\ (5 = SUC 4)`];
15446 let h_seg_openball = prove_by_refinement(
15447 `!x e e'. (&0 < e) /\ (&0 <= e') /\ (e' < e) /\ (euclid 2 x) ==>
15448 (mk_segment x (x + e' *# e1) SUBSET
15449 (open_ball(euclid 2,d_euclid)) x e)`,
15453 REWRITE_TAC[open_ball;mk_segment;SUBSET;];
15457 REWRITE_TAC[GSYM euclid_add_assoc;euclid_ldistrib;GSYM euclid_rdistrib];
15458 REWRITE_TAC[REAL_ARITH `a + &1 - a = &1`;euclid_scale_one;euclid_scale_act];
15459 TYPE_THEN `x'' = (((&1 - a) * e') *# e1)` ABBREV_TAC ;
15462 TYPE_THEN `euclid 2 x''` SUBGOAL_TAC;
15464 IMATCH_MP_TAC euclid_scale_closure;
15465 REWRITE_TAC[e1;euclid_point];
15469 IMATCH_MP_TAC euclid_add_closure;
15472 TYPE_THEN `!x y. d_euclid x y = d_euclid (x+euclid0) y ` SUBGOAL_TAC;
15473 REWRITE_TAC[euclid_rzero];
15474 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
15476 ASSUME_TAC euclid_euclid0;
15478 TYPE_THEN `d_euclid (euclid_plus x euclid0) (euclid_plus x x'') = d_euclid euclid0 x''` SUBGOAL_TAC;
15479 ASM_MESON_TAC[metric_translate_LEFT];
15480 DISCH_THEN_REWRITE;
15482 REWRITE_TAC[e1;point_scale];
15484 REWRITE_TAC[euclid0_point;d_euclid_point;];
15486 REWRITE_TAC[EXP_2;ARITH_RULE `0 *| 0 = 0`];
15488 REWRITE_TAC[REAL_ARITH `&0 - x = --x`;REAL_POW_NEG;EVEN2];
15489 TYPE_THEN `&0 <= (&1 - a) * e'` SUBGOAL_TAC;
15490 IMATCH_MP_TAC REAL_LE_MUL;
15494 ASM_SIMP_TAC[POW_2_SQRT;];
15496 ASM_CASES_TAC `a = &0`;
15500 TYPE_THEN `(&1 - a) * e' < &1 * e ==> (&1 - a) * e' < e` SUBGOAL_TAC;
15502 DISCH_THEN IMATCH_MP_TAC ;
15503 IMATCH_MP_TAC REAL_LT_MUL2;
15512 let openball_convex = prove_by_refinement(
15513 `!x e n. (convex (open_ball (euclid n,d_euclid) x e))`,
15516 REWRITE_TAC[convex;open_ball;SUBSET;mk_segment;];
15522 IMATCH_MP_TAC (euclid_add_closure);
15523 CONJ_TAC THEN (IMATCH_MP_TAC euclid_scale_closure) THEN (ASM_REWRITE_TAC[]);
15525 TYPE_THEN `d_euclid x x'' = d_euclid (a *# x + (&1 - a) *# x) x''` SUBGOAL_TAC;
15526 REWRITE_TAC[trivial_lin_combo];
15527 DISCH_THEN_REWRITE;
15530 ASM_CASES_TAC `a = &0` ;
15532 DISCH_THEN_REWRITE;
15534 ASM_REWRITE_TAC [euclid_scale0;euclid_scale_one;euclid_lzero;];
15535 TYPE_THEN `(!d. (?u v. (d <= u + v) /\ (u < a*e) /\ (v <= (&1- a)*e)) ==> (d < e))` SUBGOAL_TAC;
15537 TYPE_THEN `u + v < (a*e) + (&1 - a)*e` SUBGOAL_TAC;
15538 IMATCH_MP_TAC REAL_LTE_ADD2;
15540 REWRITE_TAC[GSYM REAL_RDISTRIB;REAL_ARITH `(a + &1 - a = &1) /\ (&1 * C = C )`];
15543 DISCH_THEN IMATCH_MP_TAC ;
15544 TYPE_THEN `z = a *# x' + (&1 - a) *# x` ABBREV_TAC;
15545 TYPE_THEN `d_euclid (a *# x + (&1 - a)*# x) z` EXISTS_TAC;
15546 TYPE_THEN `d_euclid z x''` EXISTS_TAC;
15547 TYPE_THEN `euclid n z` SUBGOAL_TAC;
15549 IMATCH_MP_TAC (euclid_add_closure);
15550 CONJ_TAC THEN (IMATCH_MP_TAC euclid_scale_closure) THEN (ASM_REWRITE_TAC[]);
15554 IMATCH_MP_TAC metric_space_triangle;
15555 TYPE_THEN `euclid n` EXISTS_TAC;
15556 REWRITE_TAC[metric_euclid];
15557 ASM_REWRITE_TAC[trivial_lin_combo];
15560 TYPE_THEN `(d_euclid (euclid_plus (a *# x) ((&1 - a) *# x)) (euclid_plus (a *# x') ((&1 - a) *# x))) = d_euclid (a *# x) (a *# x') ` SUBGOAL_TAC;
15561 IMATCH_MP_TAC metric_translate;
15562 TYPE_THEN `n` EXISTS_TAC;
15563 REPEAT (CONJ_TAC THEN TRY (IMATCH_MP_TAC euclid_scale_closure) THEN ASM_REWRITE_TAC[]);
15564 DISCH_THEN_REWRITE;
15565 TYPE_THEN `d_euclid (a *# x) (a *# x') = abs (a) * d_euclid x x'` SUBGOAL_TAC;
15566 IMATCH_MP_TAC norm_scale_vec;
15568 DISCH_THEN_REWRITE;
15569 TYPE_THEN `abs a = a` SUBGOAL_TAC;
15570 ASM_MESON_TAC[REAL_ABS_REFL];
15571 DISCH_THEN_REWRITE;
15572 IMATCH_MP_TAC REAL_PROP_LT_LMUL;
15580 TYPE_THEN `d_euclid (euclid_plus (a *# x') ((&1 - a) *# x)) (euclid_plus (a *# x') ((&1 - a) *# y)) = d_euclid ((&1 - a) *# x) ((&1 - a) *# y)` SUBGOAL_TAC;
15581 IMATCH_MP_TAC metric_translate_LEFT;
15582 TYPE_THEN `n` EXISTS_TAC;
15583 REPEAT (CONJ_TAC THEN TRY (IMATCH_MP_TAC euclid_scale_closure) THEN ASM_REWRITE_TAC[]);
15584 DISCH_THEN_REWRITE;
15585 TYPE_THEN `!b. d_euclid (b *# x) (b *# y) = abs (b) * d_euclid x y` SUBGOAL_TAC;
15587 IMATCH_MP_TAC norm_scale_vec;
15589 DISCH_THEN_REWRITE;
15590 TYPE_THEN `abs (&1 - a) = (&1 - a)` SUBGOAL_TAC;
15591 REWRITE_TAC [REAL_ABS_REFL];
15594 DISCH_THEN_REWRITE;
15595 IMATCH_MP_TAC REAL_PROP_LE_LMUL;
15605 let openball_mk_segment_end = prove_by_refinement(
15607 (open_ball(euclid n,d_euclid) x e u) /\
15608 (open_ball(euclid n,d_euclid) x e v) ==>
15609 (mk_segment u v SUBSET (open_ball(euclid n,d_euclid) x e))`,
15613 ASSUME_TAC openball_convex;
15614 TYPEL_THEN [`x`;`e`;`n`] (USE 2 o ISPECL);
15615 USE 2 (REWRITE_RULE[convex]);
15616 FIRST_ASSUM IMATCH_MP_TAC ;
15621 let euclid_eq_minus = prove_by_refinement(
15622 `!x y. (x = y) <=> (euclid_minus x y = euclid0)`,
15625 REWRITE_TAC[euclid_minus;euclid0];
15628 DISCH_THEN_REWRITE;
15631 IMATCH_MP_TAC EQ_EXT;
15632 ONCE_REWRITE_TAC [REAL_ARITH `(a = b) <=> (a - b = &0)`];
15634 FIRST_ASSUM (fun t-> MP_TAC (AP_THM t `x':num`));
15640 let euclid_plus_pair = prove_by_refinement(
15641 `!x y u v. (euclid_plus (x + y) (u + v) = (x + u) + (y + v))`,
15644 REWRITE_TAC[euclid_plus];
15646 IMATCH_MP_TAC EQ_EXT;
15652 let euclid_minus_scale = prove_by_refinement(
15653 `!x y. (euclid_minus x y = euclid_plus x ((-- &.1) *# y))`,
15657 REWRITE_TAC[euclid_minus;euclid_plus;euclid_scale];
15658 IMATCH_MP_TAC EQ_EXT;
15664 let euclid_scale_cancel = prove_by_refinement(
15665 `!t x y . (~(t = &0)) /\ (t *# x = t *# y) ==> (x = y)`,
15669 IMATCH_MP_TAC EQ_EXT;
15671 FIRST_ASSUM (fun t -> MP_TAC (AP_THM t `x':num`));
15672 REWRITE_TAC[euclid_scale;];
15673 ASM_MESON_TAC[REAL_MUL_LTIMES];
15677 let mk_segment_inj_image = prove_by_refinement(
15678 `!x y n. (euclid n x) /\ (euclid n y) /\ ~(x = y) ==> (?f.
15680 (top_of_metric(UNIV,d_real))
15681 (top_of_metric (euclid n,d_euclid))) /\
15682 (INJ f {x | &0 <= x /\ x <= &1} (euclid n)) /\
15683 (IMAGE f {t | &.0 <=. t /\ t <=. &.1} = mk_segment x y))`,
15688 TYPE_THEN `(joinf (\u. x) (joinf (\t. euclid_plus (t *# y) ((&1 - t) *# x)) (\u. y) (&.1)) (&.0))` EXISTS_TAC;
15690 IMATCH_MP_TAC cont_mk_segment;
15692 REWRITE_TAC[joinf;IMAGE ];
15693 REWRITE_TAC[mk_segment];
15699 TYPE_THEN `~(x' < &0)` SUBGOAL_TAC;
15702 DISCH_THEN_REWRITE;
15703 ASM_CASES_TAC `x' < &1`;
15705 IMATCH_MP_TAC euclid_add_closure;
15706 CONJ_TAC THEN (IMATCH_MP_TAC euclid_scale_closure) THEN (ASM_REWRITE_TAC[]);
15710 TYPE_THEN `~(x' < &0)` SUBGOAL_TAC;
15713 DISCH_THEN_REWRITE;
15714 TYPE_THEN `~(y' < &0)` SUBGOAL_TAC;
15717 DISCH_THEN_REWRITE;
15718 TYPE_THEN `(if (x' < &1) then (euclid_plus (x' *# y) ((&1 - x') *# x)) else y) = ( euclid_plus (x' *# y) ((&1 - x') *# x))` SUBGOAL_TAC;
15719 TYPE_THEN `(x' < &1) \/ (x' = &1)` SUBGOAL_TAC;
15722 DISCH_THEN DISJ_CASES_TAC;
15724 TYPE_THEN `~(x' < &1)` SUBGOAL_TAC;
15727 DISCH_THEN_REWRITE;
15730 REWRITE_TAC[euclid_scale_one;euclid_scale0;euclid_rzero];
15731 DISCH_THEN_REWRITE;
15733 TYPE_THEN `(if (y' < &1) then (euclid_plus (y' *# y) ((&1 - y') *# x)) else y) = ( euclid_plus (y' *# y) ((&1 - y') *# x))` SUBGOAL_TAC;
15734 TYPE_THEN `(y' < &1) \/ (y' = &1)` SUBGOAL_TAC;
15737 DISCH_THEN DISJ_CASES_TAC;
15739 TYPE_THEN `~(y' < &1)` SUBGOAL_TAC;
15742 DISCH_THEN_REWRITE;
15745 REWRITE_TAC[euclid_scale_one;euclid_scale0;euclid_rzero];
15746 DISCH_THEN_REWRITE;
15748 ONCE_REWRITE_TAC [euclid_eq_minus];
15749 REWRITE_TAC[euclid_minus_scale;euclid_ldistrib;euclid_scale_act];
15750 ONCE_REWRITE_TAC [euclid_plus_pair];
15751 REWRITE_TAC[GSYM euclid_rdistrib];
15753 REWRITE_TAC[REAL_ARITH `x' + -- &1 * y' = x' - y'`];
15754 REWRITE_TAC[REAL_ARITH `&1 - x' - (&1 - y') = -- &1 *(x' - y')`];
15755 REWRITE_TAC[GSYM euclid_scale_act;GSYM euclid_minus_scale;ONCE_REWRITE_RULE[EQ_SYM_EQ] euclid_eq_minus];
15758 PROOF_BY_CONTR_TAC;
15761 IMATCH_MP_TAC euclid_scale_cancel;
15762 TYPE_THEN `(x' - y')` EXISTS_TAC;
15768 IMATCH_MP_TAC EQ_EXT;
15778 ASM_MESON_TAC[REAL_ARITH `~(&0 <=. x /\ x < &.0)`];
15783 TYPE_THEN `&1 - x''` EXISTS_TAC;
15791 ONCE_REWRITE_TAC [euclid_add_comm];
15792 REWRITE_TAC[REAL_ARITH `&1 - (&1 - x) = x`];
15796 TYPE_THEN `&0` EXISTS_TAC;
15801 REWRITE_TAC[euclid_scale_one; euclid_scale0; euclid_lzero;REAL_ARITH `&1 - &0 = &1` ];
15805 TYPE_THEN `&1 - a` EXISTS_TAC ;
15814 ASM_MESON_TAC[REAL_ARITH `&1 - a < &0 ==> ~(a <= &1)`];
15816 REWRITE_TAC[REAL_ARITH `&1 - (&1 - a) = a`];
15817 ASM_MESON_TAC [euclid_add_comm];
15818 TYPE_THEN `a = &.0` SUBGOAL_TAC;
15826 REWRITE_TAC [euclid_scale_one; euclid_scale0; euclid_lzero;REAL_ARITH `&1 - &0 = &1` ];
15831 let h_simple_polygonal = prove_by_refinement(
15832 `!x e. (euclid 2 x) /\ (~(e = &0)) ==>
15833 (simple_polygonal_arc hv_line (mk_segment x (x + e *# e1)))`,
15836 REWRITE_TAC[simple_polygonal_arc;hv_line;simple_arc ];
15839 ASSUME_TAC mk_segment_inj_image;
15840 TYPEL_THEN [`x`;`x + (e *# e1)`;`2`] (USE 2 o ISPECL);
15841 TYPE_THEN `euclid 2 x /\ euclid 2 (euclid_plus x (e *# e1)) /\ ~(x = euclid_plus x (e *# e1))` SUBGOAL_TAC;
15844 IMATCH_MP_TAC euclid_add_closure;
15846 IMATCH_MP_TAC euclid_scale_closure;
15847 REWRITE_TAC [e1;euclid_point];
15849 FIRST_ASSUM (fun t-> MP_TAC (AP_THM t `0`));
15850 REWRITE_TAC[euclid_plus;euclid_scale;e1;coord01];
15856 TYPE_THEN `f` EXISTS_TAC;
15858 SIMP_TAC [GSYM top_of_metric_unions;metric_euclid];
15861 USE 1 (MATCH_MP point_onto);
15863 TYPE_THEN `{(mk_line (point p) (point p + (e *# e1)))}` EXISTS_TAC;
15864 REWRITE_TAC[INR IN_SING];
15866 REWRITE_TAC[e1;ISUBSET;mk_segment;mk_line];
15868 TYPE_THEN `a` EXISTS_TAC;
15871 REWRITE_TAC[FINITE_SING];
15874 TYPE_THEN `p` EXISTS_TAC;
15875 TYPE_THEN `(FST p + e, SND p)` EXISTS_TAC;
15878 REWRITE_TAC[e1;point_scale];
15880 TYPE_THEN `euclid_plus (point p) (point (e,&0)) = euclid_plus (point (FST p,SND p)) (point (e,&0))` SUBGOAL_TAC;
15882 DISCH_THEN (fun t-> PURE_ONCE_REWRITE_TAC[t]);
15883 REWRITE_TAC[point_add];
15888 let pconn_refl = prove_by_refinement(
15889 `!A x. (top2 A) /\ (A x) ==> (p_conn A x x)`,
15892 REWRITE_TAC[p_conn;top2];
15894 TYPE_THEN `?e. (&0 < e) /\ (open_ball(euclid 2,d_euclid) x e SUBSET A)` SUBGOAL_TAC;
15895 ASM_MESON_TAC[open_ball_nbd;metric_euclid];
15897 TYPE_THEN `mk_segment x (x + (e/(&2))*# e1)` EXISTS_TAC;
15898 TYPE_THEN `euclid 2 x` SUBGOAL_TAC;
15899 USE 1(MATCH_MP sub_union);
15901 ASM_MESON_TAC [top_of_metric_unions;metric_euclid;ISUBSET];
15903 TYPE_THEN `~(e/(&2) = &0)` SUBGOAL_TAC;
15904 IMATCH_MP_TAC (REAL_ARITH `(&0 < x) ==> (~(x = &0))` );
15905 ASM_REWRITE_TAC[REAL_LT_HALF1];
15908 IMATCH_MP_TAC h_simple_polygonal;
15911 IMATCH_MP_TAC SUBSET_TRANS;
15912 TYPE_THEN `open_ball (euclid 2,d_euclid) x e ` EXISTS_TAC;
15914 IMATCH_MP_TAC h_seg_openball;
15917 MESON_TAC[half_pos;REAL_ARITH `&0 < x ==> &0 <= x`];
15918 REWRITE_TAC[mk_segment];
15919 TYPE_THEN `&1` EXISTS_TAC;
15921 REWRITE_TAC[euclid_scale_one ;euclid_scale0;euclid_rzero;];
15926 let pconn_symm = prove_by_refinement(
15927 `!A x y. (p_conn A x y ==> p_conn A y x)`,
15930 REWRITE_TAC[p_conn;];
15935 let compose_cont = prove_by_refinement(
15936 `!(f:A->B) (g:B->C) X dX Y dY Z dZ.
15937 (metric_continuous f (X,dX) (Y,dY)) /\
15938 (metric_continuous g (Y,dY) (Z,dZ)) /\
15939 (IMAGE f X SUBSET Y) ==>
15940 (metric_continuous (compose g f) (X,dX) (Z,dZ))`,
15943 REWRITE_TAC[metric_continuous;metric_continuous_pt];
15947 REWRITE_TAC[compose];
15948 TYPEL_THEN [`f x`;`epsilon`] (USE 1 o ISPECL);
15952 TYPEL_THEN [`x`;`delta`] (USE 2 o ISPECL);
15956 TYPE_THEN `delta'` EXISTS_TAC;
15959 FIRST_ASSUM IMATCH_MP_TAC ;
15960 USE 0 (REWRITE_RULE[IMAGE;SUBSET]);
15965 let compose_image = prove_by_refinement(
15966 `!(f:A->B) (g:B->C) X.
15967 (IMAGE (compose g f) X) =
15968 (IMAGE g (IMAGE f X))`,
15971 REWRITE_TAC[IMAGE];
15973 IMATCH_MP_TAC EQ_EXT;
15977 REWRITE_TAC[compose];
15978 CONV_TAC (dropq_conv "x''");
15982 let linear_cont = prove_by_refinement(
15983 `!a b. metric_continuous (\t. t * a + (&1 - t)* b)
15984 (UNIV,d_real) (UNIV,d_real)`,
15988 REWRITE_TAC[metric_continuous;metric_continuous_pt];
15992 TYPE_THEN `a = b` ASM_CASES_TAC;
15993 ASM_REWRITE_TAC[GSYM REAL_RDISTRIB;REAL_ARITH `!u. u + &1 - u = &1`];
15995 ASM_REWRITE_TAC[d_real;REAL_ARITH `b - b = &0`;ABS_0;];
15996 TYPE_THEN `epsilon` EXISTS_TAC;
15999 TYPE_THEN `delta = epsilon/(abs (a-b))` ABBREV_TAC;
16000 TYPE_THEN `delta` EXISTS_TAC;
16002 EXPAND_TAC "delta";
16003 IMATCH_MP_TAC REAL_LT_DIV;
16008 REWRITE_TAC[d_real];
16010 TYPE_THEN `((x * a + (&1 - x) * b) - (y * a + (&1 - y) * b)) = (x - y)*(a - b)` SUBGOAL_TAC;
16012 DISCH_THEN_REWRITE;
16013 TYPE_THEN `epsilon = delta * (abs (a - b))` SUBGOAL_TAC;
16014 EXPAND_TAC "delta";
16015 ONCE_REWRITE_TAC [EQ_SYM_EQ];
16016 IMATCH_MP_TAC REAL_DIV_RMUL;
16019 DISCH_THEN_REWRITE;
16020 REWRITE_TAC[ABS_MUL];
16021 IMATCH_MP_TAC REAL_PROP_LT_RMUL;
16028 let linear_image_gen = prove_by_refinement(
16029 `!a b c d. (a < b) /\ (c < d) ==>
16030 (IMAGE (\t. (t - c)/(d-c) * a + (d - t)/(d - c) *b )
16031 {x | c <= x /\ x <= d } =
16032 {y | a <= y /\ y <= b})`,
16036 REWRITE_TAC[IMAGE];
16037 IMATCH_MP_TAC EQ_EXT;
16040 TYPE_THEN `&0 < (b - a)` SUBGOAL_TAC;
16043 TYPE_THEN `&0 < (d - c)` SUBGOAL_TAC;
16047 ABBREV_TAC `e = &1/(d-c)`;
16048 TYPE_THEN `!u. u/(d - c) = u*e` SUBGOAL_TAC;
16051 REWRITE_TAC[real_div];
16055 TYPE_THEN `(d - c)*e = &1` SUBGOAL_TAC;
16057 REWRITE_TAC[real_div];
16059 REWRITE_TAC[GSYM real_div];
16060 IMATCH_MP_TAC REAL_DIV_REFL;
16064 TYPE_THEN `&0 < e` SUBGOAL_TAC;
16066 IMATCH_MP_TAC REAL_LT_DIV;
16075 TYPE_THEN `((d-c)*e*a <= ((x' - c) * e) * a + ((d - x') * e) * b) ==> (a <= ((x' - c) * e) * a + ((d - x') * e) * b)` SUBGOAL_TAC;
16076 ASM_REWRITE_TAC[REAL_MUL_ASSOC];
16078 DISCH_THEN IMATCH_MP_TAC ;
16079 ineq_le_tac `(d-c)*e*a + (d - x')*(b - a)*e = ((x' - c) * e) * a + ((d - x') * e) * b`;
16080 TYPE_THEN `(((x' - c) * e) * a + ((d - x') * e) * b <= b*((d- c)*e)) ==> (((x' - c) * e) * a + ((d - x') * e) * b <= b)` SUBGOAL_TAC;
16081 ASM_REWRITE_TAC[REAL_ARITH `x* &1 = x`];
16082 DISCH_THEN IMATCH_MP_TAC ;
16083 ineq_le_tac `(((x' - c) * e) * a + ((d - x') * e) * b) + (x'-c )*(b-a)*e = b * (d - c) * e`;
16084 (* 2nd direction *)
16086 TYPE_THEN `x' = ((d*b - a*c) - (d -c)*x)/(b - a)` ABBREV_TAC ;
16087 TYPE_THEN `x'` EXISTS_TAC;
16088 TYPE_THEN `x'*(b - a) = ((d*b - a*c) - (d -c)*x)` SUBGOAL_TAC;
16090 IMATCH_MP_TAC REAL_DIV_RMUL;
16095 SUBGOAL_TAC `!x a b. (a * x <= b * x /\ &0 < x) ==> (a <= b)`;
16096 MESON_TAC[REAL_PROP_LE_RCANCEL];
16100 FIRST_ASSUM IMATCH_MP_TAC ;
16101 TYPE_THEN `(b - a)` EXISTS_TAC;
16103 ineq_le_tac `c * (b - a) + (d-c)*(b-x) = d * b - a * c - (d - c) * x`;
16104 FIRST_ASSUM IMATCH_MP_TAC ;
16105 TYPE_THEN `(b - a)` EXISTS_TAC;
16107 ineq_le_tac `(d * b - a * c - (d - c) * x) + (d-c)*(x-a) = d * (b - a)`;
16108 TYPE_THEN `((x' - c) * e) * a + ((d - x') * e) * b = (d*b - c*a - x'*(b-a))*e` SUBGOAL_TAC;
16110 DISCH_THEN_REWRITE;
16112 TYPE_THEN `(d * b - c * a - (d * b - a * c - (d - c) * x)) = x*(d-c)` SUBGOAL_TAC;
16114 DISCH_THEN_REWRITE;
16115 REWRITE_TAC[GSYM REAL_MUL_ASSOC];
16121 let linear_image_rev = prove_by_refinement(
16122 `!a b c d. (a < b) /\ (c < d) ==>
16123 (IMAGE (\t. (t - c)/(d-c) * b + (d - t)/(d - c) *a )
16124 {x | c <= x /\ x <= d } =
16125 {y | a <= y /\ y <= b})`,
16129 REWRITE_TAC[IMAGE];
16130 IMATCH_MP_TAC EQ_EXT;
16133 TYPE_THEN `&0 < (b - a)` SUBGOAL_TAC;
16136 TYPE_THEN `&0 < (d - c)` SUBGOAL_TAC;
16140 ABBREV_TAC `e = &1/(d-c)`;
16141 TYPE_THEN `!u. u/(d - c) = u*e` SUBGOAL_TAC;
16144 REWRITE_TAC[real_div];
16148 TYPE_THEN `(d - c)*e = &1` SUBGOAL_TAC;
16150 REWRITE_TAC[real_div];
16152 REWRITE_TAC[GSYM real_div];
16153 IMATCH_MP_TAC REAL_DIV_REFL;
16157 TYPE_THEN `&0 < e` SUBGOAL_TAC;
16159 IMATCH_MP_TAC REAL_LT_DIV;
16168 TYPE_THEN `((d-c)*e*a <= ((x' - c) * e) * b + ((d - x') * e) * a) ==> (a <= ((x' - c) * e) * b + ((d - x') * e) * a)` SUBGOAL_TAC;
16169 ASM_REWRITE_TAC[REAL_MUL_ASSOC];
16171 DISCH_THEN IMATCH_MP_TAC ;
16172 ineq_le_tac `(d-c)*e*a + (x' - c)*(b - a)*e = ((x' - c) * e) * b + ((d - x') * e) * a`;
16173 TYPE_THEN `(((x' - c) * e) * b + ((d - x') * e) * a <= b*((d- c)*e)) ==> (((x' - c) * e) * b + ((d - x') * e) * a <= b)` SUBGOAL_TAC;
16174 ASM_REWRITE_TAC[REAL_ARITH `x* &1 = x`];
16175 DISCH_THEN IMATCH_MP_TAC ;
16176 ineq_le_tac `(((x' - c) * e) * b + ((d - x') * e) * a) + (d - x' )*(b-a)*e = b * (d - c) * e`;
16177 (* 2nd direction *)
16179 TYPE_THEN `x' = ((b*c - a*d) + (d -c)*x)/(b - a)` ABBREV_TAC ;
16180 TYPE_THEN `x'` EXISTS_TAC;
16181 TYPE_THEN `x'*(b - a) = ((b*c - a*d ) + (d -c)*x)` SUBGOAL_TAC;
16183 IMATCH_MP_TAC REAL_DIV_RMUL;
16188 SUBGOAL_TAC `!x a b. (a * x <= b * x /\ &0 < x) ==> (a <= b)`;
16189 MESON_TAC[REAL_PROP_LE_RCANCEL];
16193 FIRST_ASSUM IMATCH_MP_TAC ;
16194 TYPE_THEN `(b - a)` EXISTS_TAC;
16196 ineq_le_tac `c * (b - a) + (d-c)*(x-a) = b*c - a*d + (d - c) * x`;
16197 FIRST_ASSUM IMATCH_MP_TAC ;
16198 TYPE_THEN `(b - a)` EXISTS_TAC;
16200 ineq_le_tac `(b*c - a*d + (d - c) * x) + (d-c)*(b - x) = d * (b - a)`;
16201 TYPE_THEN `((x' - c) * e) * b + ((d - x') * e) * a = (d*a - c*b + x'*(b-a))*e` SUBGOAL_TAC;
16203 DISCH_THEN_REWRITE;
16205 TYPE_THEN `(d * a - c * b + b * c - a * d + (d - c) * x) = x*(d-c)` SUBGOAL_TAC;
16207 DISCH_THEN_REWRITE;
16208 REWRITE_TAC[GSYM REAL_MUL_ASSOC];
16214 let linear_inj = prove_by_refinement(
16215 `!a b c d. (a < b) /\ (c < d) ==>
16216 (INJ (\t. (t - c)/(d-c) * a + (d - t)/(d - c) *b )
16217 {x | c <= x /\ x <= d }
16218 {y | a <= y /\ y <= b})`,
16225 ASSUME_TAC linear_image_gen;
16226 TYPEL_THEN [`a`;`b`;`c`;`d`] (USE 4 o ISPECL);
16229 REWRITE_TAC[IMAGE];
16231 FIRST_ASSUM (fun t-> ASSUME_TAC (AP_THM t `(x - c) / (d - c) * a + (d - x) / (d - c) * b`));
16234 DISCH_THEN (fun t->REWRITE_TAC[GSYM t]);
16235 TYPE_THEN `x` EXISTS_TAC;
16240 TYPE_THEN `&0 < (d - c)` SUBGOAL_TAC;
16244 TYPE_THEN `e = &1/(d-c)` ABBREV_TAC ;
16245 TYPE_THEN `!u. (u/(d-c) = u*e)` SUBGOAL_TAC;
16248 REWRITE_TAC[real_div];
16250 DISCH_THEN_REWRITE;
16252 USE 8(ONCE_REWRITE_RULE [REAL_ARITH `(x = y) <=> (x - y = &0)`]);
16254 TYPE_THEN `(((x - c) * e) * a + ((d - x) * e) * b) - (((y - c) * e) * a + ((d - y) * e) * b) = e*(b-a)*(y - x)` SUBGOAL_TAC;
16256 DISCH_THEN_REWRITE;
16257 REWRITE_TAC[REAL_ENTIRE];
16258 TYPE_THEN `~(b - a = &0)` SUBGOAL_TAC;
16261 DISCH_THEN_REWRITE;
16262 TYPE_THEN `~(e = &0)` SUBGOAL_TAC;
16264 REWRITE_TAC[real_div];
16266 REWRITE_TAC[REAL_INV_EQ_0];
16273 let linear_inj_rev = prove_by_refinement(
16274 `!a b c d. (a < b) /\ (c < d) ==>
16275 (INJ (\t. (t - c)/(d-c) * b + (d - t)/(d - c) *a )
16276 {x | c <= x /\ x <= d }
16277 {y | a <= y /\ y <= b})`,
16284 ASSUME_TAC linear_image_rev;
16285 TYPEL_THEN [`a`;`b`;`c`;`d`] (USE 4 o ISPECL);
16288 REWRITE_TAC[IMAGE];
16290 FIRST_ASSUM (fun t-> ASSUME_TAC (AP_THM t `(x - c) / (d - c) * b + (d - x) / (d - c) * a`));
16293 DISCH_THEN (fun t->REWRITE_TAC[GSYM t]);
16294 TYPE_THEN `x` EXISTS_TAC;
16299 TYPE_THEN `&0 < (d - c)` SUBGOAL_TAC;
16303 TYPE_THEN `e = &1/(d-c)` ABBREV_TAC ;
16304 TYPE_THEN `!u. (u/(d-c) = u*e)` SUBGOAL_TAC;
16307 REWRITE_TAC[real_div];
16309 DISCH_THEN_REWRITE;
16311 USE 8(ONCE_REWRITE_RULE [REAL_ARITH `(x = y) <=> (x - y = &0)`]);
16313 TYPE_THEN `(((x - c) * e) * b + ((d - x) * e) * a) - (((y - c) * e) * b + ((d - y) * e) * a) = e*(a-b)*(y - x)` SUBGOAL_TAC;
16315 DISCH_THEN_REWRITE;
16316 REWRITE_TAC[REAL_ENTIRE];
16317 TYPE_THEN `~(a-b = &0)` SUBGOAL_TAC;
16320 DISCH_THEN_REWRITE;
16321 TYPE_THEN `~(e = &0)` SUBGOAL_TAC;
16323 REWRITE_TAC[real_div];
16325 REWRITE_TAC[REAL_INV_EQ_0];
16332 let comp_comp = prove_by_refinement(
16333 `(o) = (compose:(B->C) -> ((A->B)-> (A->C))) `,
16336 IMATCH_MP_TAC EQ_EXT;
16338 IMATCH_MP_TAC EQ_EXT;
16340 IMATCH_MP_TAC EQ_EXT;
16342 REWRITE_TAC[o_DEF;compose];
16346 let arc_reparameter_rev = prove_by_refinement(
16347 `!f a b c d. ( continuous f (top_of_metric (UNIV,d_real)) (top2) /\
16348 INJ f {x | c <= x /\ x <= d} (euclid 2) /\
16349 (a < b) /\ (c < d) ==>
16350 (?g. continuous g (top_of_metric (UNIV,d_real)) (top2) /\
16351 INJ g {x | a <= x /\ x <= b} (euclid 2) /\
16352 (f d = g a) /\ (f c = g b) /\
16353 (!x y x' y'. (f x = g x') /\ (f y = g y') /\
16354 (c <= x /\ x <= d) /\ (c <= y /\ y <= d) /\
16355 (a <= x' /\ x' <= b) /\ (a <= y' /\ y' <= b) ==>
16356 ((x < y) = (y' < x'))) /\
16357 (IMAGE f { x | c <= x /\ x <= d } =
16358 IMAGE g { x | a <= x /\ x <= b } )))`,
16362 TYPE_THEN `f2 = (\t. (t - a)/(b - a) * (c) + (b - t)/(b - a) *(d) )` ABBREV_TAC ;
16363 TYPE_THEN `g = (f o f2)` ABBREV_TAC ;
16364 TYPE_THEN `g` EXISTS_TAC;
16365 (* general facts *)
16366 TYPE_THEN `UNIONS(top_of_metric(UNIV,d_real)) = UNIV` SUBGOAL_TAC;
16367 MESON_TAC[metric_real;top_of_metric_unions];
16372 IMATCH_MP_TAC continuous_comp;
16373 TYPE_THEN `(top_of_metric(UNIV,d_real))` EXISTS_TAC;
16376 ASM_SIMP_TAC[metric_continuous_continuous;metric_real;SUBSET_UNIV];
16377 TYPE_THEN `f2 = (\t. t* (c - d + d*b - c*a)/(b - a) + (&1 - t)*(d*b-c*a)/(b - a))` SUBGOAL_TAC;
16379 IMATCH_MP_TAC EQ_EXT;
16382 REWRITE_TAC[real_div;GSYM REAL_MUL_ASSOC;REAL_ARITH `(inv x)*y = y*(inv x)`];
16383 REWRITE_TAC[REAL_MUL_ASSOC;GSYM REAL_RDISTRIB;REAL_EQ_MUL_RCANCEL];
16386 DISCH_THEN_REWRITE;
16387 ASM_REWRITE_TAC[linear_cont];
16389 TYPE_THEN `{x | c <= x /\ x <= d} = IMAGE f2 {x | a <= x /\ x <= b}` SUBGOAL_TAC;
16392 ASM_SIMP_TAC[linear_image_gen];
16394 TYPE_THEN `(IMAGE f {x | c <= x /\ x <= d} = IMAGE g {x | a <= x /\ x <= b})` SUBGOAL_TAC;
16396 REWRITE_TAC[comp_comp;compose_image;];
16403 REWRITE_TAC[comp_comp];
16406 IMATCH_MP_TAC (COMP_INJ);
16407 TYPE_THEN `{x | c <= x /\ x <= d}` EXISTS_TAC;
16409 DISCH_THEN_REWRITE;
16413 IMATCH_MP_TAC linear_inj;
16416 IMATCH_MP_TAC (TAUT `(A /\ B) /\ C ==> A /\ B /\ C`);
16419 REWRITE_TAC[compose];
16421 REWRITE_TAC[real_div;REAL_MUL_ASSOC;];
16423 TYPE_THEN `(b-a)*inv(b-a) = &1` SUBGOAL_TAC;
16424 IMATCH_MP_TAC REAL_MUL_RINV;
16427 DISCH_THEN_REWRITE;
16430 REWRITE_TAC[compose];
16432 TYPE_THEN `c <= f2 y' /\ f2 y' <= d` SUBGOAL_TAC;
16433 USE 7 (REWRITE_RULE[IMAGE]);
16434 TYPE_THEN `f2 y'` (fun s -> FIRST_ASSUM (fun t-> MP_TAC (AP_THM t s)));
16436 DISCH_THEN_REWRITE;
16437 TYPE_THEN `y'` EXISTS_TAC;
16440 TYPE_THEN `c <= f2 x' /\ f2 x' <= d` SUBGOAL_TAC;
16441 USE 7 (REWRITE_RULE[IMAGE]);
16442 TYPE_THEN `f2 x'` (fun s -> FIRST_ASSUM (fun t-> MP_TAC (AP_THM t s)));
16444 DISCH_THEN_REWRITE;
16445 TYPE_THEN `x'` EXISTS_TAC;
16448 TYPE_THEN `x = f2 x'` SUBGOAL_TAC;
16449 USE 2 (REWRITE_RULE[INJ]);
16451 FIRST_ASSUM IMATCH_MP_TAC ;
16454 TYPE_THEN `y = f2 y'` SUBGOAL_TAC;
16455 USE 2 (REWRITE_RULE[INJ]);
16457 FIRST_ASSUM IMATCH_MP_TAC ;
16462 ONCE_REWRITE_TAC [REAL_ARITH `x < y <=> ( &0 < y - x)`];
16463 REWRITE_TAC[real_div];
16464 TYPE_THEN `e = inv(b-a)` ABBREV_TAC ;
16465 TYPE_THEN `(((y' - a) * e) * c + ((b - y') * e) * d) - (((x' - a) * e) * c + ((b - x') * e) * d) = (x' - y')*e*(d-c)` SUBGOAL_TAC;
16467 DISCH_THEN_REWRITE;
16468 TYPE_THEN `&0 < e` SUBGOAL_TAC;
16470 IMATCH_MP_TAC REAL_PROP_POS_INV;
16473 TYPE_THEN `&0 < (d - c)` SUBGOAL_TAC;
16476 REWRITE_TAC[REAL_MUL_ASSOC];
16477 ASM_SIMP_TAC[REAL_PROP_POS_RMUL];
16481 let arc_reparameter_gen = prove_by_refinement(
16482 `!f a b c d. ( continuous f (top_of_metric (UNIV,d_real)) (top2) /\
16483 INJ f {x | c <= x /\ x <= d} (euclid 2) /\
16484 (a < b) /\ (c < d) ==>
16485 (?g. continuous g (top_of_metric (UNIV,d_real)) (top2) /\
16486 INJ g {x | a <= x /\ x <= b} (euclid 2) /\
16487 (f c = g a) /\ (f d = g b) /\
16488 (!x y x' y'. (f x = g x') /\ (f y = g y') /\
16489 (c <= x /\ x <= d) /\ (c <= y /\ y <= d) /\
16490 (a <= x' /\ x' <= b) /\ (a <= y' /\ y' <= b) ==>
16491 ((x < y) = (x' < y'))) /\
16492 (IMAGE f { x | c <= x /\ x <= d } =
16493 IMAGE g { x | a <= x /\ x <= b } )))`,
16497 TYPE_THEN `f2 = (\t. (t - a)/(b - a) * (d) + (b - t)/(b - a) *(c) )` ABBREV_TAC ;
16498 TYPE_THEN `g = (f o f2)` ABBREV_TAC ;
16499 TYPE_THEN `g` EXISTS_TAC;
16500 (* general facts *)
16501 TYPE_THEN `UNIONS(top_of_metric(UNIV,d_real)) = UNIV` SUBGOAL_TAC;
16502 MESON_TAC[metric_real;top_of_metric_unions];
16507 IMATCH_MP_TAC continuous_comp;
16508 TYPE_THEN `(top_of_metric(UNIV,d_real))` EXISTS_TAC;
16511 ASM_SIMP_TAC[metric_continuous_continuous;metric_real;SUBSET_UNIV];
16512 TYPE_THEN `f2 = (\t. t* (d - c + c*b - d*a)/(b - a) + (&1 - t)*(c*b-d*a)/(b - a))` SUBGOAL_TAC;
16514 IMATCH_MP_TAC EQ_EXT;
16517 REWRITE_TAC[real_div;GSYM REAL_MUL_ASSOC;REAL_ARITH `(inv x)*y = y*(inv x)`];
16518 REWRITE_TAC[REAL_MUL_ASSOC;GSYM REAL_RDISTRIB;REAL_EQ_MUL_RCANCEL];
16521 DISCH_THEN_REWRITE;
16522 ASM_REWRITE_TAC[linear_cont];
16524 TYPE_THEN `{x | c <= x /\ x <= d} = IMAGE f2 {x | a <= x /\ x <= b}` SUBGOAL_TAC;
16527 ASM_SIMP_TAC[linear_image_rev];
16529 TYPE_THEN `(IMAGE f {x | c <= x /\ x <= d} = IMAGE g {x | a <= x /\ x <= b})` SUBGOAL_TAC;
16531 REWRITE_TAC[comp_comp;compose_image;];
16538 REWRITE_TAC[comp_comp];
16541 IMATCH_MP_TAC (COMP_INJ);
16542 TYPE_THEN `{x | c <= x /\ x <= d}` EXISTS_TAC;
16544 DISCH_THEN_REWRITE;
16548 IMATCH_MP_TAC linear_inj_rev;
16551 IMATCH_MP_TAC (TAUT `(A /\ B) /\ C ==> A /\ B /\ C`);
16554 REWRITE_TAC[compose];
16556 REWRITE_TAC[real_div;REAL_MUL_ASSOC;];
16558 TYPE_THEN `(b-a)*inv(b-a) = &1` SUBGOAL_TAC;
16559 IMATCH_MP_TAC REAL_MUL_RINV;
16562 DISCH_THEN_REWRITE;
16565 REWRITE_TAC[compose];
16567 TYPE_THEN `c <= f2 y' /\ f2 y' <= d` SUBGOAL_TAC;
16568 USE 7 (REWRITE_RULE[IMAGE]);
16569 TYPE_THEN `f2 y'` (fun s -> FIRST_ASSUM (fun t-> MP_TAC (AP_THM t s)));
16571 DISCH_THEN_REWRITE;
16572 TYPE_THEN `y'` EXISTS_TAC;
16575 TYPE_THEN `c <= f2 x' /\ f2 x' <= d` SUBGOAL_TAC;
16576 USE 7 (REWRITE_RULE[IMAGE]);
16577 TYPE_THEN `f2 x'` (fun s -> FIRST_ASSUM (fun t-> MP_TAC (AP_THM t s)));
16579 DISCH_THEN_REWRITE;
16580 TYPE_THEN `x'` EXISTS_TAC;
16583 TYPE_THEN `x = f2 x'` SUBGOAL_TAC;
16584 USE 2 (REWRITE_RULE[INJ]);
16586 FIRST_ASSUM IMATCH_MP_TAC ;
16589 TYPE_THEN `y = f2 y'` SUBGOAL_TAC;
16590 USE 2 (REWRITE_RULE[INJ]);
16592 FIRST_ASSUM IMATCH_MP_TAC ;
16597 ONCE_REWRITE_TAC [REAL_ARITH `x < y <=> ( &0 < y - x)`];
16598 REWRITE_TAC[real_div];
16599 TYPE_THEN `e = inv(b-a)` ABBREV_TAC ;
16600 TYPE_THEN `(((y' - a) * e) * d + ((b - y') * e) * c) - (((x' - a) * e) * d + ((b - x') * e) * c) = (y' - x')*e*(d-c)` SUBGOAL_TAC;
16602 DISCH_THEN_REWRITE;
16603 TYPE_THEN `&0 < e` SUBGOAL_TAC;
16605 IMATCH_MP_TAC REAL_PROP_POS_INV;
16608 TYPE_THEN `&0 < (d - c)` SUBGOAL_TAC;
16611 REWRITE_TAC[REAL_MUL_ASSOC];
16612 ASM_SIMP_TAC[REAL_PROP_POS_RMUL];
16616 let image_preimage = prove_by_refinement(
16617 `!(f:A->B) X Y. IMAGE f (preimage X f Y) SUBSET Y`,
16621 REWRITE_TAC[IMAGE;SUBSET;INR in_preimage ;];
16626 let preimage_union2 = prove_by_refinement(
16627 `!(f:A->B) A B X. (preimage X f (A UNION B)) =
16628 (preimage X f A UNION preimage X f B)`,
16632 IMATCH_MP_TAC SUBSET_ANTISYM;
16634 REWRITE_TAC[preimage_union;image_preimage;];
16635 REWRITE_TAC[preimage;SUBSET;];
16637 REWRITE_TAC[union_subset];
16638 REWRITE_TAC[preimage;SUBSET;UNION];
16643 let union_diff = prove_by_refinement(
16644 `!(X:A->bool) A B. (X = A UNION B) /\ (A INTER B = EMPTY) ==>
16653 let preimage_closed = prove_by_refinement(
16654 `!U V C (f:A->B). (continuous f U V) /\ (closed_ V C) /\
16655 (IMAGE f (UNIONS U) SUBSET (UNIONS V)) ==>
16656 (closed_ U (preimage (UNIONS U) f C))`,
16661 REWRITE_TAC[closed;open_DEF;];
16662 TYPE_THEN `(UNIONS U DIFF (preimage (UNIONS U) f C)) = preimage (UNIONS U) f (UNIONS V DIFF C)` SUBGOAL_TAC;
16663 IMATCH_MP_TAC union_diff;
16664 REWRITE_TAC[GSYM preimage_union2];
16666 TYPE_THEN `UNIONS V DIFF C UNION C = UNIONS V` SUBGOAL_TAC;
16667 TYPE_THEN `!P. C SUBSET P ==> (P DIFF C UNION C = P)` SUBGOAL_TAC;
16669 TYPE_THEN `C SUBSET UNIONS V` SUBGOAL_TAC;
16671 REWRITE_TAC[closed;open_DEF;];
16672 DISCH_THEN_REWRITE;
16674 DISCH_THEN (fun t-> ASM_SIMP_TAC[t]);
16675 DISCH_THEN_REWRITE;
16676 IMATCH_MP_TAC SUBSET_ANTISYM;
16677 ASM_REWRITE_TAC [ subset_preimage;];
16678 REWRITE_TAC[preimage;SUBSET];
16680 IMATCH_MP_TAC preimage_disjoint;
16682 DISCH_THEN_REWRITE;
16684 REWRITE_TAC[SUBSET;preimage];
16687 REWRITE_TAC[continuous];
16688 DISCH_THEN IMATCH_MP_TAC ;
16690 REWRITE_TAC[closed;open_DEF;];
16696 let preimage_restrict = prove_by_refinement(
16697 `!(f:A->B) Z A B. (A SUBSET B) ==>
16698 (preimage A f Z = A INTER preimage B f Z)`,
16702 REWRITE_TAC[preimage;INTER;];
16703 TYPE_THEN `!y. (A SUBSET B ==> (A y /\ B y <=> A y))` SUBGOAL_TAC;
16704 MESON_TAC[ISUBSET];
16707 IMATCH_MP_TAC EQ_EXT;
16713 let continuous_delta = prove_by_refinement(
16714 `continuous (\x. (x *# dirac_delta 0)) (top_of_metric(UNIV,d_real))
16715 (top_of_metric(euclid 1,d_euclid)) `,
16718 TYPE_THEN `IMAGE (\x. (x *# dirac_delta 0)) (UNIV) SUBSET (euclid 1)` SUBGOAL_TAC;
16719 REWRITE_TAC[IMAGE;SUBSET;];
16720 MESON_TAC[euclid_dirac];
16721 ASM_SIMP_TAC[metric_continuous_continuous;metric_euclid;metric_real];
16722 REWRITE_TAC[metric_continuous;metric_continuous_pt];
16726 TYPE_THEN `epsilon` EXISTS_TAC;
16729 ASM_SIMP_TAC[euclid_dirac;euclid1_abs];
16730 REWRITE_TAC[dirac_0];
16731 USE 2 (REWRITE_RULE [d_real]);
16736 let continuous_neg_delta = prove_by_refinement(
16737 `continuous (\x. ((-- x) *# dirac_delta 0))
16738 (top_of_metric(UNIV,d_real))
16739 (top_of_metric(euclid 1,d_euclid)) `,
16742 TYPE_THEN `IMAGE (\x. (-- x *# dirac_delta 0)) (UNIV) SUBSET (euclid 1)` SUBGOAL_TAC;
16743 REWRITE_TAC[IMAGE;SUBSET;];
16744 MESON_TAC[euclid_dirac];
16745 ASM_SIMP_TAC[metric_continuous_continuous;metric_euclid;metric_real];
16746 REWRITE_TAC[metric_continuous;metric_continuous_pt];
16750 TYPE_THEN `epsilon` EXISTS_TAC;
16753 ASM_SIMP_TAC[euclid_dirac;euclid1_abs];
16754 REWRITE_TAC[dirac_0];
16755 USE 2 (REWRITE_RULE [d_real]);
16761 let compact_max_real = prove_by_refinement(
16763 continuous f U (top_of_metric (UNIV,d_real)) /\
16766 ==> (?x. K x /\ (!y. K y ==> f y <= f x ))`,
16770 TYPE_THEN `g = (\x. (x *# dirac_delta 0)) o f` ABBREV_TAC ;
16771 TYPE_THEN `(?x. K x /\ (!y. K y ==> g y 0 <= g x 0 ))` SUBGOAL_TAC;
16772 IMATCH_MP_TAC compact_max;
16773 TYPE_THEN `U` EXISTS_TAC;
16776 REWRITE_TAC[IMAGE_o];
16777 TYPE_THEN `X = IMAGE f K` ABBREV_TAC ;
16778 REWRITE_TAC[IMAGE ;SUBSET];
16780 IMATCH_MP_TAC continuous_comp;
16781 TYPE_THEN `top_of_metric(UNIV,d_real)` EXISTS_TAC;
16782 ASM_REWRITE_TAC[continuous_delta];
16783 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real];
16784 MESON_TAC[euclid_dirac];
16786 TYPE_THEN `x` EXISTS_TAC;
16791 REWRITE_TAC[o_DEF;dirac_0];
16796 let compact_min_real = prove_by_refinement(
16798 continuous f U (top_of_metric (UNIV,d_real)) /\
16801 ==> (?x. K x /\ (!y. K y ==> f x <= f y ))`,
16805 TYPE_THEN `g = (\x. (-- x *# dirac_delta 0)) o f` ABBREV_TAC ;
16806 TYPE_THEN `(?x. K x /\ (!y. K y ==> g y 0 <= g x 0 ))` SUBGOAL_TAC;
16807 IMATCH_MP_TAC compact_max;
16808 TYPE_THEN `U` EXISTS_TAC;
16811 REWRITE_TAC[IMAGE_o];
16812 TYPE_THEN `X = IMAGE f K` ABBREV_TAC ;
16813 REWRITE_TAC[IMAGE ;SUBSET];
16815 IMATCH_MP_TAC continuous_comp;
16816 TYPE_THEN `top_of_metric(UNIV,d_real)` EXISTS_TAC;
16817 ASM_REWRITE_TAC[continuous_neg_delta];
16818 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real];
16819 MESON_TAC[euclid_dirac];
16821 TYPE_THEN `x` EXISTS_TAC;
16826 REWRITE_TAC[o_DEF;dirac_0];
16827 ASM_MESON_TAC[REAL_ARITH `!u v. (-- u <= --v) <=> (v <= u)`];
16831 let continuous_I = prove_by_refinement(
16832 `continuous I (top_of_metric(UNIV,d_real))
16833 (top_of_metric(UNIV,d_real))`,
16836 REWRITE_TAC[continuous];
16838 REWRITE_TAC[preimage];
16839 SIMP_TAC [GSYM top_of_metric_unions;metric_real];
16840 REWRITE_TAC[I_DEF];
16841 TYPE_THEN `{x | v x} = v` SUBGOAL_TAC;
16842 IMATCH_MP_TAC EQ_EXT;
16844 DISCH_THEN_REWRITE;
16849 let compact_sup = prove_by_refinement(
16850 `!X. (compact (top_of_metric(UNIV,d_real)) X) /\ ~(X=EMPTY ) ==>
16851 (?x. (X x) /\ (!y. (X y) ==> (y <= x)))`,
16854 TYPE_THEN `!(u:real). I u = u` SUBGOAL_TAC;
16855 REWRITE_TAC[I_DEF];
16857 TYPE_THEN `!x y. y <= x <=> (I y <= I x)` SUBGOAL_TAC;
16859 DISCH_THEN (fun t -> ONCE_REWRITE_TAC [t]);
16861 IMATCH_MP_TAC compact_max_real;
16862 TYPE_THEN `(top_of_metric(UNIV,d_real))` EXISTS_TAC;
16863 ASM_REWRITE_TAC[continuous_I];
16867 let compact_inf = prove_by_refinement(
16868 `!X. (compact (top_of_metric(UNIV,d_real)) X) /\ ~(X=EMPTY ) ==>
16869 (?x. (X x) /\ (!y. (X y) ==> (x <= y)))`,
16872 TYPE_THEN `!(u:real). I u = u` SUBGOAL_TAC;
16873 REWRITE_TAC[I_DEF];
16875 TYPE_THEN `!x y. y <= x <=> (I y <= I x)` SUBGOAL_TAC;
16877 DISCH_THEN (fun t -> ONCE_REWRITE_TAC [t]);
16879 IMATCH_MP_TAC compact_min_real;
16880 TYPE_THEN `(top_of_metric(UNIV,d_real))` EXISTS_TAC;
16881 ASM_REWRITE_TAC[continuous_I];
16885 let preimage_compact = prove_by_refinement(
16886 `!C (f:A->B) Y dY Z dZ Y0.
16887 metric_space (Y,dY) /\ metric_space (Z,dZ) /\
16888 (compact (top_of_metric(Y,dY)) Y0) /\
16889 (continuous f (top_of_metric(Y0,dY))
16890 (top_of_metric(Z,dZ))) /\
16891 (IMAGE f Y0 SUBSET Z) /\
16892 (closed_ (top_of_metric(Z,dZ)) C) /\
16893 ~(IMAGE f Y0 INTER C = EMPTY) ==>
16894 (compact (top_of_metric(Y,dY)) (preimage Y0 f C))`,
16898 TYPE_THEN `X = preimage Y0 f C` ABBREV_TAC ;
16899 TYPE_THEN `(UNIONS (top_of_metric(Y,dY)) = Y) /\ (UNIONS(top_of_metric(Z,dZ)) = Z)` SUBGOAL_TAC;
16900 ASM_SIMP_TAC[GSYM top_of_metric_unions];
16902 TYPE_THEN `Y0 SUBSET Y` SUBGOAL_TAC;
16903 ASM_MESON_TAC [compact;];
16905 WITH 10 (MATCH_MP preimage_restrict);
16906 TYPEL_THEN [`f`;`C`] (USE 11 o ISPECL);
16907 TYPE_THEN `metric_space (Y0,dY)` SUBGOAL_TAC;
16908 IMATCH_MP_TAC metric_subspace;
16911 TYPE_THEN `closed_ (top_of_metric(Y0,dY)) X` SUBGOAL_TAC;
16913 TYPE_THEN `preimage Y0 f C = preimage (UNIONS (top_of_metric(Y0,dY))) f C` SUBGOAL_TAC;
16915 ASM_SIMP_TAC[GSYM top_of_metric_unions];
16916 DISCH_THEN_REWRITE;
16917 IMATCH_MP_TAC preimage_closed;
16918 TYPE_THEN `(top_of_metric (Z,dZ))` EXISTS_TAC;
16920 ASM_SIMP_TAC[GSYM top_of_metric_unions];
16922 TYPE_THEN `~(X = EMPTY)` SUBGOAL_TAC;
16923 REWRITE_TAC[EMPTY_EXISTS;];
16925 REWRITE_TAC[EMPTY_EXISTS];
16928 REWRITE_TAC[IMAGE;INTER];
16930 TYPE_THEN `x` EXISTS_TAC;
16932 REWRITE_TAC[preimage];
16935 (* next X compact in the reals , take inf X, *)
16936 TYPE_THEN `U = top_of_metric(Y,dY)` ABBREV_TAC ;
16937 TYPE_THEN `U0 = top_of_metric(Y0,dY)` ABBREV_TAC ;
16938 TYPE_THEN `U00 = top_of_metric (X,dY)` ABBREV_TAC ;
16939 TYPE_THEN `X SUBSET Y0` SUBGOAL_TAC;
16943 REWRITE_TAC[INTER;SUBSET;];
16946 TYPE_THEN `induced_top U Y0 = U0` SUBGOAL_TAC;
16949 IMATCH_MP_TAC top_of_metric_induced;
16952 TYPE_THEN `UNIONS U = Y` SUBGOAL_TAC;
16954 ASM_SIMP_TAC [GSYM top_of_metric_unions];
16956 TYPE_THEN `compact U0 Y0` SUBGOAL_TAC;
16959 ASM_SIMP_TAC[GSYM induced_compact;];
16962 TYPE_THEN `compact U0 X` SUBGOAL_TAC;
16963 IMATCH_MP_TAC closed_compact;
16964 TYPE_THEN `Y0` EXISTS_TAC;
16968 IMATCH_MP_TAC top_of_metric_top;
16971 (* done WITH compac U0 X *)
16972 TYPE_THEN `induced_top U0 X = U00` SUBGOAL_TAC;
16976 IMATCH_MP_TAC top_of_metric_induced;
16979 TYPE_THEN `compact U00 X` SUBGOAL_TAC;
16981 TYPE_THEN `X SUBSET UNIONS U0` SUBGOAL_TAC;
16984 ASM_SIMP_TAC[GSYM top_of_metric_unions];
16985 ASM_SIMP_TAC[GSYM induced_compact];
16987 TYPE_THEN `induced_top U X = U00` SUBGOAL_TAC;
16992 IMATCH_MP_TAC top_of_metric_induced;
16994 IMATCH_MP_TAC SUBSET_TRANS;
16999 TYPE_THEN `compact (induced_top U X) X = compact U X` SUBGOAL_TAC;
17000 IMATCH_MP_TAC (GSYM induced_compact);
17002 IMATCH_MP_TAC SUBSET_TRANS;
17008 let preimage_compact_interval = prove_by_refinement(
17010 (continuous f (top_of_metric({x | a <= x /\ x <= b},d_real))
17011 (top_of_metric(euclid n,d_euclid)) /\
17012 (IMAGE f {x | a <= x /\ x <= b} SUBSET (euclid n)) /\
17013 (closed_ (top_of_metric(euclid n,d_euclid)) C) /\
17014 ~(IMAGE f {x | a <= x /\ x <= b} INTER C = EMPTY)) ==>
17015 (compact (top_of_metric(UNIV,d_real))
17016 (preimage {x | a <= x /\ x <= b} f C))`,
17020 IMATCH_MP_TAC preimage_compact;
17021 TYPE_THEN `(euclid n)` EXISTS_TAC;
17022 TYPE_THEN `d_euclid` EXISTS_TAC;
17023 ASM_REWRITE_TAC[metric_real;metric_euclid;interval_compact;];
17027 let preimage_first = prove_by_refinement(
17029 (continuous f (top_of_metric({x | a <= x /\ x <= b},d_real))
17030 (top_of_metric(euclid n,d_euclid)) /\
17031 (IMAGE f {x | a <= x /\ x <= b} SUBSET (euclid n)) /\
17032 (closed_ (top_of_metric(euclid n,d_euclid)) C) /\
17033 ~(IMAGE f {x | a <= x /\ x <= b} INTER C = EMPTY)) ==>
17034 (?t. (a <= t /\ t <= b) /\ (C (f t)) /\
17035 (!s. (a <=s /\ s < t) ==> ~(C (f s))))`,
17039 TYPE_THEN `(compact (top_of_metric(UNIV,d_real)) (preimage {x | a <= x /\ x <= b} f C))` SUBGOAL_TAC;
17040 IMATCH_MP_TAC preimage_compact_interval;
17041 TYPE_THEN `n` EXISTS_TAC;
17044 TYPE_THEN `~(preimage {x | a <= x /\ x <= b} f C = EMPTY)` SUBGOAL_TAC;
17046 REWRITE_TAC[EMPTY_EXISTS];
17047 REWRITE_TAC[IMAGE ;INTER;preimage];
17050 TYPE_THEN `X = preimage {x | a <= x /\ x <= b } f C` ABBREV_TAC ;
17051 TYPE_THEN `(?x. (X x) /\ (!y. (X y) ==> (x <= y)))` SUBGOAL_TAC;
17052 IMATCH_MP_TAC compact_inf;
17055 TYPE_THEN `x` EXISTS_TAC;
17059 REWRITE_TAC[preimage];
17072 let inj_subset_domain = prove_by_refinement(
17073 `!s s' t (f:A->B). INJ f s t /\ (s' SUBSET s) ==> INJ f s' t`,
17076 REWRITE_TAC[INJ;SUBSET;];
17081 let arc_restrict = prove_by_refinement(
17082 `!a b c d C f t t'. (c <= t /\ t < t' /\ t' <= d) /\ (a < b) /\
17083 (C = IMAGE f { x | c <= x /\ x <= d }) /\
17084 INJ f {x | c <= x /\ x <= d} (euclid 2) /\
17085 continuous f (top_of_metric(UNIV,d_real))
17086 (top_of_metric(euclid 2,d_euclid)) ==>
17088 (IMAGE g {x | a <= x /\ x <= b} = IMAGE f {x | t <= x /\ x <= t'}) /\
17089 (g a = f t) /\ (g b = f t') /\
17090 INJ g { x | a <= x /\ x <= b} (euclid 2) /\
17091 continuous g (top_of_metric(UNIV,d_real))
17092 (top_of_metric(euclid 2,d_euclid)))`,
17097 TYPE_THEN ` continuous f (top_of_metric (UNIV,d_real)) (top2) /\ INJ f {x | t <= x /\ x <= t'} (euclid 2) /\ (a < b) /\ (t < t')` SUBGOAL_TAC;
17098 ASM_REWRITE_TAC[top2];
17099 IMATCH_MP_TAC inj_subset_domain;
17100 TYPE_THEN `{x | c <= x /\ x <= d}` EXISTS_TAC;
17102 REWRITE_TAC[SUBSET;];
17107 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
17109 TYPE_THEN `g` EXISTS_TAC;
17111 ASM_MESON_TAC[top2];
17116 let continuous_induced_domain = prove_by_refinement(
17117 `!(f:A->B) U V K. (continuous f U V) /\ (K SUBSET (UNIONS U)) ==>
17118 (continuous f (induced_top U K) V)`,
17121 REWRITE_TAC[continuous;induced_top_support;];
17122 REWRITE_TAC[preimage;induced_top];
17124 REWRITE_TAC[IMAGE];
17125 TYPE_THEN `{x | UNIONS U x /\ v (f x)}` EXISTS_TAC;
17127 REWRITE_TAC[INTER];
17128 IMATCH_MP_TAC EQ_EXT;
17134 let inj_split = prove_by_refinement(
17135 `!A B Z (f:A->B). (INJ f A Z) /\ (INJ f B Z) /\
17136 (IMAGE f A INTER IMAGE f B = EMPTY) ==> (INJ f (A UNION B) Z)`,
17139 REWRITE_TAC[INJ;INTER;IMAGE;UNION;];
17149 FIRST_ASSUM IMATCH_MP_TAC ;
17152 REWRITE_TAC[EQ_EMPTY];
17156 USE 0 (REWRITE_RULE[DE_MORGAN_THM]);
17158 USE 0 (REWRITE_RULE[EQ_EMPTY]);
17162 FIRST_ASSUM IMATCH_MP_TAC ;
17167 let joinf_inj_below = prove_by_refinement(
17168 `!(f:real->B) g a A.
17169 (A SUBSET {x | x < a}) ==> (INJ (joinf f g a) A = INJ f A)`,
17172 REWRITE_TAC[SUBSET];
17174 IMATCH_MP_TAC EQ_EXT;
17177 TYPE_THEN `!z. A z ==> (joinf f g a z = f z)` SUBGOAL_TAC;
17179 REWRITE_TAC[joinf];
17188 let joinf_inj_above = prove_by_refinement(
17189 `!(f:real->B) g a A.
17190 (A SUBSET {x | a <= x}) ==> (INJ (joinf f g a) A = INJ g A)`,
17193 REWRITE_TAC[SUBSET];
17195 IMATCH_MP_TAC EQ_EXT;
17198 TYPE_THEN `!z. A z ==> (joinf f g a z = g z)` SUBGOAL_TAC;
17200 REWRITE_TAC[joinf];
17203 ASM_REWRITE_TAC[REAL_ARITH ` (z < a) <=> ~(a <= z) `];
17209 let joinf_image_below = prove_by_refinement(
17210 `!(f:real->B) g a A.
17211 (A SUBSET {x | x < a}) ==> (IMAGE (joinf f g a) A = IMAGE f A)`,
17214 REWRITE_TAC[SUBSET];
17216 IMATCH_MP_TAC EQ_EXT;
17217 REWRITE_TAC[IMAGE];
17219 TYPE_THEN `!z. A z ==> (joinf f g a z = f z)` SUBGOAL_TAC;
17221 REWRITE_TAC[joinf];
17230 let joinf_image_above = prove_by_refinement(
17231 `!(f:real->B) g a A.
17232 (A SUBSET {x | a <= x}) ==> (IMAGE (joinf f g a) A = IMAGE g A)`,
17236 REWRITE_TAC[SUBSET];
17238 IMATCH_MP_TAC EQ_EXT;
17239 REWRITE_TAC[IMAGE];
17241 TYPE_THEN `!z. A z ==> (joinf f g a z = g z)` SUBGOAL_TAC;
17243 REWRITE_TAC[joinf];
17246 ASM_REWRITE_TAC[REAL_ARITH ` (z < a) <=> ~(a <= z) `];
17253 let pconn_trans = prove_by_refinement(
17254 `!A x y z. (p_conn A x y /\ p_conn A y z ==> p_conn A x z)`,
17257 REWRITE_TAC[p_conn;simple_polygonal_arc;simple_arc;];
17259 TYPE_THEN `C' x` ASM_CASES_TAC;
17260 TYPE_THEN `C'` EXISTS_TAC;
17263 TYPE_THEN `f'` EXISTS_TAC;
17266 TYPE_THEN `~(x = y)` SUBGOAL_TAC;
17267 PROOF_BY_CONTR_TAC;
17271 TYPE_THEN `C z` ASM_CASES_TAC;
17272 TYPE_THEN `C` EXISTS_TAC;
17275 TYPE_THEN `f` EXISTS_TAC;
17278 TYPE_THEN `~(z = y)` SUBGOAL_TAC;
17281 (* now ~( z = y) *)
17282 TYPE_THEN `?tx. (&0 <= tx) /\ (tx <= &1) /\ (f tx = x)` SUBGOAL_TAC;
17284 ASM_REWRITE_TAC[IMAGE;];
17288 TYPE_THEN `?ty. (&0 <= ty) /\ (ty <= &1) /\ (f ty = y)` SUBGOAL_TAC;
17290 ASM_REWRITE_TAC[IMAGE;];
17294 TYPE_THEN `~(tx = ty)` SUBGOAL_TAC;
17297 (* reparameter C *)
17298 TYPE_THEN `?g. (g (&0) = x) /\ (g (&1) = y) /\ INJ g { x | &0 <= x /\ x <= &1 } (euclid 2) /\ continuous g (top_of_metric(UNIV,d_real)) (top_of_metric(euclid 2,d_euclid)) /\ IMAGE g { x | &0 <= x /\ x <= &1 } SUBSET C` SUBGOAL_TAC;
17299 TYPE_THEN `(tx < ty) \/ (ty < tx)` SUBGOAL_TAC;
17302 DISCH_THEN DISJ_CASES_TAC;
17303 TYPE_THEN `(?g. (IMAGE g {x | &0 <= x /\ x <= &1} = IMAGE f {x | tx <= x /\ x <= ty}) /\ (g (&0) = f tx) /\ (g (&1) = f ty) /\ INJ g { x | &0 <= x /\ x <= &1 } (euclid 2) /\ continuous g (top_of_metric(UNIV,d_real)) (top_of_metric(euclid 2,d_euclid)))` SUBGOAL_TAC;
17304 IMATCH_MP_TAC arc_restrict;
17305 TYPE_THEN `&0` EXISTS_TAC;
17306 TYPE_THEN `&1` EXISTS_TAC;
17307 TYPE_THEN `C` EXISTS_TAC;
17308 ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`;];
17310 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17312 TYPE_THEN `g` EXISTS_TAC;
17314 IMATCH_MP_TAC IMAGE_SUBSET;
17315 REWRITE_TAC[SUBSET];
17320 TYPE_THEN `(?g. (IMAGE g {x | &0 <= x /\ x <= &1} = IMAGE f {x | ty <= x /\ x <= tx}) /\ (g (&0) = f ty) /\ (g (&1) = f tx) /\ INJ g { x | &0 <= x /\ x <= &1 } (euclid 2) /\ continuous g (top_of_metric(UNIV,d_real)) (top_of_metric(euclid 2,d_euclid)))` SUBGOAL_TAC;
17321 IMATCH_MP_TAC arc_restrict;
17322 TYPE_THEN `&0` EXISTS_TAC;
17323 TYPE_THEN `&1` EXISTS_TAC;
17324 TYPE_THEN `C` EXISTS_TAC;
17325 ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`;];
17327 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17329 (* REVERSE reparameter on C XX0 *)
17330 TYPE_THEN `(?g'. continuous g' (top_of_metric (UNIV,d_real)) (top2) /\ INJ g' {x | (&0) <= x /\ x <= (&1)} (euclid 2) /\ (g (&1) = g' (&0)) /\ (g (&0) = g' (&1)) /\ (!x y x' y'. (g x = g' x') /\ (g y = g' y') /\ ((&0) <= x /\ x <= (&1)) /\ ((&0) <= y /\ y <= (&1)) /\ ((&0) <= x' /\ x' <= (&1)) /\ ((&0) <= y' /\ y' <= (&1)) ==> ((x < y) <=> (y' < x'))) /\ (IMAGE g { x | (&0) <= x /\ x <= (&1) } = IMAGE g' { x | (&0) <= x /\ x <= (&1) } ))` SUBGOAL_TAC;
17331 IMATCH_MP_TAC arc_reparameter_rev;
17332 ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`;top2;];
17334 TYPE_THEN `g'` EXISTS_TAC;
17337 ASM_MESON_TAC[]; (* L80 *)
17341 ASM_MESON_TAC[top2];
17342 TYPE_THEN `IMAGE g' {x | &0 <= x /\ x <= &1} = IMAGE f {x | ty <= x /\ x <= tx }` SUBGOAL_TAC;
17347 DISCH_THEN_REWRITE;
17348 IMATCH_MP_TAC IMAGE_SUBSET;
17349 REWRITE_TAC[SUBSET];
17354 (* now restrict C to [x,y'] *)
17356 TYPE_THEN `Cg = IMAGE g {x | &0 <= x /\ x <= &1 }` ABBREV_TAC ;
17357 TYPE_THEN `Z = Cg INTER C'` ABBREV_TAC ;
17358 TYPE_THEN `?t'. (&0 <= t' /\ t' <= &1) /\ (Z (g t')) /\ (!s. (&0 <=s /\ s < t') ==> ~(Z (g s)))` SUBGOAL_TAC;
17359 IMATCH_MP_TAC preimage_first;
17361 (* restriction conditions *)
17363 TYPE_THEN `induced_top(top_of_metric(UNIV,d_real)) {x | &0 <= x /\ x <= &1 } = top_of_metric ({x | &0 <= x /\ x <= &1 },d_real)` SUBGOAL_TAC;
17364 ASM_SIMP_TAC[SUBSET_UNIV;metric_real;top_of_metric_induced];
17365 DISCH_THEN (fun t -> REWRITE_TAC[GSYM t]);
17366 IMATCH_MP_TAC continuous_induced_domain;
17368 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real];
17371 REWRITE_TAC[INJ;IMAGE;SUBSET;];
17376 TYPE_THEN `!C. (?f a b. (continuous f (top_of_metric(UNIV,d_real)) (top2)) /\ (INJ f {x | a <= x /\ x <= b} (euclid 2)) /\ (IMAGE f {x | a <= x /\ x <= b} = C)) ==> (closed_ top2 C)` SUBGOAL_TAC;
17378 IMATCH_MP_TAC compact_closed;
17379 ASM_SIMP_TAC[top2;metric_hausdorff;metric_euclid];
17380 ASM_SIMP_TAC[top_of_metric_top;metric_euclid];
17382 IMATCH_MP_TAC image_compact;
17383 TYPE_THEN `(top_of_metric(UNIV,d_real))` EXISTS_TAC;
17384 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid;interval_compact];
17385 ASM_SIMP_TAC[GSYM top2];
17388 REWRITE_TAC[INJ;IMAGE;SUBSET];
17391 REWRITE_TAC[GSYM top2];
17393 IMATCH_MP_TAC closed_inter2;
17394 REWRITE_TAC[top2_top];
17396 FIRST_ASSUM IMATCH_MP_TAC ;
17397 TYPE_THEN `g` EXISTS_TAC;
17398 TYPE_THEN `&0` EXISTS_TAC;
17399 TYPE_THEN `&1` EXISTS_TAC;
17400 ASM_REWRITE_TAC[]; (* XX2 *)
17401 ASM_SIMP_TAC[top2];
17402 FIRST_ASSUM IMATCH_MP_TAC ;
17403 TYPE_THEN `f'` EXISTS_TAC;
17404 TYPE_THEN `&0` EXISTS_TAC;
17405 TYPE_THEN `&1` EXISTS_TAC;
17407 ASM_SIMP_TAC[top2];
17409 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17411 REWRITE_TAC[EMPTY_EXISTS;INTER;IMAGE];
17412 CONV_TAC (dropq_conv "u");
17413 TYPE_THEN `&1` EXISTS_TAC;
17415 ASM_REWRITE_TAC[IMAGE;];
17416 REPEAT (CONJ_TAC THEN (TRY (REAL_ARITH_TAC)));
17417 EXPAND_TAC "Cg"; (* L160 *)
17418 (remark "LINE 160"; ALL_TAC);
17419 REWRITE_TAC[IMAGE];
17420 TYPE_THEN `&1` EXISTS_TAC;
17421 REPEAT (CONJ_TAC THEN (TRY (REAL_ARITH_TAC)));
17424 ASM_REWRITE_TAC[IMAGE];
17426 TYPE_THEN `(t' = &0) \/ (&0 < t')` SUBGOAL_TAC;
17430 DISCH_THEN DISJ_CASES_TAC;
17433 REWRITE_TAC[INTER];
17435 (* ** START ON 2nd BRANCH ** *** ** *)
17437 TYPE_THEN `?tz. (&0 <= tz) /\ (tz <= &1) /\ (f' tz = z)` SUBGOAL_TAC;
17439 ASM_REWRITE_TAC[IMAGE;];
17440 DISCH_THEN (CHOOSE_THEN MP_TAC);
17442 TYPE_THEN `x'` EXISTS_TAC;
17445 TYPE_THEN `?t''. (&0 <= t'') /\ (t'' <= &1) /\ (f' t'' = g t')` SUBGOAL_TAC;
17448 REWRITE_TAC[INTER];
17449 ASM_REWRITE_TAC[IMAGE;];
17450 DISCH_THEN (fun t-> MP_TAC (CONJUNCT2 t));
17453 TYPE_THEN `~(tz = t'')` SUBGOAL_TAC;
17454 PROOF_BY_CONTR_TAC;
17455 TYPE_THEN `C (g t')` SUBGOAL_TAC;
17458 REWRITE_TAC[INTER];
17460 REWRITE_TAC[SUBSET];
17464 (* reparam on C' *)
17465 TYPE_THEN `?h. (h (&1/(&2)) = g t') /\ (h (&1) = z) /\ INJ h { x | &1/(&2) <= x /\ x <= &1 } (euclid 2) /\ continuous h (top_of_metric(UNIV,d_real)) (top_of_metric(euclid 2,d_euclid)) /\ IMAGE h { x | &1/(&2) <= x /\ x <= &1 } SUBSET C'` SUBGOAL_TAC;
17466 TYPE_THEN `(t'' < tz) \/ (tz < t'')` SUBGOAL_TAC;
17469 DISCH_THEN DISJ_CASES_TAC;
17470 TYPE_THEN `(?h. (IMAGE h {x | &1/(&2) <= x /\ x <= &1} = IMAGE f' {x | t'' <= x /\ x <= tz}) /\ (h (&1/(&2)) = f' t'') /\ (h (&1) = f' tz) /\ INJ h { x | &1/(&2) <= x /\ x <= &1 } (euclid 2) /\ continuous h (top_of_metric(UNIV,d_real)) (top_of_metric(euclid 2,d_euclid)))` SUBGOAL_TAC;
17471 IMATCH_MP_TAC arc_restrict;
17472 TYPE_THEN `&0` EXISTS_TAC;
17473 TYPE_THEN `&1` EXISTS_TAC;
17474 TYPE_THEN `C'` EXISTS_TAC;
17477 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17479 REWRITE_TAC[REAL_LT_HALF2];
17482 TYPE_THEN `h` EXISTS_TAC;
17484 IMATCH_MP_TAC IMAGE_SUBSET;
17485 REWRITE_TAC[SUBSET];
17490 TYPE_THEN `(?h. (IMAGE h {x | &1/(&2) <= x /\ x <= &1} = IMAGE f' {x | tz <= x /\ x <= t'' }) /\ (h (&1/(&2)) = f' tz) /\ (h (&1) = f' t'') /\ INJ h { x | &1/(&2) <= x /\ x <= &1 } (euclid 2) /\ continuous h (top_of_metric(UNIV,d_real)) (top_of_metric(euclid 2,d_euclid)))` SUBGOAL_TAC;
17491 IMATCH_MP_TAC arc_restrict;
17492 TYPE_THEN `&0` EXISTS_TAC;
17493 TYPE_THEN `&1` EXISTS_TAC;
17494 TYPE_THEN `C'` EXISTS_TAC;
17495 ASM_REWRITE_TAC[REAL_LT_HALF2;REAL_ARITH `&0 < &1`];
17497 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17498 REP_BASIC_TAC; (* L240 *)
17499 (remark "LINE 240"; ALL_TAC);
17500 (* REVERSE reparameter on C *)
17501 TYPE_THEN `(?h'. continuous h' (top_of_metric (UNIV,d_real)) (top2) /\ INJ h' {x | (&1/(&2)) <= x /\ x <= (&1)} (euclid 2) /\ (h (&1) = h' (&1/(&2))) /\ (h (&1/(&2)) = h' (&1)) /\ (!x y x' y'. (h x = h' x') /\ (h y = h' y') /\ ((&1/(&2)) <= x /\ x <= (&1)) /\ ((&1/(&2)) <= y /\ y <= (&1)) /\ ((&1/(&2)) <= x' /\ x' <= (&1)) /\ ((&1/(&2)) <= y' /\ y' <= (&1)) ==> ((x < y) <=> (y' < x'))) /\ (IMAGE h { x | (&1/(&2)) <= x /\ x <= (&1) } = IMAGE h' { x | (&1/(&2)) <= x /\ x <= (&1) } ))` SUBGOAL_TAC;
17502 IMATCH_MP_TAC arc_reparameter_rev;
17503 ASM_REWRITE_TAC[REAL_LT_HALF2;REAL_ARITH `&0 < &1`;top2;];
17505 TYPE_THEN `h'` EXISTS_TAC;
17512 ASM_MESON_TAC[top2];
17513 TYPE_THEN `IMAGE h' {x | &1/(&2) <= x /\ x <= &1} = IMAGE f' {x | tz <= x /\ x <= t'' }` SUBGOAL_TAC;
17518 DISCH_THEN_REWRITE;
17519 IMATCH_MP_TAC IMAGE_SUBSET;
17520 REWRITE_TAC[SUBSET];
17525 (* reparam g [0,1/2] *)
17527 TYPE_THEN `?g'. ((g' (&0)) = x) /\ (g' (&1/(&2)) = g t') /\ INJ g' { x | &0 <= x /\ x <= &1/(&2) } (euclid 2) /\ continuous g' (top_of_metric(UNIV,d_real)) (top_of_metric(euclid 2,d_euclid)) /\ (IMAGE g' { x | &0 <= x /\ x <= &1/(&2) } = IMAGE g {x | &0 <= x /\ x <= t'}) ` SUBGOAL_TAC; (* was SUBSET Cg *)
17528 ASSUME_TAC arc_reparameter_gen;
17529 TYPEL_THEN [`g`;`&0`;`&1/(&2)`;`&0`;`t'`] (fun t-> FIRST_ASSUM (fun s-> (MP_TAC (ISPECL t s))));
17531 ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`;REAL_LT_HALF1;];
17534 DISCH_THEN_REWRITE;
17535 TYPE_THEN `INJ g {x | &0 <= x /\ x <= t'} (euclid 2)` SUBGOAL_TAC;
17536 IMATCH_MP_TAC inj_subset_domain;
17537 TYPE_THEN `{x | &0 <= x /\ x <= &1 }` EXISTS_TAC;
17539 REWRITE_TAC[SUBSET];
17542 DISCH_THEN_REWRITE;
17544 TYPE_THEN `g'` EXISTS_TAC;
17546 (* deleted lines here *)
17548 TYPE_THEN `fm = joinf g' h (&1/(&2))` ABBREV_TAC ;
17549 TYPE_THEN `Cm = IMAGE fm {x | &0 <= x /\ x <= &1}` ABBREV_TAC ;
17550 TYPE_THEN `Cm` EXISTS_TAC;
17551 (* final instantiation *)
17553 REPEAT (IMATCH_MP_TAC (TAUT `A /\ B/\ C ==> (A /\ B) /\C`));
17555 TYPE_THEN `fm` EXISTS_TAC;
17559 IMATCH_MP_TAC joinf_cont;
17561 TYPE_THEN `{x | &0 <= x /\ x <= &1} = {x | &0 <= x /\ x < &1/(&2)} UNION {x | &1/(&2) <= x /\ x <= &1 }` SUBGOAL_TAC;
17562 IMATCH_MP_TAC EQ_EXT;
17563 REWRITE_TAC[UNION];
17565 TYPE_THEN `&0 < &1/(&2) /\ (&1/(&2) < &1)` SUBGOAL_TAC;
17566 REWRITE_TAC[REAL_LT_HALF1;REAL_LT_HALF2;REAL_ARITH `&0 < &1`];
17568 DISCH_THEN_REWRITE;
17569 IMATCH_MP_TAC inj_split;
17571 TYPE_THEN `{x | &0 <= x /\ x < &1/(&2)} SUBSET {x | x < &1/(&2)} /\ {x | &1/(&2) <= x /\ x <= &1} SUBSET {x | &1/(&2) <= x}` SUBGOAL_TAC;
17572 REWRITE_TAC[SUBSET];
17575 ASM_SIMP_TAC[joinf_inj_above;joinf_inj_below;joinf_image_above;joinf_image_below];
17579 IMATCH_MP_TAC inj_subset_domain; (* L320 *)
17580 (remark "LINE 320"; ALL_TAC);
17581 TYPE_THEN `{x | &0 <= x /\ x <= &1/(&2) }` EXISTS_TAC;
17582 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17583 REWRITE_TAC[SUBSET];
17586 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17588 TYPE_THEN `IMAGE g' { x | &0 <= x /\ x <= &1/(&2)} INTER IMAGE h {x | &1/(&2) <= x /\ x <= &1} SUBSET {(g t')}` SUBGOAL_TAC;
17590 TYPE_THEN `IMAGE g { x | &0 <= x /\ x <= t' } SUBSET Cg` SUBGOAL_TAC;
17592 IMATCH_MP_TAC IMAGE_SUBSET;
17593 REWRITE_TAC[SUBSET];
17597 IMATCH_MP_TAC SUBSET_TRANS;
17598 TYPE_THEN `IMAGE g {x | &0 <= x /\ x <= t'} INTER Z` EXISTS_TAC;
17603 REWRITE_TAC[SUBSET;INTER];
17605 POP_ASSUM_LIST (fun t-> ALL_TAC);
17609 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC ) THEN ASM_REWRITE_TAC[];
17611 REWRITE_TAC[INTER;SUBSET;IMAGE];
17613 POP_ASSUM_LIST (fun t-> ALL_TAC);
17615 REWRITE_TAC[INR IN_SING];
17619 TYPE_THEN `(x' = t') \/ (x' < t')` SUBGOAL_TAC;
17622 DISCH_THEN DISJ_CASES_TAC;
17626 PROOF_BY_CONTR_TAC;
17627 USE 61 (REWRITE_RULE[EMPTY_EXISTS ]);
17629 TYPE_THEN `!B' B (u:num->real). (B' u /\ B' SUBSET B) ==> (B u)` SUBGOAL_TAC;
17630 MESON_TAC[ISUBSET];
17632 TYPE_THEN `{(g t')} u` SUBGOAL_TAC;
17633 FIRST_ASSUM IMATCH_MP_TAC ;
17634 TYPE_THEN `(IMAGE g' {x | &0 <= x /\ x < &1 / &2} INTER IMAGE h {x | &1 / &2 <= x /\ x <= &1})` EXISTS_TAC;
17636 IMATCH_MP_TAC SUBSET_TRANS;
17637 TYPE_THEN `(IMAGE g' {x | &0 <= x /\ x <= &1 / &2} INTER IMAGE h {x | &1 / &2 <= x /\ x <= &1})` EXISTS_TAC;
17639 REWRITE_TAC[INTER;SUBSET;IMAGE];
17640 MESON_TAC[REAL_ARITH `x < t ==> x <= t`];
17642 REWRITE_TAC[INR IN_SING];
17646 REWRITE_TAC[INTER;IMAGE;DE_MORGAN_THM;];
17651 POP_ASSUM_LIST (fun t-> ALL_TAC);
17654 USE 1(REWRITE_RULE [REAL_ARITH `(x < &1/(&2)) <=> (x <= &1/(&2) /\ ~(x = &1/(&2)))`]);
17655 TYPEL_THEN [`x`;`&1/(&2)`] (USE 3 o ISPECL);
17656 TYPE_THEN `&0 <= &1/ &2 /\ &1/ &2 <= &1/ (&2)` SUBGOAL_TAC;
17657 REWRITE_TAC[REAL_ARITH `x <= x`];
17658 IMATCH_MP_TAC REAL_LE_DIV;
17661 (* Now E *) (* L400 *)
17662 (remark "LINE 400"; ALL_TAC);
17664 TYPE_THEN ` {x | &0 <= x /\ x <= &1} = {x | &0 <= x /\ x < &1/(&2)} UNION {x | &1/(&2) <= x /\ x <= &1 }` SUBGOAL_TAC;
17665 IMATCH_MP_TAC EQ_EXT;
17666 REWRITE_TAC[UNION];
17668 TYPE_THEN `&0 < &1/(&2) /\ (&1/(&2) < &1)` SUBGOAL_TAC;
17669 REWRITE_TAC[REAL_LT_HALF1;REAL_LT_HALF2;REAL_ARITH `&0 < &1`];
17672 DISCH_THEN_REWRITE;
17673 REWRITE_TAC[IMAGE_UNION];
17674 TYPE_THEN `{x | &0 <= x /\ x < &1/(&2)} SUBSET {x | x < &1/(&2)} /\ {x | &1/(&2) <= x /\ x <= &1} SUBSET {x | &1/(&2) <= x}` SUBGOAL_TAC;
17675 REWRITE_TAC[SUBSET];
17679 ASM_SIMP_TAC[joinf_image_above;joinf_image_below];
17681 TYPE_THEN `(IMAGE g' {x | &0 <= x /\ x < &1 / &2} UNION IMAGE h {x | &1 / &2 <= x /\ x <= &1}) z` SUBGOAL_TAC;
17683 REWRITE_TAC[UNION;IMAGE];
17684 POP_ASSUM_LIST (fun t->ALL_TAC);
17687 TYPE_THEN `&1` EXISTS_TAC;
17689 REWRITE_TAC[REAL_ARITH `&1 <= &1`];
17690 IMATCH_MP_TAC REAL_LE_LDIV;
17692 DISCH_THEN_REWRITE;
17693 TYPE_THEN `(IMAGE g' {x | &0 <= x /\ x < &1 / &2} UNION IMAGE h {x | &1 / &2 <= x /\ x <= &1}) x` SUBGOAL_TAC;
17695 REWRITE_TAC[UNION;IMAGE];
17696 POP_ASSUM_LIST (fun t->ALL_TAC);
17699 TYPE_THEN `&0` EXISTS_TAC;
17701 REWRITE_TAC[REAL_ARITH `&0 <= &0`];
17702 REWRITE_TAC[REAL_LT_HALF1];
17704 DISCH_THEN_REWRITE;
17707 TYPE_THEN `IMAGE g' {x | &0 <= x /\ x < &1/ &2} SUBSET C` SUBGOAL_TAC;
17708 IMATCH_MP_TAC SUBSET_TRANS;
17709 TYPE_THEN `Cg ` EXISTS_TAC;
17711 IMATCH_MP_TAC SUBSET_TRANS;
17713 TYPE_THEN `IMAGE g {x | &0 <= x /\ x <= t'}` EXISTS_TAC;
17717 REWRITE_TAC[IMAGE;SUBSET];
17718 MESON_TAC[REAL_ARITH `x < t ==> x <= t`];
17719 REWRITE_TAC[IMAGE;SUBSET];
17721 MESON_TAC[REAL_ARITH `t' <= &1 ==> (x <= t' ==> x<= &1)`];
17722 TYPE_THEN `GCG = IMAGE g' {x | &0 <= x /\ x < &1 / &2}` ABBREV_TAC ;
17723 TYPE_THEN `HCH = IMAGE h {x | &1 / &2 <= x /\ x <= &1}` ABBREV_TAC ;
17732 POP_ASSUM_LIST (fun t->ALL_TAC);
17735 TYPE_THEN `E UNION E'` EXISTS_TAC;
17737 REWRITE_TAC[UNIONS_UNION];
17738 REWRITE_TAC[union_subset];
17742 REWRITE_TAC[UNION;SUBSET]; (* L480 *)
17743 (remark "LINE 480"; ALL_TAC);
17747 REWRITE_TAC[UNION;SUBSET];
17750 ASM_REWRITE_TAC[FINITE_UNION];
17753 REWRITE_TAC[hv_line;UNION;];
17759 REWRITE_TAC[SUBSET;UNION;];
17764 (* ------------------------------------------------------------------ *)
17766 (* ------------------------------------------------------------------ *)
17769 (* Conclusion of Jordan Curve, page 1 *)
17771 let v_simple_polygonal = prove_by_refinement(
17772 `!x e. (euclid 2 x) /\ (~(e = &0)) ==>
17773 (simple_polygonal_arc hv_line (mk_segment x (x + e *# e2)))`,
17777 REWRITE_TAC[simple_polygonal_arc;hv_line;simple_arc ];
17780 ASSUME_TAC mk_segment_inj_image;
17781 TYPEL_THEN [`x`;`x + (e *# e2)`;`2`] (USE 2 o ISPECL);
17782 TYPE_THEN `euclid 2 x /\ euclid 2 (euclid_plus x (e *# e2)) /\ ~(x = euclid_plus x (e *# e2))` SUBGOAL_TAC;
17785 IMATCH_MP_TAC euclid_add_closure;
17787 IMATCH_MP_TAC euclid_scale_closure;
17788 REWRITE_TAC [e2;euclid_point];
17790 FIRST_ASSUM (fun t-> MP_TAC (AP_THM t `1`));
17791 REWRITE_TAC[euclid_plus;euclid_scale;e2;coord01];
17797 TYPE_THEN `f` EXISTS_TAC;
17799 SIMP_TAC [GSYM top_of_metric_unions;metric_euclid];
17802 USE 1 (MATCH_MP point_onto);
17804 TYPE_THEN `{(mk_line (point p) (point p + (e *# e2)))}` EXISTS_TAC;
17805 REWRITE_TAC[INR IN_SING];
17807 REWRITE_TAC[e2;ISUBSET;mk_segment;mk_line];
17809 TYPE_THEN `a` EXISTS_TAC;
17812 REWRITE_TAC[FINITE_SING];
17815 TYPE_THEN `p` EXISTS_TAC;
17816 TYPE_THEN `(FST p , SND p + e)` EXISTS_TAC;
17819 REWRITE_TAC[e2;point_scale];
17821 TYPE_THEN `euclid_plus (point p) (point (&0,e)) = euclid_plus (point (FST p,SND p)) (point (&0,e))` SUBGOAL_TAC;
17823 DISCH_THEN (fun t-> PURE_ONCE_REWRITE_TAC[t]);
17824 REWRITE_TAC[point_add];
17830 let p_conn_ball = prove_by_refinement(
17831 `! x y r. (open_ball(euclid 2,d_euclid) x r y) ==>
17832 (p_conn (open_ball(euclid 2,d_euclid) x r) x y)`,
17837 TYPE_THEN `open_ball (euclid 2,d_euclid) x r x` SUBGOAL_TAC;
17838 SIMP_TAC [metric_euclid;INR open_ball_nonempty_center];
17839 REWRITE_TAC[EMPTY_EXISTS];
17843 TYPE_THEN `euclid 2 x /\ euclid 2 y` SUBGOAL_TAC;
17844 RULE_ASSUM_TAC (REWRITE_RULE[open_ball]);
17847 RULE_ASSUM_TAC (fun t -> try (MATCH_MP point_onto t) with Failure _ -> t);
17850 TYPE_THEN `y' = point(FST p,SND p')` ABBREV_TAC ;
17851 TYPE_THEN `A = open_ball(euclid 2,d_euclid) x r` ABBREV_TAC ;
17853 TYPE_THEN `y' = euclid_plus x ((SND p' - SND p) *# e2)` SUBGOAL_TAC;
17857 REWRITE_TAC[point_add;point_scale;];
17859 PURE_ONCE_REWRITE_TAC [GSYM PAIR];
17860 PURE_REWRITE_TAC [point_add];
17864 REWRITE_TAC[PAIR_SPLIT];
17868 TYPE_THEN `A y'` SUBGOAL_TAC;
17874 ASM_REWRITE_TAC[open_ball;euclid_point;d_euclid_point;];
17875 REWRITE_TAC[REAL_ARITH `(x - x = &0)`;POW_0;ARITH_RULE `2 = SUC 1`];
17876 IMATCH_MP_TAC (REAL_ARITH `(x <= y) ==> (y < r ==> x < r)`);
17877 IMATCH_MP_TAC SQRT_MONO_LE;
17878 REWRITE_TAC[REAL_ARITH `&0 + x = x`;ARITH_RULE `SUC 1 = 2`;REAL_PROP_NN_SQUARE];
17879 IMATCH_MP_TAC (REAL_ARITH `&0 <= x ==> (y <= x + y)`);
17880 REWRITE_TAC[REAL_PROP_NN_SQUARE];
17883 TYPE_THEN `p_conn A x y'` SUBGOAL_TAC;
17884 TYPE_THEN `x = y'` ASM_CASES_TAC;
17886 IMATCH_MP_TAC pconn_refl;
17887 REWRITE_TAC[p_conn];
17891 IMATCH_MP_TAC open_ball_open;
17892 MESON_TAC[metric_euclid];
17894 REWRITE_TAC[p_conn];
17895 TYPE_THEN `mk_segment x y'` EXISTS_TAC;
17898 DISCH_THEN_REWRITE;
17899 IMATCH_MP_TAC v_simple_polygonal;
17900 ASM_REWRITE_TAC[euclid_point];
17901 REWRITE_TAC[REAL_SUB_0];
17907 ASM_MESON_TAC[PAIR];
17910 IMATCH_MP_TAC openball_mk_segment_end;
17912 REWRITE_TAC[mk_segment_end];
17915 TYPE_THEN `y' = euclid_plus y ((FST p - FST p') *# e1)` SUBGOAL_TAC;
17920 REWRITE_TAC[point_add;point_scale;];
17922 PURE_ONCE_REWRITE_TAC [GSYM PAIR];
17923 PURE_REWRITE_TAC [point_add];
17927 REWRITE_TAC[PAIR_SPLIT];
17931 TYPE_THEN `p_conn A y y'` SUBGOAL_TAC;
17932 TYPE_THEN `y = y'` ASM_CASES_TAC;
17934 IMATCH_MP_TAC pconn_refl;
17938 IMATCH_MP_TAC open_ball_open;
17939 MESON_TAC[metric_euclid];
17941 REWRITE_TAC[p_conn];
17942 TYPE_THEN `mk_segment y y'` EXISTS_TAC;
17945 DISCH_THEN_REWRITE;
17946 IMATCH_MP_TAC h_simple_polygonal;
17947 ASM_REWRITE_TAC[euclid_point];
17948 REWRITE_TAC[REAL_SUB_0];
17955 ASM_MESON_TAC[PAIR];
17958 IMATCH_MP_TAC openball_mk_segment_end;
17960 REWRITE_TAC[mk_segment_end];
17962 IMATCH_MP_TAC pconn_trans;
17963 TYPE_THEN `y'` EXISTS_TAC;
17965 DISCH_THEN_REWRITE;
17967 MESON_TAC[pconn_symm];
17968 (* Wed Aug 4 10:40:05 EDT 2004 *)
17974 let p_conn_euclid = prove_by_refinement(
17975 `!A x. p_conn A x SUBSET (euclid 2)`,
17978 REWRITE_TAC[SUBSET;p_conn;simple_polygonal_arc;simple_arc;];
17983 SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
17984 REWRITE_TAC[INJ;IMAGE];
17986 (* Wed Aug 4 10:55:53 EDT 2004 *)
17990 let p_connA = prove_by_refinement(
17991 `!A x. p_conn A x SUBSET A`,
17995 REWRITE_TAC[p_conn;SUBSET;];
17997 (* Wed Aug 4 11:11:21 EDT 2004 *)
18001 let p_conn_open = prove_by_refinement(
18002 `!A x. top2 A ==> (top2 (p_conn A x))`,
18005 (* Wed Aug 4 10:43:29 EDT 2004 *)
18007 ASM_SIMP_TAC[top2;top_of_metric_nbd;metric_euclid;p_conn_euclid];
18010 TYPE_THEN `A a` SUBGOAL_TAC;
18011 ASM_MESON_TAC[p_connA;ISUBSET];
18014 TYPE_THEN `?r. (&0 < r) /\ open_ball (euclid 2,d_euclid) a r SUBSET A` SUBGOAL_TAC;
18015 ASM_MESON_TAC[metric_euclid;top2;open_ball_nbd;];
18017 TYPE_THEN `r` EXISTS_TAC;
18018 ASM_REWRITE_TAC[SUBSET;];
18020 IMATCH_MP_TAC pconn_trans;
18021 TYPE_THEN `a` EXISTS_TAC;
18023 IMATCH_MP_TAC p_conn_subset;
18024 TYPE_THEN `open_ball (euclid 2,d_euclid) a r` EXISTS_TAC;
18026 IMATCH_MP_TAC p_conn_ball;
18028 (* Wed Aug 4 11:21:18 EDT 2004 *)
18032 let p_conn_diff = prove_by_refinement(
18033 `!A x. top2 A ==> (top2 (A DIFF (p_conn A x)))`,
18037 SIMP_TAC[top2;metric_euclid;top_of_metric_nbd];
18039 IMATCH_MP_TAC SUBSET_TRANS;
18040 TYPE_THEN `A` EXISTS_TAC;
18041 REWRITE_TAC[SUBSET_DIFF];
18043 REWRITE_TAC[top2;];
18045 FIRST_ASSUM (fun t-> ASSUME_TAC (MATCH_MP sub_union t));
18047 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
18049 RULE_ASSUM_TAC (REWRITE_RULE[DIFF]);
18052 TYPE_THEN `?r. (&0 < r) /\ open_ball (euclid 2,d_euclid) a r SUBSET A` SUBGOAL_TAC;
18053 ASM_MESON_TAC[metric_euclid;top2;open_ball_nbd;];
18056 TYPE_THEN `r` EXISTS_TAC;
18057 ASM_REWRITE_TAC[DIFF_SUBSET];
18058 PROOF_BY_CONTR_TAC;
18059 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS;INTER]);
18061 FIRST_ASSUM (fun t -> ASSUME_TAC (MATCH_MP p_conn_ball t));
18062 TYPE_THEN `p_conn A a u` SUBGOAL_TAC;
18063 IMATCH_MP_TAC p_conn_subset;
18068 IMATCH_MP_TAC pconn_trans;
18069 TYPE_THEN `u` EXISTS_TAC;
18070 ASM_MESON_TAC[pconn_symm];
18071 (* Wed Aug 4 12:00:13 EDT 2004 *)
18075 let p_conn_conn = prove_by_refinement(
18076 `!A x y. (top2 A /\ connected top2 A /\ A x /\ A y) ==>
18080 REWRITE_TAC[connected];
18082 TYPEL_THEN [`p_conn A x`;`A DIFF (p_conn A x)`] (USE 2 o ISPECL);
18084 ASM_SIMP_TAC[p_conn_open;p_conn_diff];
18086 TYPE_THEN `!(w:(num->real)->bool) z. (w INTER (z DIFF w) = EMPTY)` SUBGOAL_TAC;
18087 SET_TAC[INTER;DIFF];
18088 DISCH_THEN_REWRITE;
18090 TYPE_THEN `!(x:(num->real)->bool) y. (x SUBSET (y UNION (x DIFF y)))` SUBGOAL_TAC;
18091 SET_TAC[SUBSET;UNION;DIFF];
18092 DISCH_THEN_REWRITE;
18094 DISCH_THEN (DISJ_CASES_TAC);
18095 ASM_MESON_TAC[ISUBSET];
18097 REWRITE_TAC[SUBSET;DIFF];
18098 ASM_MESON_TAC[pconn_refl];
18099 (* Wed Aug 4 12:42:12 EDT 2004 *)
18103 let plane_graph = jordan_def
18105 graph_vertex G SUBSET (euclid 2) /\
18107 graph_edge G SUBSET (simple_arc top2) /\
18108 (!e. (graph_edge G e ==>
18109 (graph_inc G e = e INTER (graph_vertex G)))) /\
18110 (!e e'. (graph_edge G e /\ graph_edge G e' /\ ~(e = e')) ==>
18111 (e INTER e' SUBSET (graph_vertex G)))`;;
18113 let graph_isomorphic = jordan_def
18114 `graph_isomorphic (G:(A,B)graph_t) (H:(A',B')graph_t) <=>
18115 ?f. (graph_iso f G H)`;;
18117 let I_BIJ = prove_by_refinement(
18118 `!(x:A->bool). BIJ I x x`,
18121 REWRITE_TAC[BIJ;INJ;SURJ;I_THM;];
18126 let graph_isomorphic_refl = prove_by_refinement(
18127 `!(G:(A,B)graph_t). graph_isomorphic G G`,
18130 REWRITE_TAC[graph_isomorphic;graph_iso;];
18134 TYPE_THEN `I:A->A` EXISTS_TAC;
18135 TYPE_THEN `I:B->B` EXISTS_TAC;
18136 TYPE_THEN `(I:A->A,I:B->B)` EXISTS_TAC;
18137 ASM_REWRITE_TAC[I_THM;IMAGE_I;I_BIJ];
18138 (* Wed Aug 4 13:08:32 EDT 2004 *)
18143 let graph_inc_subset = prove_by_refinement(
18144 `!(G:(A,B)graph_t) e. (graph G /\ graph_edge G e) ==>
18145 (graph_inc G e SUBSET graph_vertex G)`,
18148 REWRITE_TAC[graph;IMAGE;SUBSET;];
18151 USE 2 (CONV_RULE (dropq_conv "x''"));
18158 let graph_isomorphic_symm = prove_by_refinement(
18159 `!(G:(A,B)graph_t) (H:(A',B')graph_t).
18160 graph G /\ graph_isomorphic G H ==> graph_isomorphic H G`,
18163 REWRITE_TAC[graph_isomorphic;graph_iso];
18167 TYPE_THEN `u' = INV u (graph_vertex G) (graph_vertex H)` ABBREV_TAC ;
18168 TYPE_THEN `v' = INV v (graph_edge G) (graph_edge H)` ABBREV_TAC ;
18169 TYPE_THEN `u'` EXISTS_TAC;
18170 TYPE_THEN `v'` EXISTS_TAC;
18171 TYPE_THEN `(u',v')` EXISTS_TAC;
18175 IMATCH_MP_TAC INVERSE_BIJ;
18179 IMATCH_MP_TAC INVERSE_BIJ;
18183 TYPE_THEN `e' = v' e` ABBREV_TAC ;
18185 TYPE_THEN `e = v e'` SUBGOAL_TAC;
18186 ASM_MESON_TAC [inv_comp_right];
18190 TYPE_THEN `BIJ v' (graph_edge H) (graph_edge G)` SUBGOAL_TAC;
18191 ASM_MESON_TAC[INVERSE_BIJ];
18194 TYPE_THEN `graph_edge G e'` SUBGOAL_TAC;
18197 REWRITE_TAC[BIJ;SURJ;];
18201 ONCE_REWRITE_TAC [EQ_SYM_EQ];
18203 IMATCH_MP_TAC image_inv_image;
18205 IMATCH_MP_TAC graph_inc_subset;
18207 (* Wed Aug 4 13:53:24 EDT 2004 *)
18212 let graph_isomorphic_trans = prove_by_refinement(
18213 `!(G:(A,B)graph_t) (H:(A',B')graph_t) (J:(A'',B'')graph_t).
18214 graph_isomorphic G H /\ graph_isomorphic H J ==>
18215 graph_isomorphic G J`,
18218 REWRITE_TAC[graph_isomorphic;graph_iso;];
18224 TYPE_THEN `u' o u` EXISTS_TAC;
18225 TYPE_THEN `v' o v` EXISTS_TAC;
18226 TYPE_THEN `(u' o u, v' o v)` EXISTS_TAC;
18229 REWRITE_TAC[comp_comp];
18230 IMATCH_MP_TAC COMP_BIJ;
18233 REWRITE_TAC[comp_comp];
18234 IMATCH_MP_TAC COMP_BIJ;
18237 REWRITE_TAC[IMAGE_o];
18238 REWRITE_TAC[o_DEF];
18240 TYPE_THEN `graph_edge H (v e)` SUBGOAL_TAC;
18242 REWRITE_TAC[BIJ;SURJ];
18246 (* Wed Aug 4 14:13:25 EDT 2004 *)
18250 let graph_isomorphic_graph = prove_by_refinement(
18251 `!(G:(A,B)graph_t) H.
18252 graph G /\ graph_isomorphic G (H:(A',B')graph_t) ==> graph H`,
18257 TYPE_THEN `!z. (graph_edge G z ==> graph_inc G z SUBSET graph_vertex G)` SUBGOAL_TAC;
18258 ASM_MESON_TAC[graph_inc_subset];
18262 REWRITE_TAC[graph;graph_isomorphic;graph_iso];
18264 REWRITE_TAC[SUBSET;IMAGE;];
18266 CONV_TAC (dropq_conv "x''");
18268 TYPE_THEN `?y'. (graph_edge G y' /\ (v y' = x'))` SUBGOAL_TAC;
18270 REWRITE_TAC[BIJ;SURJ];
18275 TYPE_THEN `graph_inc H x' = IMAGE u (graph_inc G y')` SUBGOAL_TAC;
18279 TYPE_THEN `graph_inc G y' SUBSET graph_vertex G` SUBGOAL_TAC;
18285 ASM_REWRITE_TAC[IMAGE];
18288 REWRITE_TAC[BIJ;SURJ];
18289 MESON_TAC[ISUBSET];
18293 TYPE_THEN `(graph_inc G y') HAS_SIZE 2` SUBGOAL_TAC;
18295 REWRITE_TAC[SUBSET;IMAGE];
18297 CONV_TAC (dropq_conv "x''");
18304 REWRITE_TAC[HAS_SIZE];
18306 IMATCH_MP_TAC FINITE_IMAGE;
18307 ASM_MESON_TAC[HAS_SIZE];
18309 RULE_ASSUM_TAC (REWRITE_RULE[HAS_SIZE]);
18312 DISCH_THEN (fun t -> REWRITE_TAC[GSYM t]);
18313 IMATCH_MP_TAC CARD_IMAGE_INJ;
18317 REWRITE_TAC[BIJ;INJ];
18319 ASM_MESON_TAC[ISUBSET];
18320 (* Wed Aug 4 15:18:06 EDT 2004 *)
18325 let planar_graph = jordan_def
18326 `planar_graph (G:(A,B)graph_t) <=>
18327 (?H. (plane_graph H) /\ (graph_isomorphic H G))`;;
18329 let plane_planar = prove_by_refinement(
18330 `!G. (plane_graph G) ==> (planar_graph G)`,
18334 REWRITE_TAC[planar_graph];
18336 ASM_MESON_TAC[graph_isomorphic_refl];
18341 let planar_is_graph = prove_by_refinement(
18342 `!(G:(A,B)graph_t). (planar_graph G ==> graph G)`,
18346 REWRITE_TAC[planar_graph;plane_graph];
18348 ASM_MESON_TAC[graph_isomorphic_graph];
18353 let planar_iso = prove_by_refinement(
18354 `!G H. (planar_graph (G:(A,B)graph_t)) /\ (graph_isomorphic G H) ==>
18355 (planar_graph (H:(A',B')graph_t))`,
18358 REWRITE_TAC[planar_graph];
18360 TYPE_THEN `H'` EXISTS_TAC;
18363 USE 0 (MATCH_MP graph_isomorphic_trans);
18365 (* Wed Aug 4 15:41:05 EDT 2004 *)
18370 (* almost the same ans num_MAX . The minimization is num_WOP. *)
18371 let select_num_max = prove_by_refinement(
18372 `!Y. FINITE Y /\ (~(Y= EMPTY)) ==>
18373 (?z. (Y z /\ (!y. Y y ==> y <=| z)))`,
18377 TYPE_THEN `f = \ (t:num). --. (&. t)` ABBREV_TAC ;
18378 TYPE_THEN `Z = IMAGE f Y` ABBREV_TAC ;
18379 TYPE_THEN `FINITE Z /\ ~(Z = {})` SUBGOAL_TAC;
18382 IMATCH_MP_TAC FINITE_IMAGE;
18384 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
18387 REWRITE_TAC[EMPTY_EXISTS];
18388 TYPE_THEN `f u` EXISTS_TAC;
18389 REWRITE_TAC[IMAGE];
18392 USE 4 (MATCH_MP min_finite);
18394 TYPE_THEN `?z. Y z /\ (f z = delta)` SUBGOAL_TAC;
18397 REWRITE_TAC[IMAGE;SUBSET];
18400 TYPE_THEN `z` EXISTS_TAC;
18403 TYPE_THEN `(f z <= f y) ==> (y <=| z)` SUBGOAL_TAC;
18406 DISCH_THEN IMATCH_MP_TAC ;
18407 TYPE_THEN `Z (f y)` SUBGOAL_TAC;
18409 REWRITE_TAC[IMAGE;SUBSET];
18415 let select_image_num_max = prove_by_refinement(
18416 `!(X:A->bool) f. (?N. (!x. (X x ==> f x <| N))) /\ ~(X = EMPTY) ==>
18417 (?z. (X z /\ (!x. (X x ==> f x <=| f z))))`,
18421 TYPE_THEN `Y = IMAGE f X` ABBREV_TAC ;
18422 TYPE_THEN `Y SUBSET {n | n <| N}` SUBGOAL_TAC;
18424 REWRITE_TAC[IMAGE;SUBSET;];
18427 TYPE_THEN `FINITE Y /\ (~(Y= EMPTY))` SUBGOAL_TAC;
18429 IMATCH_MP_TAC FINITE_SUBSET;
18430 TYPE_THEN `{n | n <| N}` EXISTS_TAC;
18431 ASM_REWRITE_TAC[FINITE_NUMSEG_LT];
18432 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
18433 REWRITE_TAC[EMPTY_EXISTS];
18435 TYPE_THEN `f u` EXISTS_TAC;
18438 REWRITE_TAC[IMAGE;SUBSET];
18440 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
18443 USE 4 (MATCH_MP select_num_max);
18445 TYPE_THEN `?r. X r /\ (f r = z)` SUBGOAL_TAC;
18448 REWRITE_TAC[IMAGE;SUBSET];
18451 TYPE_THEN `r` EXISTS_TAC;
18455 TYPE_THEN `Y (f x)` SUBGOAL_TAC;
18457 REWRITE_TAC[IMAGE;SUBSET];
18460 (* Wed Aug 4 16:41:51 EDT 2004 *)
18465 let select_image_num_min = prove_by_refinement(
18466 `!(X:A->bool) f. (~(X = EMPTY)) ==>
18467 (?z. (X z /\ (!x. (X x ==> f z <=| f x))))`,
18471 TYPE_THEN `Y = IMAGE f X` ABBREV_TAC ;
18472 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
18474 TYPE_THEN `(?n. Y n)` SUBGOAL_TAC;
18475 TYPE_THEN `f u` EXISTS_TAC;
18477 REWRITE_TAC[IMAGE;SUBSET];
18480 RULE_ASSUM_TAC (ONCE_REWRITE_RULE[num_WOP]);
18482 TYPE_THEN `?z. (X z) /\ (f z = n)` SUBGOAL_TAC;
18485 REWRITE_TAC[IMAGE;SUBSET];
18488 TYPE_THEN `z` EXISTS_TAC;
18492 IMATCH_MP_TAC (ARITH_RULE `~(f x <| n) ==> (n <=| f x)`);
18498 ASM_REWRITE_TAC[IMAGE;SUBSET];
18500 (* Wed Aug 4 19:37:29 EDT 2004 *)
18505 let select_card_max = prove_by_refinement(
18506 `!(X:(A->bool)->bool). (~(X = EMPTY) /\ (FINITE (UNIONS X))) ==>
18507 (?z. (X z /\ (!x. (X x ==> (CARD x <= CARD z)))))`,
18511 IMATCH_MP_TAC select_image_num_max;
18513 TYPE_THEN `SUC (CARD (UNIONS X))` EXISTS_TAC;
18515 TYPE_THEN `x SUBSET (UNIONS X)` SUBGOAL_TAC;
18516 IMATCH_MP_TAC sub_union;
18519 REWRITE_TAC[ARITH_RULE `(a <| SUC b) <=> (a <=| b)`];
18520 IMATCH_MP_TAC CARD_SUBSET;
18522 (* Thu Aug 5 10:50:37 EDT 2004 *)
18527 let select_card_min = prove_by_refinement(
18528 `!(X:(A->bool)->bool). ~(X = EMPTY) ==>
18529 (?z. (X z /\ (!x. (X x ==> (CARD z <= CARD x)))))`,
18533 IMATCH_MP_TAC select_image_num_min;
18535 (* Thu Aug 5 10:52:02 EDT 2004 *)
18539 (* D embeddings of planar graphs *)
18541 let induced_top_interval = prove_by_refinement(
18542 `!a b. induced_top (top_of_metric(UNIV,d_real))
18543 {x | a <= x /\ x <= b } =
18544 top_of_metric ({x | a <= x /\ x <= b}, d_real)
18549 IMATCH_MP_TAC top_of_metric_induced;
18550 ASM_REWRITE_TAC[SUBSET_UNIV;metric_real];
18554 let continuous_interval = prove_by_refinement(
18555 `!f a b. (continuous f (top_of_metric(UNIV,d_real)) top2) ==>
18556 (continuous f (top_of_metric({x | a <= x /\ x <= b},d_real)) top2)`,
18560 REWRITE_TAC[GSYM induced_top_interval];
18561 IMATCH_MP_TAC continuous_induced_domain;
18562 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real;SUBSET_UNIV ];
18566 let inj_image_subset = prove_by_refinement(
18567 `!(f:A->B) X Y. (INJ f X Y ==> IMAGE f X SUBSET Y)`,
18570 REWRITE_TAC[INJ;IMAGE;SUBSET];
18575 let subset_contain = prove_by_refinement(
18576 `!a b c d. (c <= a) /\ (b <= d) ==>
18577 {x | a <= x /\ x <= b} SUBSET {x | c <= x /\ x <= d}`,
18580 REWRITE_TAC[SUBSET];
18585 let curve_restriction = prove_by_refinement(
18587 simple_arc top2 C /\
18588 closed_ top2 K /\ closed_ top2 K' /\
18589 (C INTER K INTER K' = EMPTY) /\
18590 ~(C INTER K = EMPTY) /\
18591 ~(C INTER K' = EMPTY) /\
18593 (?C' f. (C' = IMAGE f {x | a <= x /\ x <= b}) /\ (C' SUBSET C) /\
18594 continuous f (top_of_metric(UNIV,d_real)) top2 /\
18595 INJ f {x | a <= x /\ x <= b} (euclid 2) /\
18596 (C' INTER K = {(f a)}) /\
18597 (C' INTER K' = {(f b)})
18602 REWRITE_TAC[simple_arc];
18604 ASSUME_TAC top2_unions;
18606 TYPE_THEN `?t. (&0 <= t /\ t <= &1) /\ (K (f t)) /\ (!s. (&0 <=s /\ s < t) ==> ~(K (f s)))` SUBGOAL_TAC;
18607 ASSUME_TAC preimage_first ;
18608 TYPEL_THEN [`K`;`2`] (USE 10 o ISPECL);
18609 FIRST_ASSUM (fun t -> IMATCH_MP_TAC t);
18611 ASM_REWRITE_TAC[GSYM top2;];
18612 ASM_SIMP_TAC[continuous_interval];
18615 DISCH_THEN_REWRITE;
18617 IMATCH_MP_TAC inj_image_subset;
18621 TYPE_THEN `?t. (&0 <= t /\ t <= &1) /\ (K' (f t)) /\ (!s. (&0 <=s /\ s < t) ==> ~(K' (f s)))` SUBGOAL_TAC;
18622 ASSUME_TAC preimage_first ;
18623 TYPEL_THEN [`K'`;`2`] (USE 14 o ISPECL);
18624 FIRST_ASSUM (fun t -> IMATCH_MP_TAC t);
18626 ASM_REWRITE_TAC[GSYM top2;];
18627 ASM_SIMP_TAC[continuous_interval];
18630 DISCH_THEN_REWRITE;
18632 IMATCH_MP_TAC inj_image_subset;
18635 TYPE_THEN `(t < t' \/ t' < t)` SUBGOAL_TAC;
18636 REWRITE_TAC[(REAL_ARITH `(t < t' \/ t' < t) <=> ~( t = t')`)];
18639 REWRITE_TAC[EMPTY_EXISTS;INTER;];
18640 TYPE_THEN `(f t)` EXISTS_TAC;
18642 REWRITE_TAC[IMAGE;SUBSET];
18644 TYPE_THEN `t'` EXISTS_TAC;
18647 (* main cases split [main] *)
18648 ASSUME_TAC (REAL_ARITH `&0 < &1`);
18649 DISCH_THEN (DISJ_CASES_TAC);
18650 TYPE_THEN `continuous f (top_of_metric (UNIV,d_real)) (top2) /\ INJ f {x | t <= x /\ x <= t'} (euclid 2) /\ (&0 < &1) /\ (t < t') ` SUBGOAL_TAC;
18652 IMATCH_MP_TAC inj_subset_domain;
18653 TYPE_THEN `{x | &0 <= x /\ x <= &1}` EXISTS_TAC;
18655 ASM_REWRITE_TAC[SUBSET ];
18660 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_rev t));
18662 TYPE_THEN `Ca = IMAGE g {x | &0 <= x /\ x <= &1}` ABBREV_TAC ;
18663 TYPE_THEN `Ca INTER K' = {(g (&0))}` SUBGOAL_TAC;
18664 IMATCH_MP_TAC SUBSET_ANTISYM;
18666 REWRITE_TAC[INTER;SUBSET;INR IN_SING;];
18669 REWRITE_TAC[IMAGE;SUBSET];
18671 TYPE_THEN `x' < t' \/ (x' = t')` SUBGOAL_TAC;
18674 DISCH_THEN DISJ_CASES_TAC;
18675 PROOF_BY_CONTR_TAC;
18678 FIRST_ASSUM IMATCH_MP_TAC ;
18684 REWRITE_TAC[SUBSET;INTER;INR IN_SING;];
18687 REWRITE_TAC[IMAGE;SUBSET];
18691 TYPE_THEN `t'` EXISTS_TAC;
18692 ASM_MESON_TAC[REAL_ARITH `(t < t' ==> t<= t') /\ (t' <= t')`];
18695 TYPE_THEN `~(Ca INTER K = EMPTY)` SUBGOAL_TAC;
18696 REWRITE_TAC[INTER;EMPTY_EXISTS];
18697 TYPE_THEN `f t` EXISTS_TAC;
18700 REWRITE_TAC[IMAGE;SUBSET;];
18702 TYPE_THEN `t` EXISTS_TAC;
18703 ASM_REWRITE_TAC[REAL_ARITH `t <= t`];
18704 ASM_SIMP_TAC[REAL_ARITH `(t < t') ==> (t <= t')`];
18707 (* ADD Ca SUBSET C *)
18708 TYPE_THEN `Ca SUBSET C` SUBGOAL_TAC;
18713 REWRITE_TAC[IMAGE;SUBSET];
18716 TYPE_THEN `x'` EXISTS_TAC;
18725 (* t'' parameter for g and K *)
18726 TYPE_THEN `?t''. (&0 <= t'' /\ t'' <= &1) /\ (K (g t'')) /\ (!s. (&0 <=s /\ s < t'') ==> ~(K (g s)))` SUBGOAL_TAC;
18727 ASSUME_TAC preimage_first ;
18728 TYPEL_THEN [`K`;`2`] (USE 29 o ISPECL);
18729 FIRST_ASSUM (fun t -> IMATCH_MP_TAC t);
18731 ASM_REWRITE_TAC[GSYM top2;];
18732 ASM_SIMP_TAC[continuous_interval];
18734 IMATCH_MP_TAC inj_image_subset;
18737 (* set up for arc_reparameter_rev *)
18738 TYPE_THEN `continuous g (top_of_metric (UNIV,d_real)) (top2) /\ INJ g {x | &0 <= x /\ x <= t''} (euclid 2) /\ (a < b) /\ (&0 < t'') ` SUBGOAL_TAC;
18740 TYPE_THEN `&0 < t'' \/ (t'' = &0)` SUBGOAL_TAC;
18743 DISCH_THEN DISJ_CASES_TAC;
18745 IMATCH_MP_TAC inj_subset_domain;
18746 TYPE_THEN `{x | &0 <= x /\ x <= &1}` EXISTS_TAC;
18747 ASM_REWRITE_TAC[SUBSET ];
18750 PROOF_BY_CONTR_TAC;
18752 REWRITE_TAC[EMPTY_EXISTS;INTER;];
18753 TYPE_THEN `g (&0)` EXISTS_TAC;
18754 TYPE_THEN `Ca (g (&0))` SUBGOAL_TAC;
18755 TYPE_THEN `{(g (&0))} SUBSET Ca` SUBGOAL_TAC;
18756 ASM_MESON_TAC[INTER_SUBSET];
18757 REWRITE_TAC[SUBSET;INR IN_SING];
18763 MESON_TAC[ISUBSET];
18769 FIRST_ASSUM (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_rev t));
18771 TYPE_THEN `C' =IMAGE g' {x | a <= x /\ x <= b}` ABBREV_TAC ;
18772 (* now finally go after the goal in the FIRST case *)
18773 TYPE_THEN `C'` EXISTS_TAC;
18774 TYPE_THEN `g'` EXISTS_TAC;
18776 (* now finish off the three conditions *)
18778 TYPE_THEN `C' SUBSET Ca` SUBGOAL_TAC;
18782 IMATCH_MP_TAC IMAGE_SUBSET;
18783 IMATCH_MP_TAC subset_contain;
18791 IMATCH_MP_TAC SUBSET_TRANS;
18792 TYPE_THEN `Ca` EXISTS_TAC ;
18797 IMATCH_MP_TAC SUBSET_ANTISYM;
18799 REWRITE_TAC[INTER;IMAGE;SUBSET];
18802 REWRITE_TAC[INR IN_SING];
18803 TYPE_THEN `(x' < t'') \/ (x' = t'')` SUBGOAL_TAC;
18806 DISCH_THEN DISJ_CASES_TAC;
18808 PROOF_BY_CONTR_TAC;
18813 REWRITE_TAC[SUBSET;IMAGE;INTER;IN_SING];
18818 TYPE_THEN `t''` EXISTS_TAC;
18819 ASM_MESON_TAC[REAL_ARITH `t'' <= t''`];
18822 IMATCH_MP_TAC SUBSET_ANTISYM;
18824 IMATCH_MP_TAC SUBSET_TRANS;
18825 TYPE_THEN `Ca INTER K'` EXISTS_TAC;
18828 REWRITE_TAC[SUBSET;INTER];
18831 REWRITE_TAC[SUBSET;INR IN_SING];
18832 REWRITE_TAC[SUBSET;INTER;INR IN_SING ];
18837 REWRITE_TAC[IMAGE;SUBSET];
18838 TYPE_THEN `b` EXISTS_TAC;
18844 (* ******************* START THE SECOND HALF ************ *)
18846 TYPE_THEN `continuous f (top_of_metric (UNIV,d_real)) (top2) /\ INJ f {x | t' <= x /\ x <= t} (euclid 2) /\ (&0 < &1) /\ (t' < t) ` SUBGOAL_TAC;
18848 IMATCH_MP_TAC inj_subset_domain;
18849 TYPE_THEN `{x | &0 <= x /\ x <= &1}` EXISTS_TAC;
18851 ASM_REWRITE_TAC[SUBSET ];
18856 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_rev t));
18858 TYPE_THEN `Ca = IMAGE g {x | &0 <= x /\ x <= &1}` ABBREV_TAC ;
18859 TYPE_THEN `Ca INTER K = {(g (&0))}` SUBGOAL_TAC;
18860 IMATCH_MP_TAC SUBSET_ANTISYM;
18862 REWRITE_TAC[INTER;SUBSET;INR IN_SING;];
18865 REWRITE_TAC[IMAGE;SUBSET];
18867 TYPE_THEN `x' < t \/ (x' = t)` SUBGOAL_TAC;
18870 DISCH_THEN DISJ_CASES_TAC;
18871 PROOF_BY_CONTR_TAC;
18874 FIRST_ASSUM IMATCH_MP_TAC ;
18880 REWRITE_TAC[SUBSET;INTER;INR IN_SING;];
18883 REWRITE_TAC[IMAGE;SUBSET];
18887 TYPE_THEN `t` EXISTS_TAC;
18888 ASM_MESON_TAC[REAL_ARITH `(t' < t ==> t'<= t) /\ (t <= t)`];
18891 TYPE_THEN `~(Ca INTER K' = EMPTY)` SUBGOAL_TAC;
18892 REWRITE_TAC[INTER;EMPTY_EXISTS];
18893 TYPE_THEN `f t'` EXISTS_TAC;
18896 REWRITE_TAC[IMAGE;SUBSET;];
18898 TYPE_THEN `t'` EXISTS_TAC;
18899 ASM_REWRITE_TAC[REAL_ARITH `t' <= t'`];
18900 ASM_SIMP_TAC[REAL_ARITH `(t' < t) ==> (t' <= t)`];
18903 (* ADD Ca SUBSET C *)
18904 TYPE_THEN `Ca SUBSET C` SUBGOAL_TAC;
18909 REWRITE_TAC[IMAGE;SUBSET];
18912 TYPE_THEN `x'` EXISTS_TAC;
18922 (* t'' parameter for g and K *)
18923 TYPE_THEN `?t''. (&0 <= t'' /\ t'' <= &1) /\ (K' (g t'')) /\ (!s. (&0 <=s /\ s < t'') ==> ~(K' (g s)))` SUBGOAL_TAC;
18924 ASSUME_TAC preimage_first ;
18925 TYPEL_THEN [`K'`;`2`] (USE 29 o ISPECL);
18926 FIRST_ASSUM (fun t -> IMATCH_MP_TAC t);
18928 ASM_REWRITE_TAC[GSYM top2;];
18929 ASM_SIMP_TAC[continuous_interval];
18931 IMATCH_MP_TAC inj_image_subset;
18934 (* set up for arc_reparameter_gen *)
18935 TYPE_THEN `continuous g (top_of_metric (UNIV,d_real)) (top2) /\ INJ g {x | &0 <= x /\ x <= t''} (euclid 2) /\ (a < b) /\ (&0 < t'') ` SUBGOAL_TAC;
18937 TYPE_THEN `&0 < t'' \/ (t'' = &0)` SUBGOAL_TAC;
18940 DISCH_THEN DISJ_CASES_TAC;
18942 IMATCH_MP_TAC inj_subset_domain;
18943 TYPE_THEN `{x | &0 <= x /\ x <= &1}` EXISTS_TAC;
18944 ASM_REWRITE_TAC[SUBSET ];
18947 PROOF_BY_CONTR_TAC;
18949 REWRITE_TAC[EMPTY_EXISTS;INTER;];
18950 TYPE_THEN `g (&0)` EXISTS_TAC;
18951 TYPE_THEN `Ca (g (&0))` SUBGOAL_TAC;
18952 TYPE_THEN `{(g (&0))} SUBSET Ca` SUBGOAL_TAC;
18953 ASM_MESON_TAC[INTER_SUBSET];
18954 REWRITE_TAC[SUBSET;INR IN_SING];
18960 MESON_TAC[ISUBSET];
18966 FIRST_ASSUM (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
18968 TYPE_THEN `C' =IMAGE g' {x | a <= x /\ x <= b}` ABBREV_TAC ;
18969 (* now finally go after the goal in the FIRST case *)
18970 TYPE_THEN `C'` EXISTS_TAC;
18971 TYPE_THEN `g'` EXISTS_TAC;
18974 (* now finish off the three conditions *)
18976 TYPE_THEN `C' SUBSET Ca` SUBGOAL_TAC;
18980 IMATCH_MP_TAC IMAGE_SUBSET;
18981 IMATCH_MP_TAC subset_contain;
18989 IMATCH_MP_TAC SUBSET_TRANS;
18990 TYPE_THEN `Ca` EXISTS_TAC ;
18993 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
18997 IMATCH_MP_TAC SUBSET_ANTISYM;
18999 REWRITE_TAC[INTER;IMAGE;SUBSET];
19002 REWRITE_TAC[INR IN_SING];
19003 TYPE_THEN `(x' < t'') \/ (x' = t'')` SUBGOAL_TAC;
19006 DISCH_THEN DISJ_CASES_TAC;
19008 PROOF_BY_CONTR_TAC;
19013 REWRITE_TAC[SUBSET;IMAGE;INTER;IN_SING];
19018 TYPE_THEN `t''` EXISTS_TAC;
19019 ASM_MESON_TAC[REAL_ARITH `t'' <= t''`];
19023 IMATCH_MP_TAC SUBSET_ANTISYM;
19025 IMATCH_MP_TAC SUBSET_TRANS;
19026 TYPE_THEN `Ca INTER K` EXISTS_TAC;
19029 REWRITE_TAC[SUBSET;INTER];
19032 REWRITE_TAC[SUBSET;INR IN_SING];
19033 REWRITE_TAC[SUBSET;INTER;INR IN_SING ];
19038 REWRITE_TAC[IMAGE;SUBSET];
19039 TYPE_THEN `a` EXISTS_TAC;
19044 (* Thu Aug 5 08:09:38 EDT 2004 *)
19049 let simple_arc_end = jordan_def
19050 `simple_arc_end C v v' <=>
19051 (?f. (C = IMAGE f {x | &0 <= x /\ x <= &1 }) /\
19052 continuous f (top_of_metric(UNIV,d_real)) top2 /\
19053 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) /\
19054 (f (&0) = v) /\ (f(&1) = v'))`;;
19056 let good_plane_graph = jordan_def
19057 `good_plane_graph G <=> plane_graph G /\
19058 (!e v v'. (graph_edge G e /\ ~(v = v') /\
19059 (graph_inc G e v) /\ (graph_inc G e v') ==>
19060 (simple_arc_end e v v')))`;;
19062 let graph_edge_mod = jordan_def
19063 `graph_edge_mod (G:(A,B)graph_t) (f:B->B') =
19064 mk_graph_t (graph_vertex G,IMAGE f (graph_edge G),
19065 (\ e' v. (?e. graph_edge G e /\ graph_inc G e v /\ (f e = e'))))`;;
19067 let graph_edge_mod_v = prove_by_refinement(
19068 `!(G:(A,B)graph_t) (f:B->B').
19069 graph_vertex (graph_edge_mod G f) = graph_vertex G `,
19072 REWRITE_TAC[graph_edge_mod;graph_vertex;dest_graph_t;];
19076 let graph_edge_mod_e = prove_by_refinement(
19077 `!(G:(A,B)graph_t) (f:B->B').
19078 graph_edge (graph_edge_mod G f) = IMAGE f (graph_edge G )`,
19081 REWRITE_TAC[graph_edge_mod;graph_edge;dest_graph_t;part1;drop0];
19085 let graph_edge_mod_i = prove_by_refinement(
19086 `!(G:(A,B)graph_t) (f:B->B') e v.
19087 graph_inc (graph_edge_mod G f) e v <=>
19088 (?e'. (graph_edge G e' /\ graph_inc G e' v /\ (f e' = e)))`,
19091 REWRITE_TAC[graph_edge_mod;graph_inc;dest_graph_t;part1;drop1];
19095 let inj_bij = prove_by_refinement(
19096 `!(f:A->B) X. (INJ f X UNIV) ==> (BIJ f X (IMAGE f X))`,
19101 REWRITE_TAC[IMAGE_SURJ];
19103 REWRITE_TAC[INJ;IMAGE;SUBSET];
19108 let graph_edge_iso = prove_by_refinement(
19109 `! f (G:(A,B)graph_t). (INJ (f:B->B') (graph_edge G) (UNIV)) ==>
19110 (graph_isomorphic G (graph_edge_mod G f))`,
19114 REWRITE_TAC[graph_isomorphic;graph_iso];
19118 TYPE_THEN `I:A->A` EXISTS_TAC ;
19119 TYPE_THEN `f` EXISTS_TAC;
19121 EXISTS_TAC `(I:A->A,f:B->B')` ;
19122 REWRITE_TAC[graph_edge_mod_v;graph_edge_mod_e];
19124 REWRITE_TAC[I_DEF;BIJ;INJ;SURJ;];
19127 IMATCH_MP_TAC inj_bij;
19130 IMATCH_MP_TAC EQ_EXT;
19132 REWRITE_TAC[graph_edge_mod_i;IMAGE_I;];
19135 TYPE_THEN `e'' = e'` SUBGOAL_TAC;
19136 RULE_ASSUM_TAC(REWRITE_RULE [INJ]);
19137 FIRST_ASSUM IMATCH_MP_TAC ;
19145 let graph_edge_graph = prove_by_refinement(
19146 `!f (G:(A,B)graph_t). (graph G) /\
19147 (INJ (f:B->B') (graph_edge G) (UNIV)) ==>
19148 (graph (graph_edge_mod G f)) `,
19152 IMATCH_MP_TAC graph_isomorphic_graph;
19153 TYPE_THEN `G` EXISTS_TAC;
19154 ASM_MESON_TAC[graph_edge_iso];
19158 let plane_graph_mod = prove_by_refinement(
19159 `!G f. (plane_graph G) /\ (INJ f (graph_edge G) UNIV) /\
19160 (!e e'. (graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==>
19161 (f e INTER f e' SUBSET e INTER e') )) /\
19162 (!e. (graph_edge G e ==> (simple_arc top2 (f e)))) /\
19163 (!e. (graph_edge G e) ==>
19164 (e INTER graph_vertex G = (f e) INTER graph_vertex G)) ==>
19165 (plane_graph (graph_edge_mod G f))
19170 REWRITE_TAC[plane_graph];
19172 REWRITE_TAC[graph_edge_mod_v;graph_edge_mod_e;];
19176 ASM_MESON_TAC[graph_edge_graph];
19178 REWRITE_TAC[IMAGE;SUBSET];
19181 REWRITE_TAC[IMAGE;SUBSET];
19183 IMATCH_MP_TAC EQ_EXT;
19184 REWRITE_TAC[INTER];
19186 REWRITE_TAC[graph_edge_mod_i];
19189 TYPE_THEN `e' = x` SUBGOAL_TAC;
19190 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
19191 FIRST_ASSUM IMATCH_MP_TAC ;
19199 TYPE_THEN `(f x INTER graph_vertex G) x'` SUBGOAL_TAC;
19201 REWRITE_TAC[INTER;SUBSET];
19203 TYPE_THEN `x` EXISTS_TAC;
19210 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
19212 REWRITE_TAC[INTER;SUBSET];
19216 REWRITE_TAC[IMAGE];
19219 REWRITE_TAC[IMAGE];
19221 TYPE_THEN `~(x = x')` SUBGOAL_TAC;
19225 IMATCH_MP_TAC SUBSET_TRANS;
19226 TYPE_THEN `x' INTER x` EXISTS_TAC;
19228 FIRST_ASSUM IMATCH_MP_TAC ;
19230 FIRST_ASSUM IMATCH_MP_TAC ;
19232 (* Thu Aug 5 10:17:38 EDT 2004 *)
19238 let compact_point = prove_by_refinement(
19239 `!U (x:A). (UNIONS U x) ==> (compact U {x})`,
19242 REWRITE_TAC[compact];
19245 ASM_REWRITE_TAC [single_subset];
19247 TYPE_THEN `?u. V u /\ u x` SUBGOAL_TAC;
19249 REWRITE_TAC[SUBSET;UNIONS;INR IN_SING];
19252 TYPE_THEN `{u}` EXISTS_TAC;
19253 ASM_REWRITE_TAC [single_subset;FINITE_SING];
19254 (* Thu Aug 5 12:02:40 EDT 2004 *)
19259 let simple_arc_end_select = prove_by_refinement(
19260 `!C v v'. (simple_arc top2 C) /\ (C v) /\ (C v') /\ ~(v = v') ==>
19261 (?C'. (C' SUBSET C) /\ (simple_arc_end C' v v'))`,
19264 REWRITE_TAC[simple_arc_end];
19267 TYPE_THEN `!v. (C v) ==> (closed_ top2 {v})` SUBGOAL_TAC;
19269 IMATCH_MP_TAC compact_closed;
19270 ASM_SIMP_TAC[top2_top;metric_hausdorff;top2;metric_euclid;compact_point];
19271 IMATCH_MP_TAC compact_point;
19272 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_euclid];
19274 REWRITE_TAC[simple_arc];
19276 TYPE_THEN `C SUBSET euclid 2` SUBGOAL_TAC;
19278 IMATCH_MP_TAC inj_image_subset;
19279 RULE_ASSUM_TAC (REWRITE_RULE [top2_unions]);
19281 ASM_MESON_TAC[ISUBSET];
19283 (* B hypotheses of curve_restriction *)
19284 TYPE_THEN `simple_arc top2 C /\ closed_ top2 {v} /\ closed_ top2 {v'} /\ (C INTER {v} INTER { v' } = EMPTY) /\ ~(C INTER {v} = EMPTY) /\ ~(C INTER {v'} = EMPTY) /\ (&0 < &1)` SUBGOAL_TAC;
19287 FIRST_ASSUM IMATCH_MP_TAC ;
19290 FIRST_ASSUM IMATCH_MP_TAC ;
19292 REWRITE_TAC[REAL_ARITH `&0 < &1`];
19293 REWRITE_TAC[INTER;INR IN_SING;EMPTY_EXISTS ];
19294 REWRITE_TAC[EQ_EMPTY];
19296 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP curve_restriction t));
19298 TYPE_THEN `C'` EXISTS_TAC;
19300 TYPE_THEN `f` EXISTS_TAC;
19302 TYPE_THEN `!A u v. (A INTER {u} = {v}) ==> ( (v:num->real)=u)` SUBGOAL_TAC;
19303 REWRITE_TAC[eq_sing;INTER;INR IN_SING;];
19309 let graph_edge2 = prove_by_refinement(
19310 `!(G:(A,B)graph_t) e.
19311 (graph G /\ graph_edge G e) ==> (graph_inc G e HAS_SIZE 2)`,
19314 REWRITE_TAC[graph];
19315 REWRITE_TAC[IMAGE;SUBSET];
19320 let simple_arc_end_symm = prove_by_refinement(
19321 `!C' v v'. (simple_arc_end C' v v' ==> simple_arc_end C' v' v)`,
19324 REWRITE_TAC[simple_arc_end];
19326 TYPE_THEN `( continuous f (top_of_metric (UNIV,d_real)) (top2) /\ INJ f {x | &0 <= x /\ x <= &1} (euclid 2) /\ (&0 < &1) /\ (&0 < &1))` SUBGOAL_TAC;
19327 ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`];
19328 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_rev t));
19330 TYPE_THEN `g` EXISTS_TAC;
19336 let simple_arc_end_plane_select = prove_by_refinement(
19337 `!G e. (plane_graph G /\ graph_edge G e) ==> (?e'.
19339 (!v v'. graph_inc G e v /\ graph_inc G e v' /\ ~(v = v') ==>
19340 simple_arc_end e' v v')))`,
19345 TYPE_THEN `graph_inc G e HAS_SIZE 2` SUBGOAL_TAC;
19346 RULE_ASSUM_TAC (REWRITE_RULE [plane_graph]);
19347 IMATCH_MP_TAC graph_edge2;
19349 REWRITE_TAC[has_size2];
19351 TYPE_THEN `(?e'. (e' SUBSET e) /\ (simple_arc_end e' a b))` SUBGOAL_TAC;
19352 IMATCH_MP_TAC simple_arc_end_select;
19354 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
19358 ASM_MESON_TAC [ISUBSET];
19359 TYPE_THEN `graph_inc G e a /\ graph_inc G e b` SUBGOAL_TAC;
19361 REWRITE_TAC[in_pair];
19364 REWRITE_TAC[INTER;SUBSET];
19367 TYPE_THEN `e'` EXISTS_TAC;
19368 ASM_REWRITE_TAC[in_pair];
19370 TYPE_THEN `((v = a) /\ (v' = b)) \/ ((v = b) /\ (v' =a ))` SUBGOAL_TAC;
19372 DISCH_THEN DISJ_CASES_TAC;
19376 IMATCH_MP_TAC simple_arc_end_symm;
19378 (* Thu Aug 5 14:10:17 EDT 2004 *)
19384 let plane_graph_contain = prove_by_refinement(
19385 `!G e e'. (plane_graph G /\ graph_edge G e /\ graph_edge G e' /\
19386 (e SUBSET e') ==> (e = e'))`,
19390 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
19392 PROOF_BY_CONTR_TAC;
19393 TYPE_THEN `e INTER e' SUBSET graph_vertex G` SUBGOAL_TAC;
19396 TYPE_THEN `e INTER e' SUBSET e' INTER graph_vertex G` SUBGOAL_TAC;
19397 REWRITE_TAC[SUBSET_INTER];
19399 REWRITE_TAC[INTER;SUBSET];
19401 TYPE_THEN `e' INTER graph_vertex G = graph_inc G e'` SUBGOAL_TAC;
19403 DISCH_THEN_REWRITE;
19404 TYPE_THEN `graph_inc G e' HAS_SIZE 2` SUBGOAL_TAC;
19405 ASM_MESON_TAC[graph_edge2];
19406 TYPE_THEN `e INTER e' = e` SUBGOAL_TAC;
19408 REWRITE_TAC[SUBSET_INTER_ABSORPTION];
19409 DISCH_THEN_REWRITE;
19410 REWRITE_TAC[has_size2];
19413 TYPE_THEN `simple_arc top2 e` SUBGOAL_TAC;
19414 ASM_MESON_TAC[ISUBSET];
19415 REWRITE_TAC[simple_arc];
19417 TYPE_THEN `!x. (&0 <= x /\ x <= &1) ==> {a,b} (f x)` SUBGOAL_TAC;
19420 REWRITE_TAC[IMAGE;SUBSET];
19423 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
19425 TYPE_THEN `(f (&0) = f(&1))` SUBGOAL_TAC;
19426 IMATCH_MP_TAC two_exclusion;
19427 TYPE_THEN `{a,b}` EXISTS_TAC;
19428 TYPE_THEN `?t. (&0 < t /\ t < &1)` SUBGOAL_TAC;
19429 TYPE_THEN `&1/ (&2)` EXISTS_TAC;
19430 IMATCH_MP_TAC half_pos;
19433 TYPE_THEN `f t` EXISTS_TAC;
19435 ASM_MESON_TAC[pair_size_2];
19437 FIRST_ASSUM IMATCH_MP_TAC ;
19440 FIRST_ASSUM IMATCH_MP_TAC ;
19443 FIRST_ASSUM IMATCH_MP_TAC ;
19448 PROOF_BY_CONTR_TAC;
19449 TYPE_THEN `~(&0 = t)` SUBGOAL_TAC;
19453 FIRST_ASSUM IMATCH_MP_TAC ;
19459 PROOF_BY_CONTR_TAC;
19460 TYPE_THEN `~(&1 = t)` SUBGOAL_TAC;
19464 FIRST_ASSUM IMATCH_MP_TAC ;
19471 TYPE_THEN `~(&0 = &1)` SUBGOAL_TAC;
19474 FIRST_ASSUM IMATCH_MP_TAC ;
19477 (* Thu Aug 5 15:11:20 EDT 2004 *)
19482 let graph_edge_end_select = prove_by_refinement(
19483 `!(G:(A,B)graph_t) e. (graph G /\ graph_edge G e ==>
19484 (?v v'. graph_inc G e v /\ graph_inc G e v' /\ ~(v = v')))`,
19488 TYPE_THEN `graph_inc G e HAS_SIZE 2` SUBGOAL_TAC;
19489 IMATCH_MP_TAC graph_edge2;
19491 REWRITE_TAC[has_size2];
19493 TYPE_THEN `a` EXISTS_TAC;
19494 TYPE_THEN `b` EXISTS_TAC;
19495 ASM_REWRITE_TAC[in_pair];
19496 (* Thu Aug 5 19:26:02 EDT 2004 *)
19502 (* ------------------------------------------------------------------ *)
19504 (* ------------------------------------------------------------------ *)
19506 (* Thu Aug 5 21:17:36 EDT 2004 *)
19508 (* Tweaked slightly now that there is an "inf" constant. JRH, 4 Dec 2011 *)
19512 `inf (X:real->bool) =
19513 @s. ((!x. X x ==> s <= x) /\ (!y. (!x. X x ==> y <= x) ==> (y <= s)))` in
19515 subst [mk_var("inf",`:(real->bool)->real`),mk_const("inf",[])] inf_def in
19518 let interval_closed = prove_by_refinement(
19519 `!a b. closed_ (top_of_metric(UNIV,d_real)) {x | a <= x /\ x <= b}`,
19523 IMATCH_MP_TAC compact_closed;
19524 ASM_SIMP_TAC[interval_compact;top_of_metric_top;metric_real];
19525 ASM_SIMP_TAC[metric_hausdorff;metric_real;];
19529 let half_closed = prove_by_refinement(
19530 `!a. closed_ (top_of_metric(UNIV,d_real)) {x | x <= a}`,
19533 REWRITE_TAC[closed];
19535 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real];
19536 TYPE_THEN `UNIV DIFF {x | x <= a } = {x | a < x}` SUBGOAL_TAC;
19537 IMATCH_MP_TAC EQ_EXT;
19538 REWRITE_TAC[DIFF;UNIV];
19540 DISCH_THEN_REWRITE;
19541 REWRITE_TAC [open_DEF;half_open_above];
19545 let half_closed_above = prove_by_refinement(
19546 `!a. closed_ (top_of_metric(UNIV,d_real)) {x | a <= x}`,
19549 REWRITE_TAC[closed];
19551 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real];
19552 TYPE_THEN `UNIV DIFF {x | a <= x } = {x | x < a}` SUBGOAL_TAC;
19553 IMATCH_MP_TAC EQ_EXT;
19554 REWRITE_TAC[DIFF;UNIV];
19556 DISCH_THEN_REWRITE;
19557 REWRITE_TAC [open_DEF;half_open];
19561 let inf_LB = prove_by_refinement(
19562 `!X. (~(X = EMPTY) /\ (?t. !x. (X x ==> t <= x))) ==>
19563 (!x. X x ==> inf X <= x) /\
19564 (!y. (!x. X x ==> y <= x) ==> (y <= inf X))`,
19568 TYPE_THEN `topology_ (top_of_metric(UNIV,d_real))` SUBGOAL_TAC;
19569 ASM_SIMP_TAC[top_of_metric_top;metric_real];
19572 TYPE_THEN `X SUBSET closure (top_of_metric(UNIV,d_real)) X` SUBGOAL_TAC;
19573 ASM_SIMP_TAC[subset_closure];
19576 REWRITE_TAC[EMPTY_EXISTS];
19581 PROOF_BY_CONTR_TAC;
19585 TYPE_THEN `XC = closure (top_of_metric(UNIV,d_real)) X INTER {x | t <= x /\ x <= u}` ABBREV_TAC ;
19586 TYPE_THEN `compact (top_of_metric(UNIV,d_real)) XC` SUBGOAL_TAC;
19587 IMATCH_MP_TAC closed_compact;
19588 TYPE_THEN `{x | t <= x /\ x <= u}` EXISTS_TAC;
19589 ASM_SIMP_TAC[interval_compact;top_of_metric_top;metric_real];
19592 IMATCH_MP_TAC closed_inter2;
19593 ASM_SIMP_TAC[interval_closed;top_of_metric_top;metric_real];
19594 IMATCH_MP_TAC closure_closed;
19595 ASM_SIMP_TAC[top_of_metric_top;metric_real;GSYM top_of_metric_unions;];
19596 ASM_REWRITE_TAC[INTER_SUBSET];
19599 TYPE_THEN `(?z. (XC z /\ (!y. XC y ==> z <= y)))` SUBGOAL_TAC;
19600 IMATCH_MP_TAC compact_inf;
19602 REWRITE_TAC[EMPTY_EXISTS];
19603 TYPE_THEN `u` EXISTS_TAC;
19605 REWRITE_TAC[INTER;SUBSET];
19608 REWRITE_TAC[SUBSET];
19610 ASM_MESON_TAC[REAL_ARITH `u <= u`];
19612 TYPE_THEN `z` EXISTS_TAC;
19615 TYPE_THEN `(x <= u) \/ (u < x)` SUBGOAL_TAC;
19617 DISCH_THEN DISJ_CASES_TAC;
19618 TYPE_THEN `XC x` SUBGOAL_TAC;
19620 REWRITE_TAC[INTER;SUBSET];
19622 ASM_MESON_TAC[ISUBSET];
19627 REWRITE_TAC[INTER;SUBSET];
19629 ASM_MESON_TAC[REAL_ARITH `z <= u /\ u < x ==> z <= x`];
19631 TYPE_THEN `closed_ (top_of_metric (UNIV,d_real)) {x | y' <= x }` SUBGOAL_TAC;
19632 REWRITE_TAC[half_closed_above];
19634 TYPE_THEN `closure (top_of_metric (UNIV,d_real)) X SUBSET {x | y' <= x }` SUBGOAL_TAC;
19635 IMATCH_MP_TAC closure_subset;
19636 ASM_REWRITE_TAC[SUBSET ];
19638 TYPE_THEN `XC SUBSET {x | y' <= x}` SUBGOAL_TAC;
19640 IMATCH_MP_TAC SUBSET_TRANS;
19641 TYPE_THEN `closure (top_of_metric (UNIV,d_real)) X ` EXISTS_TAC;
19644 REWRITE_TAC[INTER_SUBSET];
19645 REWRITE_TAC[SUBSET];
19647 (* Fri Aug 6 05:51:24 EDT 2004 *)
19652 let inf_eps = prove_by_refinement(
19653 `!X. (~(X = EMPTY) /\ (?t. !x. (X x ==> t <= x))) ==>
19654 (!epsilon. (&0 < epsilon) ==> (?x. X x /\ (x < inf X + epsilon)))`,
19658 TYPE_THEN `(!y. (!x. X x ==> y <= x) ==> (y <= inf X))` SUBGOAL_TAC;
19659 ASM_MESON_TAC[inf_LB];
19661 TSPEC `inf X + epsilon` 3;
19662 PROOF_BY_CONTR_TAC;
19663 TYPE_THEN `(!x. X x ==> inf X + epsilon <= x)` SUBGOAL_TAC;
19665 IMATCH_MP_TAC (REAL_ARITH `~(v < u) ==> u <= v`);
19667 ASM_MESON_TAC[REAL_ARITH `(x + y <= x ==> ~(&0 < y))`];
19671 let supm = jordan_def `supm (X:real->bool) =
19672 --. (inf ({x | ?z. X z /\ (x = --. z)}))`;;
19674 let supm_UB = prove_by_refinement(
19675 `!X. (~(X = EMPTY) /\ (?t. !x. (X x ==> x <= t))) ==>
19676 (!x. X x ==> x <= supm X ) /\
19677 (!y. (!x. X x ==> x <= y) ==> (supm X <= y))`,
19682 TYPE_THEN `Y = {x | ?z. X z /\ (x = --z)}` ABBREV_TAC ;
19683 TYPE_THEN `!u. (Y u = X (-- u)) /\ (Y (--u ) = X u)` SUBGOAL_TAC;
19686 MESON_TAC[REAL_ARITH `(-- (-- u) = u)`];
19688 TYPE_THEN `(~(Y = EMPTY) /\ (?t. !x. (Y x ==> t <= x)))` SUBGOAL_TAC;
19690 REWRITE_TAC[EMPTY_EXISTS];
19693 TYPE_THEN `-- u` EXISTS_TAC;
19695 TYPE_THEN `-- t` EXISTS_TAC;
19697 ASM_MESON_TAC[REAL_ARITH `--t <= x <=> (-- x <= t)`];
19698 DISCH_THEN ( ASSUME_TAC o (MATCH_MP inf_LB));
19701 ASM_MESON_TAC[REAL_ARITH `y <= --x <=> x <= --y`];
19703 IMATCH_MP_TAC (REAL_ARITH `--y <= inf Y ==> -- inf Y <= y`);
19704 FIRST_ASSUM IMATCH_MP_TAC ;
19706 ASM_MESON_TAC[ REAL_ARITH `--x <= y <=> --y <= x`];
19707 (* Fri Aug 6 06:42:14 EDT 2004 *)
19712 let supm_eps = prove_by_refinement(
19713 `!X. (~(X = EMPTY) /\ (?t. !x. (X x ==> x <= t))) ==>
19714 (!epsilon.(&0 < epsilon) ==> (?x. X x /\ (supm X - epsilon < x)))`,
19718 TYPE_THEN `(!y. (!x. X x ==> x <= y) ==> (supm X <= y))` SUBGOAL_TAC;
19719 ASM_MESON_TAC[supm_UB];
19721 TSPEC `supm X - epsilon` 3;
19722 PROOF_BY_CONTR_TAC;
19723 TYPE_THEN `(!x. X x ==> x <= supm X - epsilon)` SUBGOAL_TAC;
19725 IMATCH_MP_TAC (REAL_ARITH `~(v < u) ==> u <= v`);
19727 ASM_MESON_TAC[REAL_ARITH `(x <= x - y ==> ~(&0 < y))`];
19728 (* Fri Aug 6 06:47:22 EDT 2004 *)
19733 let compact_subset = prove_by_refinement(
19734 `!(X:A->bool) K d. (K SUBSET X /\ metric_space(X,d)) ==>
19735 (compact(top_of_metric(X,d)) K = compact(top_of_metric(K,d))K) `,
19739 ASM_SIMP_TAC[GSYM top_of_metric_induced];
19740 ASM_MESON_TAC[induced_compact;top_of_metric_unions];
19744 let exp_gt1 = prove_by_refinement(
19745 `!n. (0 < n) ==> (1 < 2 **| n)`,
19748 TYPE_THEN `1 = 2 **| 0` SUBGOAL_TAC;
19750 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
19752 REWRITE_TAC[LT_EXP];
19758 let twopow_lt = prove_by_refinement(
19759 `!a b. (a < b) ==> (twopow a < twopow b)`,
19762 ONCE_REWRITE_TAC [INT_ARITH `(a <: b) <=> (&:0 <: b -: a)`];
19763 ASSUME_TAC twopow_pos;
19764 ONCE_REWRITE_TAC [REAL_ARITH `x < y <=> &1*x < y`];
19765 ASM_SIMP_TAC[GSYM REAL_LT_RDIV_EQ];
19766 REWRITE_TAC[real_div];
19767 REWRITE_TAC[GSYM TWOPOW_INV;GSYM TWOPOW_ADD_INT;GSYM INT_SUB];
19769 TYPE_THEN `C = b -: a` ABBREV_TAC ;
19770 ASSUME_TAC INT_REP2 ;
19773 FIRST_ASSUM DISJ_CASES_TAC;
19776 REWRITE_TAC[TWOPOW_POS];
19778 REWRITE_TAC[INT_OF_NUM_LT;exp_gt1];
19779 PROOF_BY_CONTR_TAC;
19782 REWRITE_TAC[INT_ARITH `(~(&:0 <: --: y) <=> (&:0 <=: y))`];
19783 REWRITE_TAC[INT_OF_NUM_LE];
19788 let compact_distance = prove_by_refinement(
19789 `!(X:A->bool) d K K'. (metric_space(X,d) /\
19790 ~(K=EMPTY) /\ ~(K' = EMPTY) /\
19791 (compact (top_of_metric(X,d)) K) /\ (compact(top_of_metric(X,d))K'))
19792 ==> (?p p'. (K p /\ K' p' /\ (!q q'. (K q /\ K' q') ==>
19793 (d p p' <= d q q'))))`,
19797 TYPE_THEN `UNIONS (top_of_metric(X,d)) = X` SUBGOAL_TAC;
19798 ASM_SIMP_TAC[GSYM top_of_metric_unions];
19800 TYPE_THEN `K SUBSET X /\ K' SUBSET X` SUBGOAL_TAC;
19801 RULE_ASSUM_TAC (REWRITE_RULE[compact]);
19806 TYPE_THEN `Y = { z | ?q q'. (K q /\ K' q' /\ (z = d q q'))}` ABBREV_TAC ;
19807 TYPE_THEN `!y. (Y y) ==> (&0 <= y)` SUBGOAL_TAC;
19811 RULE_ASSUM_TAC (REWRITE_RULE[metric_space]);
19812 TYPEL_THEN [`q`;`q'`;`q'`] (USE 4 o ISPECL);
19813 ASM_MESON_TAC[metric_space;ISUBSET];
19816 TYPE_THEN `~(Y= EMPTY)` SUBGOAL_TAC;
19817 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
19820 REWRITE_TAC[EMPTY_EXISTS];
19821 TYPE_THEN `d u' u` EXISTS_TAC;
19827 TYPE_THEN `(!epsilon. (&0 < epsilon) ==> (?x. Y x /\ (x < inf Y + epsilon)))` SUBGOAL_TAC;
19828 IMATCH_MP_TAC inf_eps;
19831 ASSUME_TAC twopow_pos;
19832 TYPE_THEN `(!n. ?p. ?p'. K p /\ K' p' /\ (d p p' < inf Y + twopow( -- (&:n))))` SUBGOAL_TAC;
19834 TYPE_THEN `(?x. Y x /\ x < inf Y + twopow (--: (&:n)))` SUBGOAL_TAC;
19835 FIRST_ASSUM IMATCH_MP_TAC ;
19845 (* compact,complete,totally bounded *)
19846 TYPE_THEN `metric_space (K,d) /\ metric_space(K',d)` SUBGOAL_TAC;
19847 ASM_MESON_TAC[metric_subspace];
19849 TYPE_THEN `compact (top_of_metric(K,d)) K /\ compact (top_of_metric(K',d)) K'` SUBGOAL_TAC;
19850 ASM_MESON_TAC[compact_subset];
19852 TYPE_THEN `complete (K,d) /\ complete (K',d) ` SUBGOAL_TAC;
19853 ASM_MESON_TAC[compact_complete];
19855 TYPE_THEN `totally_bounded(K,d) /\ totally_bounded(K',d)` SUBGOAL_TAC;
19856 ASM_MESON_TAC[compact_totally_bounded;];
19858 (* construct subseq of p *)
19859 TYPE_THEN `(?ss. subseq ss /\ converge (K,d) (p o ss))` SUBGOAL_TAC;
19860 IMATCH_MP_TAC convergent_subseq;
19861 ASM_REWRITE_TAC[sequence;SUBSET;UNIV;IMAGE];
19863 CONV_TAC (dropq_conv "x''");
19866 REWRITE_TAC[converge];
19869 TYPE_THEN `!n. ?p'. K' p' /\ d x p' < inf Y + twopow(--: (&:n))` SUBGOAL_TAC;
19871 TSPEC `twopow (--: (&:(SUC(n))))` 22;
19874 TSPEC `SUC(n') + SUC (n)` 22;
19875 RULE_ASSUM_TAC (REWRITE_RULE[ARITH_RULE `x <=| SUC x +| y`]);
19876 TSPEC `ss (SUC n' +| SUC n)` 13;
19878 TYPE_THEN `twopow (--: (&:(ss(SUC n'+SUC n)))) < twopow(--: (&:(SUC n)))` SUBGOAL_TAC;
19879 IMATCH_MP_TAC twopow_lt;
19880 REWRITE_TAC[INT_LT_NEG;INT_OF_NUM_LT;];
19881 IMATCH_MP_TAC (ARITH_RULE `(?t. (a <= t /\ t <| b)) ==> (a <| b)`);
19882 TYPE_THEN `ss (SUC n)` EXISTS_TAC;
19883 ASM_SIMP_TAC[SEQ_SUBLE;subseq];
19884 RULE_ASSUM_TAC (REWRITE_RULE[subseq]);
19885 FIRST_ASSUM IMATCH_MP_TAC ;
19888 TYPE_THEN `p'` EXISTS_TAC;
19890 RULE_ASSUM_TAC (REWRITE_RULE[metric_space]);
19892 TYPEL_THEN [`x`;`p (ss (SUC n' +| SUC n))`;`p'`] (USE 4 o ISPECL);
19894 TYPE_THEN `X x /\ X (p (ss (SUC n' +| SUC n))) /\ X p'` SUBGOAL_TAC;
19895 ASM_MESON_TAC[ISUBSET];
19899 TYPE_THEN `twopow( --: (&:(SUC n))) + twopow (--: (&:(SUC n))) = twopow (--: (&:n))` SUBGOAL_TAC;
19900 REWRITE_TAC[GSYM REAL_MUL_2;ADD1;twopow_double];
19905 REWRITE_TAC[o_DEF];
19910 (* take subseq of p' *)
19911 TYPE_THEN `(?ss'. subseq ss' /\ converge (K',d) (p' o ss'))` SUBGOAL_TAC;
19912 IMATCH_MP_TAC convergent_subseq;
19913 ASM_REWRITE_TAC[sequence;SUBSET;UNIV;IMAGE];
19915 CONV_TAC (dropq_conv "x''");
19917 REWRITE_TAC[converge];
19919 TYPE_THEN `x` EXISTS_TAC;
19920 TYPE_THEN `x'` EXISTS_TAC;
19923 (* now go in for the KILL. *)
19924 (* Show d x x' <= inf Y because d x x' < inf Y + eps *)
19926 IMATCH_MP_TAC (REAL_ARITH `(?t. (t <= y) /\ (x <= t)) ==> (x <= y)`);
19927 TYPE_THEN `inf Y` EXISTS_TAC;
19929 TYPE_THEN `(!y. Y y ==> inf Y <= y)` SUBGOAL_TAC;
19930 ASM_MESON_TAC[inf_LB];
19931 DISCH_THEN IMATCH_MP_TAC ;
19934 TYPE_THEN `q` EXISTS_TAC;
19935 TYPE_THEN `q'` EXISTS_TAC;
19937 SUBGOAL_TAC `!x y. (!e. (&0 <e) ==> (x < y + e)) ==> (x <= y)`;
19939 DISCH_THEN (fun t -> MP_TAC (SPEC `x'' - y` t));
19941 DISCH_THEN IMATCH_MP_TAC ;
19958 (* GEN needed inequalities *)
19960 TYPE_THEN `?n. (&1)* twopow(--: (&:n)) < e` SUBGOAL_TAC;
19961 ASM_MESON_TAC[twopow_eps;REAL_ARITH `&0 < &1`];
19964 TYPE_THEN `twopow( --: (&:(SUC n))) + twopow (--: (&:(SUC n))) = twopow (--: (&:n))` SUBGOAL_TAC;
19965 REWRITE_TAC[GSYM REAL_MUL_2;ADD1;twopow_double];
19967 TSPEC `twopow(--: (&:(SUC n)))` 26;
19969 RULE_ASSUM_TAC (REWRITE_RULE[twopow_pos]);
19971 TSPEC `SUC (n) + SUC n'` 2;
19972 USE 2(REWRITE_RULE[ARITH_RULE `a <=| b + SUC a`]);
19973 TSPEC `ss' (SUC n + SUC n')` 25;
19974 TYPE_THEN `twopow (--: (&:(ss' (SUC n +| SUC n')))) < twopow (--: (&:(SUC n)))` SUBGOAL_TAC;
19975 IMATCH_MP_TAC twopow_lt;
19976 REWRITE_TAC[INT_LT_NEG;INT_OF_NUM_LT ];
19977 IMATCH_MP_TAC (ARITH_RULE `(?t. (a <=| t /\ (t <| b))) ==> (a <| b)`);
19978 TYPE_THEN `(ss' (SUC n) )` EXISTS_TAC;
19979 ASM_SIMP_TAC[SEQ_SUBLE];
19980 RULE_ASSUM_TAC (REWRITE_RULE[subseq]);
19981 FIRST_ASSUM IMATCH_MP_TAC ;
19985 (* metric space ineq *)
19986 TYPE_THEN `X x /\ X x' /\ X (p' (ss' (SUC n +| SUC n')))` SUBGOAL_TAC;
19987 ASM_MESON_TAC[ISUBSET];
19989 RULE_ASSUM_TAC (REWRITE_RULE[o_DEF]);
19990 TYPE_THEN `r = p' (ss' (SUC n +| SUC n'))` ABBREV_TAC ;
19991 TYPE_THEN `d x' r = d r x'` SUBGOAL_TAC;
19992 IMATCH_MP_TAC metric_space_symm;
19994 TYPE_THEN `d x x' <= d x r + d r x'` SUBGOAL_TAC;
19995 IMATCH_MP_TAC metric_space_triangle;
20003 (* Fri Aug 6 11:54:33 EDT 2004 *)
20007 let max_real_le = prove_by_refinement(
20008 `!x y. x <= max_real x y /\ y <= max_real x y `,
20011 REWRITE_TAC[max_real];
20021 let min_real_le = prove_by_refinement(
20022 `!x y. min_real x y <= x /\ min_real x y <= y`,
20025 REWRITE_TAC[min_real];
20035 let finite_UB = prove_by_refinement(
20036 `!X. (FINITE X) ==> (?t. (!x. X x ==> x <=. t))`,
20039 TYPE_THEN `!n X. (X HAS_SIZE n) ==> (?t. (!x. X x ==> x <= t))` SUBGOAL_TAC;
20041 REWRITE_TAC[HAS_SIZE_0;EQ_EMPTY;];
20043 REWRITE_TAC[HAS_SIZE_SUC];
20044 REWRITE_TAC[EMPTY_EXISTS];
20046 TSPEC `X DELETE u` 0;
20047 TYPE_THEN `(?t. !x. (X DELETE u) x ==> x <= t)` SUBGOAL_TAC;
20050 TYPE_THEN `max_real t u` EXISTS_TAC;
20053 TYPE_THEN `x = u` ASM_CASES_TAC;
20054 ASM_MESON_TAC[max_real_le];
20056 RULE_ASSUM_TAC (REWRITE_RULE[DELETE]);
20057 ASM_MESON_TAC[max_real_le;REAL_LE_TRANS];
20058 REWRITE_TAC[HAS_SIZE];
20060 (* Fri Aug 6 12:50:04 EDT 2004 *)
20064 let finite_LB = prove_by_refinement(
20065 `!X. (FINITE X) ==> (?t. (!x. X x ==> t <=. x))`,
20068 TYPE_THEN `!n X. (X HAS_SIZE n) ==> (?t. (!x. X x ==> t <= x))` SUBGOAL_TAC;
20070 REWRITE_TAC[HAS_SIZE_0;EQ_EMPTY;];
20072 REWRITE_TAC[HAS_SIZE_SUC];
20073 REWRITE_TAC[EMPTY_EXISTS];
20075 TSPEC `X DELETE u` 0;
20076 TYPE_THEN `(?t. !x. (X DELETE u) x ==> t <= x)` SUBGOAL_TAC;
20079 TYPE_THEN `min_real t u` EXISTS_TAC;
20082 TYPE_THEN `x = u` ASM_CASES_TAC;
20083 ASM_MESON_TAC[min_real_le];
20085 RULE_ASSUM_TAC (REWRITE_RULE[DELETE]);
20086 ASM_MESON_TAC[min_real_le;REAL_LE_TRANS];
20087 REWRITE_TAC[HAS_SIZE];
20092 let finite_compact = prove_by_refinement(
20093 `!(X:A->bool) U. (FINITE X) /\ (X SUBSET UNIONS U) ==> (compact U X)`,
20096 TYPE_THEN `!n (X:A->bool) U. (X HAS_SIZE n) /\ (X SUBSET UNIONS U) ==> (compact U X)` SUBGOAL_TAC;
20098 REWRITE_TAC[HAS_SIZE_0];
20101 REWRITE_TAC[compact];
20103 TYPE_THEN `EMPTY:(A->bool)->bool` EXISTS_TAC;
20104 REWRITE_TAC[FINITE_RULES];
20105 REWRITE_TAC[HAS_SIZE_SUC;EMPTY_EXISTS;compact ;];
20108 TYPE_THEN `X DELETE u HAS_SIZE n` SUBGOAL_TAC;
20111 TYPEL_THEN [`X DELETE u`;`U`] (USE 0 o ISPECL);
20114 TYPE_THEN `X DELETE u SUBSET UNIONS U` SUBGOAL_TAC;
20116 REWRITE_TAC[SUBSET;DELETE];
20120 RULE_ASSUM_TAC (REWRITE_RULE[compact]);
20124 TYPE_THEN `X DELETE u SUBSET UNIONS V` SUBGOAL_TAC;
20126 REWRITE_TAC[SUBSET;DELETE];
20131 USE 6 (REWRITE_RULE[SUBSET;UNIONS]);
20135 TYPE_THEN `u' INSERT W` EXISTS_TAC;
20137 REWRITE_TAC[INSERT_SUBSET];
20139 ASM_REWRITE_TAC[FINITE_INSERT];
20140 REWRITE_TAC[UNIONS_INSERT];
20141 IMATCH_MP_TAC SUBSET_TRANS;
20142 TYPE_THEN `u' UNION (X DELETE u)` EXISTS_TAC;
20144 REWRITE_TAC[SUBSET;DELETE;UNION];
20147 REWRITE_TAC[UNION;SUBSET];
20149 REWRITE_TAC[HAS_SIZE];
20154 let compact_supm = prove_by_refinement(
20155 `!X. (compact(top_of_metric(UNIV,d_real)) X) /\ ~(X = EMPTY) ==>
20160 TYPE_THEN `(?x. X x /\ (!y. X y ==> y <= x))` SUBGOAL_TAC;
20161 IMATCH_MP_TAC compact_sup;
20164 TYPE_THEN `(!x. X x ==> x <= supm X ) /\ (!y. (!x. X x ==> x <= y) ==> (supm X <= y))` SUBGOAL_TAC;
20165 IMATCH_MP_TAC supm_UB;
20168 TYPE_THEN `x = supm X` SUBGOAL_TAC;
20169 IMATCH_MP_TAC (REAL_ARITH `x <= supm X /\ supm X <= x ==> (x = supm X)`);
20179 let compact_infm = prove_by_refinement(
20180 `!X. (compact(top_of_metric(UNIV,d_real)) X) /\ ~(X = EMPTY) ==>
20185 TYPE_THEN `(?x. X x /\ (!y. X y ==> x <= y))` SUBGOAL_TAC;
20186 IMATCH_MP_TAC compact_inf;
20189 TYPE_THEN `(!x. X x ==> inf X <= x ) /\ (!y. (!x. X x ==> y <= x) ==> ( y <= inf X))` SUBGOAL_TAC;
20190 IMATCH_MP_TAC inf_LB;
20193 TYPE_THEN `x = inf X` SUBGOAL_TAC;
20194 IMATCH_MP_TAC (REAL_ARITH `x <= inf X /\ inf X <= x ==> (x = inf X)`);
20200 (* Fri Aug 6 13:45:50 EDT 2004 *)
20205 let finite_supm = prove_by_refinement(
20206 `!X. (FINITE X) /\ ~(X = EMPTY) ==> X (supm X)`,
20210 IMATCH_MP_TAC compact_supm;
20212 IMATCH_MP_TAC finite_compact;
20213 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real;SUBSET_UNIV;];
20217 let finite_inf = prove_by_refinement(
20218 `!X. (FINITE X) /\ ~(X = EMPTY) ==> X (inf X)`,
20222 IMATCH_MP_TAC compact_infm;
20224 IMATCH_MP_TAC finite_compact;
20225 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real;SUBSET_UNIV;];
20226 (* Fri Aug 6 13:49:38 EDT 2004 *)
20230 let finite_supm_max = prove_by_refinement(
20231 `!X. (FINITE X) /\ ~(X = EMPTY) ==> (!x. X x ==> x <= supm X)`,
20235 TYPE_THEN `(?t. !x. (X x ==> x <= t))` SUBGOAL_TAC;
20236 ASM_MESON_TAC[finite_UB];
20237 ASM_MESON_TAC[supm_UB];
20241 let finite_inf_min = prove_by_refinement(
20242 `!X. (FINITE X) /\ ~(X = EMPTY) ==> (!x. X x ==> inf X <= x)`,
20246 TYPE_THEN `(?t. !x. (X x ==> t <= x))` SUBGOAL_TAC;
20247 ASM_MESON_TAC[finite_LB];
20248 ASM_MESON_TAC[inf_LB];
20252 let bij_inj_image = prove_by_refinement(
20253 `!(f:A->B) X Y. (INJ f X Y /\ Y SUBSET IMAGE f X) ==>
20257 REWRITE_TAC[INJ;BIJ;SURJ;SUBSET;IMAGE];
20262 let suc_interval = prove_by_refinement(
20263 `!n. {x | x <| SUC n} = {x | x <| n} UNION {n}`,
20267 IMATCH_MP_TAC EQ_EXT;
20269 REWRITE_TAC[UNION;INR IN_SING;];
20274 let inj_domain_sub = prove_by_refinement(
20275 `!(f:A->B) g X Y. (!x. (X x ==> (f x = g x))) ==> (INJ f X Y = INJ g X Y)`,
20283 let image_domain_sub = prove_by_refinement(
20284 `!(f:A->B) g X . (!x. (X x ==> (f x = g x))) ==> (IMAGE f X = IMAGE g X)`,
20287 REWRITE_TAC[IMAGE];
20289 IMATCH_MP_TAC EQ_EXT;
20295 let real_finite_increase = prove_by_refinement(
20296 `!X. ( (FINITE X) ==>
20297 (? u. (BIJ u {x | x <| CARD X} X) /\
20298 (!i j. (i <| CARD X /\ (j <| CARD X) /\ (i <| j) ==>
20302 TYPE_THEN `!n X. ( (X HAS_SIZE n) ==> (? u. (BIJ u {x | x <| CARD X} X) /\ (!i j. (i <| CARD X /\ (j <| CARD X) /\ (i <| j) ==> (u i <. u j)))))` SUBGOAL_TAC;
20304 REWRITE_TAC[HAS_SIZE_0];
20306 ASM_REWRITE_TAC[CARD_CLAUSES;BIJ;INJ;SURJ];
20307 REWRITE_TAC[ARITH_RULE `~(j <| 0)`];
20311 REWRITE_TAC[HAS_SIZE_SUC;];
20313 TYPE_THEN `X (supm X)` SUBGOAL_TAC;
20314 IMATCH_MP_TAC finite_supm;
20317 USE 3(REWRITE_RULE[EMPTY_EXISTS]);
20320 ASM_MESON_TAC[FINITE_DELETE;HAS_SIZE;];
20324 TSPEC `X DELETE supm X` 0;
20327 TYPE_THEN `v = (\j. if (j = n) then supm X else u j)` ABBREV_TAC ;
20328 TYPE_THEN `v` EXISTS_TAC;
20329 TYPE_THEN `CARD (X DELETE supm X) = n` SUBGOAL_TAC;
20330 ASM_MESON_TAC[HAS_SIZE];
20333 TYPE_THEN `!x. ({x | x <| n} x ==> (v x = u x))` SUBGOAL_TAC;
20338 ASM_REWRITE_TAC[ARITH_RULE `~(n <| n)`];
20341 TYPE_THEN `INJ v {x | x <| n} X = INJ u {x | x <| n} X` SUBGOAL_TAC;
20342 IMATCH_MP_TAC inj_domain_sub;
20346 TYPE_THEN `v n = supm X` SUBGOAL_TAC;
20350 TYPE_THEN `IMAGE v {x | x <| n} = IMAGE u {x | x <| n}` SUBGOAL_TAC;
20351 IMATCH_MP_TAC image_domain_sub;
20355 TYPE_THEN `IMAGE v {x | x <| n} = X DELETE supm X` SUBGOAL_TAC;
20361 MESON_TAC[SURJ_IMAGE];
20365 IMATCH_MP_TAC bij_inj_image;
20367 TYPE_THEN `{x | x <| CARD X} = {x | x <| n} UNION {n}` SUBGOAL_TAC;
20368 USE 2(REWRITE_RULE[HAS_SIZE]);
20370 REWRITE_TAC[suc_interval];
20371 DISCH_THEN_REWRITE;
20372 IMATCH_MP_TAC inj_split;
20374 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;DELETE]);
20379 REWRITE_TAC[INJ;SUBSET];
20382 REWRITE_TAC[INJ;SUBSET;INR IN_SING];
20384 REWRITE_TAC[EQ_EMPTY;INTER;image_sing;INR IN_SING;];
20386 ASM_REWRITE_TAC[DELETE;SUBSET;];
20388 TYPE_THEN `X = supm X INSERT (X DELETE supm X)` SUBGOAL_TAC;
20389 ASM_SIMP_TAC[INR INSERT_DELETE];
20390 USE 2 (REWRITE_RULE[HAS_SIZE]);
20392 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
20393 REWRITE_TAC[INSERT_SUBSET];
20396 REWRITE_TAC[IMAGE];
20397 TYPE_THEN `n` EXISTS_TAC;
20400 IMATCH_MP_TAC SUBSET_TRANS;
20401 TYPE_THEN `IMAGE v {x| x <| n}` EXISTS_TAC;
20402 ASM_REWRITE_TAC[SUBSET_REFL];
20405 IMATCH_MP_TAC IMAGE_SUBSET;
20406 REWRITE_TAC[SUBSET];
20409 (* monotonicity [m] *)
20410 USE 2 (REWRITE_RULE[HAS_SIZE]);
20412 TYPE_THEN `(!x. X x ==> x <= supm X)` SUBGOAL_TAC;
20413 ASM_MESON_TAC[finite_supm_max];
20415 TYPE_THEN `j = n` ASM_CASES_TAC;
20417 FIRST_ASSUM (fun t-> MP_TAC (AP_THM t `(v:num->real) i`));
20418 REWRITE_TAC[IMAGE;DELETE;];
20421 MESON_TAC[REAL_ARITH `a < b <=> (a<= b /\ ~(a = b))`];
20426 TYPE_THEN `~(i = n)` SUBGOAL_TAC;
20432 TYPE_THEN `i <| n /\ j <| n` SUBGOAL_TAC;
20442 REWRITE_TAC[HAS_SIZE];
20449 (* Fri Aug 6 19:51:16 EDT 2004 *)
20453 let connected_nogap = prove_by_refinement(
20454 `!A a b. connected (top_of_metric(UNIV,d_real)) A /\
20456 {x | a <= x /\ x <= b } SUBSET A`,
20460 TYPE_THEN `(a = b) \/ (b < a) \/ (a < b)` SUBGOAL_TAC;
20463 ASM_REWRITE_TAC[SUBSET];
20464 ASM_MESON_TAC[REAL_ARITH `b <= x /\ x <= b ==> (x = b)`];
20465 REWRITE_TAC[SUBSET];
20466 ASM_MESON_TAC[REAL_ARITH `a <=x /\ x <= b ==> ~(b < a)`];
20467 REWRITE_TAC[SUBSET];
20469 PROOF_BY_CONTR_TAC;
20470 TYPE_THEN `a < x` SUBGOAL_TAC;
20471 IMATCH_MP_TAC (REAL_ARITH `(a <= x /\ ~(a = x)) ==> a < x`);
20474 TYPE_THEN `x < b` SUBGOAL_TAC;
20475 IMATCH_MP_TAC (REAL_ARITH `(x <= b /\ ~(b = x)) ==> x < b`);
20478 RULE_ASSUM_TAC (REWRITE_RULE[connected]);
20480 TYPEL_THEN [` {t | t < x}`;` {t | x < t}`] (USE 2 o SPECL);
20482 REWRITE_TAC[half_open;half_open_above];
20483 TYPE_THEN `({t | t < x} INTER {t | x < t} = {}) /\ A SUBSET {t | t < x} UNION {t | x < t}` SUBGOAL_TAC;
20484 REWRITE_TAC[INTER;EQ_EMPTY;UNION;SUBSET;];
20485 REWRITE_TAC[REAL_ARITH `x' < x \/ x < x' <=> ~(x' = x)`];
20489 DISCH_THEN_REWRITE;
20490 REWRITE_TAC[SUBSET;];
20491 ASM_MESON_TAC[REAL_ARITH `x < b ==> ~(b < x)`];
20492 (* Fri Aug 6 20:24:45 EDT 2004 *)
20497 let connected_open = prove_by_refinement(
20498 `!A a b. (connected (top_of_metric(UNIV,d_real)) A /\
20499 (top_of_metric(UNIV,d_real) A) /\
20501 A SUBSET {x | a <= x /\ x <= b}) ==>
20502 ( A = {x | inf A < x /\ x < supm A})`,
20505 REWRITE_TAC[SUBSET];
20507 TYPE_THEN `(!epsilon. &0 < epsilon ==> (?x. A x /\ supm A - epsilon < x))` SUBGOAL_TAC;
20508 IMATCH_MP_TAC supm_eps;
20511 TYPE_THEN `(!epsilon. &0 < epsilon ==> (?x. A x /\ x < inf A + epsilon))` SUBGOAL_TAC;
20512 IMATCH_MP_TAC inf_eps;
20515 TYPE_THEN `(!x. A x ==> x <= supm A)` SUBGOAL_TAC;
20516 ASM_MESON_TAC[supm_UB];
20518 TYPE_THEN `(!x. A x ==> inf A <= x)` SUBGOAL_TAC;
20519 ASM_MESON_TAC[inf_LB];
20521 IMATCH_MP_TAC SUBSET_ANTISYM;
20522 TYPE_THEN `!x. (A x ==> ?e. &0 < e /\ open_ball(UNIV,d_real) x e SUBSET A)` SUBGOAL_TAC;
20524 MP_TAC metric_real;
20525 MESON_TAC[open_ball_nbd];
20526 REWRITE_TAC[open_ball;d_real];
20529 TYPE_THEN `!x. A x ==> (?y. A y /\ ~(x <= y))` SUBGOAL_TAC;
20534 USE 8(REWRITE_RULE[SUBSET]);
20535 TYPE_THEN `x - e/(&2)` EXISTS_TAC;
20536 REWRITE_TAC[REAL_ARITH `~(x <= x - e/(&2)) <=> (&0 < e/(&2))`];
20537 ASM_REWRITE_TAC[REAL_LT_HALF1];
20538 FIRST_ASSUM IMATCH_MP_TAC ;
20539 REWRITE_TAC[REAL_ARITH `(x - (x - t)) = t`];
20540 TYPE_THEN `abs (e/(&2)) = (e/(&2))` SUBGOAL_TAC;
20541 REWRITE_TAC[REAL_ABS_REFL];
20542 IMATCH_MP_TAC (REAL_ARITH `(a < b) ==> (a <= b)`);
20543 ASM_REWRITE_TAC[REAL_LT_HALF1];
20544 DISCH_THEN_REWRITE;
20545 ASM_REWRITE_TAC[REAL_LT_HALF2];
20548 TYPE_THEN `!x. A x ==> (?y. A y /\ ~(y <= x))` SUBGOAL_TAC;
20553 USE 8(REWRITE_RULE[SUBSET]);
20554 TYPE_THEN `x + e/(&2)` EXISTS_TAC;
20555 REWRITE_TAC[REAL_ARITH `~( x + e/(&2) <= x) <=> (&0 < e/(&2))`];
20556 ASM_REWRITE_TAC[REAL_LT_HALF1];
20557 FIRST_ASSUM IMATCH_MP_TAC ;
20558 REWRITE_TAC[REAL_ARITH `(x - (x + t)) = --. t`];
20559 TYPE_THEN `abs (--. (e/(&2))) = (e/(&2))` SUBGOAL_TAC;
20560 REWRITE_TAC[REAL_ABS_REFL;ABS_NEG;];
20561 IMATCH_MP_TAC (REAL_ARITH `(a < b) ==> (a <= b)`);
20562 ASM_REWRITE_TAC[REAL_LT_HALF1];
20563 DISCH_THEN_REWRITE;
20564 ASM_REWRITE_TAC[REAL_LT_HALF2];
20566 (* FIRST direction *)
20568 REWRITE_TAC[SUBSET];
20570 REWRITE_TAC[REAL_ARITH `u < v <=> (u <= v /\ ~(u = v))`];
20579 REWRITE_TAC[SUBSET];
20581 TYPE_THEN `?a'. A a' /\ (a' < x)` SUBGOAL_TAC;
20582 TSPEC `x - inf A` 5;
20583 USE 5 (REWRITE_RULE[REAL_ARITH `&0 < x - y <=> (y < x)`;REAL_ARITH `t + x - t = x`]);
20586 TSPEC `supm A - x` 4;
20587 USE 4(REWRITE_RULE[REAL_ARITH `&0 < y - x <=> (x < y)`;REAL_ARITH `t - (t -x) = x`]);
20590 TYPE_THEN `{t | a' <= t /\ t <= x'} SUBSET A` SUBGOAL_TAC;
20591 IMATCH_MP_TAC connected_nogap;
20593 REWRITE_TAC[SUBSET];
20596 FIRST_ASSUM IMATCH_MP_TAC ;
20600 (* Fri Aug 6 21:34:56 EDT 2004 *)
20605 let closure_real_set = prove_by_refinement(
20607 (closure(top_of_metric(UNIV,d_real)) Z a <=>
20608 (!e. (&0 < e) ==> (?z. Z z /\ (abs (a - z) <= e))))`,
20612 TYPE_THEN `metric_space (UNIV,d_real) /\ Z SUBSET UNIV` SUBGOAL_TAC;
20613 REWRITE_TAC[metric_real;SUBSET_UNIV];
20614 DISCH_THEN (fun t -> MP_TAC (MATCH_MP closure_open_ball t));
20615 DISCH_THEN (fun t -> MP_TAC (AP_THM t `a:real`));
20617 DISCH_THEN (fun t -> REWRITE_TAC[GSYM t]);
20618 REWRITE_TAC[open_ball;d_real;];
20620 ASM_MESON_TAC[REAL_ARITH `a < b ==> a <= b`];
20623 RULE_ASSUM_TAC (REWRITE_RULE[REAL_LT_HALF1]);
20626 TYPE_THEN `z` EXISTS_TAC;
20628 IMATCH_MP_TAC (REAL_ARITH `(a <= b/(&2)) /\ (b/(&2) < b) ==> (a < b)`);
20630 ASM_MESON_TAC[half_pos];
20631 (* Sat Aug 7 08:14:28 EDT 2004 *)
20636 let real_div_assoc = prove_by_refinement(
20637 `!a b c. (a*b)/c = a*(b/c)`,
20640 REWRITE_TAC[real_div;REAL_MUL_AC;];
20644 let real_middle1_lt = prove_by_refinement(
20645 `!a b. (a < b) ==> a < (a + b)/(&2) `,
20649 TYPE_THEN `(&2*a)/(&2) < (a+b)/(&2)` SUBGOAL_TAC;
20650 ASM_SIMP_TAC[REAL_LT_DIV2_EQ;REAL_ARITH `&0 < &2`];
20651 REWRITE_TAC[REAL_MUL_2];
20654 REWRITE_TAC[real_div_assoc];
20655 ASM_SIMP_TAC[REAL_DIV_LMUL;REAL_ARITH `~(&2 = &0)`];
20659 let real_middle2_lt = prove_by_refinement(
20660 `!a b. (a < b) ==> (a + b)/(&2) < b `,
20664 TYPE_THEN ` (a+b)/(&2) < (&2*b)/(&2)` SUBGOAL_TAC;
20665 ASM_SIMP_TAC[REAL_LT_DIV2_EQ;REAL_ARITH `&0 < &2`];
20666 REWRITE_TAC[REAL_MUL_2];
20669 REWRITE_TAC[real_div_assoc];
20670 ASM_SIMP_TAC[REAL_DIV_LMUL;REAL_ARITH `~(&2 = &0)`];
20674 let real_sub_half = prove_by_refinement(
20675 `!a b. (a - (a + b)/(&2) = (a - b)/(&2))`,
20679 TYPE_THEN `((&2*a)/(&2) - (a+b)/(&2) = (a - b)/(&2))` SUBGOAL_TAC;
20680 REWRITE_TAC[real_div;GSYM REAL_SUB_RDISTRIB];
20681 REWRITE_TAC[REAL_EQ_RMUL_IMP];
20684 REWRITE_TAC[REAL_MUL_2];
20686 ASM_SIMP_TAC[REAL_ARITH `~(&2 = &0)`;REAL_DIV_LMUL;real_div_assoc];
20690 let closure_open_interval = prove_by_refinement(
20692 (closure (top_of_metric(UNIV,d_real)) {x | a < x /\ x < b} =
20693 {x | a <= x /\ x <= b}) `,
20697 IMATCH_MP_TAC SUBSET_ANTISYM;
20699 IMATCH_MP_TAC closure_subset;
20700 ASM_SIMP_TAC[interval_closed;top_of_metric_top;metric_real];
20701 REWRITE_TAC[SUBSET];
20704 TYPE_THEN `{x | a <= x /\ x <= b} = a INSERT (b INSERT {x | a < x /\ x < b})` SUBGOAL_TAC;
20705 IMATCH_MP_TAC EQ_EXT;
20706 REWRITE_TAC[INSERT];
20710 DISCH_THEN_REWRITE;
20711 REWRITE_TAC[INSERT_SUBSET];
20712 ASM_SIMP_TAC[top_of_metric_top;metric_real;subset_closure;];
20713 (* USE closure_real_set *)
20714 REWRITE_TAC[closure_real_set];
20715 TYPE_THEN `!e. (&0 < e) ==> (a + e < b) \/ ((b - a)/(&2) < e)` SUBGOAL_TAC;
20717 ASM_CASES_TAC `(a + e < b)`;
20720 IMATCH_MP_TAC (REAL_ARITH `(x <= y/(&2) /\ y/(&2) < y) ==> (x < y)`);
20721 ASM_SIMP_TAC [half_pos];
20722 ASM_SIMP_TAC[REAL_LE_DIV2_EQ;REAL_ARITH `&0 < &2`];
20731 FIRST_ASSUM DISJ_CASES_TAC;
20732 TYPE_THEN `a + e` EXISTS_TAC;
20733 REWRITE_TAC[REAL_ARITH `(a < a + e <=> &0 < e) /\ (a - (a + e) = --. e)`];
20734 ASM_REWRITE_TAC[ABS_NEG;];
20735 IMATCH_MP_TAC (REAL_ARITH `(x = y) ==> (x <= y)`);
20736 REWRITE_TAC[REAL_ABS_REFL];
20741 TYPE_THEN `(a + b)/(&2)` EXISTS_TAC;
20742 ASM_SIMP_TAC[real_middle1_lt;real_middle2_lt;real_sub_half];
20745 REWRITE_TAC[real_div;ABS_MUL];
20746 ASM_SIMP_TAC[REAL_ARITH `(a < b) ==> (abs(a - b) = (b-a))`];
20747 TYPE_THEN `abs (inv(&2)) = inv(&2)` SUBGOAL_TAC;
20748 REWRITE_TAC[ABS_REFL;REAL_LE_INV_EQ];
20750 DISCH_THEN_REWRITE;
20756 FIRST_ASSUM DISJ_CASES_TAC;
20757 TYPE_THEN `b - e` EXISTS_TAC;
20758 REWRITE_TAC[REAL_ARITH `(b - e < b <=> &0 < e) /\ (b - (b - e) = e)`];
20759 REWRITE_TAC[REAL_ARITH `(a < b - e) <=> (a + e < b)`];
20761 IMATCH_MP_TAC (REAL_ARITH `(x = y) ==> (x <= y)`);
20762 REWRITE_TAC[REAL_ABS_REFL];
20767 TYPE_THEN `(b + a)/(&2)` EXISTS_TAC;
20768 ASM_SIMP_TAC[real_middle1_lt;real_middle2_lt;real_sub_half];
20769 ONCE_REWRITE_TAC [REAL_ARITH `(a + b) = (b + a)`];
20770 ASM_SIMP_TAC[real_middle1_lt;real_middle2_lt;real_sub_half];
20773 REWRITE_TAC[real_div;ABS_MUL];
20774 ASM_SIMP_TAC[REAL_ARITH `(a < b) ==> (abs(b - a) = (b-a))`];
20775 TYPE_THEN `abs (inv(&2)) = inv(&2)` SUBGOAL_TAC;
20776 REWRITE_TAC[ABS_REFL;REAL_LE_INV_EQ];
20778 DISCH_THEN_REWRITE;
20780 (* Sat Aug 7 09:45:29 EDT 2004 *)
20785 let interval_subset = prove_by_refinement(
20786 `!a b c d. {x | a <= x /\ x <= b} SUBSET {x | c <= x /\ x <= d} <=>
20787 (b < a) \/ ((c <= a ) /\ (b <= d))`,
20790 REWRITE_TAC[SUBSET ];
20792 ASM_CASES_TAC `b < a` ;
20799 TYPE_THEN `a` (WITH 1 o SPEC);
20800 TYPE_THEN `b` (USE 1 o SPEC);
20809 let subset_antisym_eq = prove_by_refinement(
20810 `!(A:A->bool) B. (A = B) <=> (A SUBSET B /\ B SUBSET A) `,
20813 REWRITE_TAC[SUBSET;FUN_EQ_THM ];
20818 let interval_eq = prove_by_refinement(
20819 (**** Parens added by JRH for real right associativity of =
20820 `!a b c d. {x | a <= x /\ x <= b} = {x | c <= x /\ x <= d} =
20821 ((b < a) /\ (d < c)) \/ ((c = a ) /\ (b = d))`,
20823 `!a b c d. ({x | a <= x /\ x <= b} = {x | c <= x /\ x <= d}) <=>
20824 ((b < a) /\ (d < c)) \/ ((c = a ) /\ (b = d))`,
20827 REWRITE_TAC[subset_antisym_eq;interval_subset;];
20832 let connected_open_closure = prove_by_refinement(
20833 `!A a b. (connected (top_of_metric(UNIV,d_real)) A /\
20834 (top_of_metric(UNIV,d_real) A) /\
20835 (closure (top_of_metric(UNIV,d_real)) A = {x | a <= x /\ x <= b}) ==>
20836 (A = { x | a < x /\ x < b }))`,
20840 (* deal WITH emptyset *)
20841 TYPE_THEN `A = EMPTY` ASM_CASES_TAC;
20844 ASM_SIMP_TAC[top_of_metric_top;metric_real;closure_empty;];
20846 IMATCH_MP_TAC EQ_EXT;
20849 FIRST_ASSUM (fun t -> MP_TAC (AP_THM t `x:real`));
20852 (* deal WITH containment *)
20853 TYPE_THEN `A SUBSET {x | a <= x /\ x <= b}` SUBGOAL_TAC;
20856 IMATCH_MP_TAC subset_closure;
20857 ASM_SIMP_TAC[top_of_metric_top;metric_real];
20859 (* quote previous result *)
20860 TYPE_THEN `( A = {x | inf A < x /\ x < supm A})` SUBGOAL_TAC;
20861 IMATCH_MP_TAC connected_open;
20862 TYPE_THEN `a` EXISTS_TAC;
20863 TYPE_THEN `b` EXISTS_TAC;
20866 (* now USE the closure of an open interval is the closed interval *)
20868 PROOF_BY_CONTR_TAC;
20869 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
20873 ASM ONCE_REWRITE_TAC [];
20876 TYPE_THEN `inf A < supm A` SUBGOAL_TAC;
20880 USE 7(MATCH_MP closure_open_interval);
20884 ASM ONCE_REWRITE_TAC[];
20887 IMATCH_MP_TAC EQ_EXT;
20890 USE 0(REWRITE_RULE[interval_eq]);
20891 FIRST_ASSUM DISJ_CASES_TAC;
20897 (* Sat Aug 7 10:38:12 EDT 2004 *)
20902 (* Sat Aug 7 11:01:27 EDT 2004 *)
20904 let closed_ball_empty = prove_by_refinement(
20905 `!n a r. (r < &0) ==> (closed_ball(euclid n,d_euclid) a r = EMPTY)`,
20908 REWRITE_TAC[closed_ball;EQ_EMPTY;];
20909 ASM_MESON_TAC[d_euclid_pos;REAL_ARITH `&0 <= d /\ d <= r ==> ~(r < &0)`];
20913 let closed_ball_pt = prove_by_refinement(
20914 `!n a. (closed_ball(euclid n,d_euclid) a (&0) SUBSET {a})`,
20917 REWRITE_TAC[closed_ball;SUBSET;INR IN_SING;];
20918 ASM_MESON_TAC [d_euclid_pos;d_euclid_zero;REAL_ARITH `(x <= &0 /\ &0 <= x) ==> (x = &0)`];
20922 let closed_ball_subset_open = prove_by_refinement(
20923 `!n a r. ?r'. closed_ball(euclid n,d_euclid) a r SUBSET
20924 open_ball(euclid n,d_euclid) a r'`,
20928 REWRITE_TAC[closed_ball;open_ball;SUBSET ];
20929 TYPE_THEN `r + &1` EXISTS_TAC;
20930 MESON_TAC[ REAL_ARITH `(u <= r) ==> (u < r + &1)`];
20934 let closed_ball_compact = prove_by_refinement(
20935 `!n a r. (compact (top_of_metric(euclid n,d_euclid))
20936 (closed_ball(euclid n,d_euclid) a r)) `,
20940 TYPE_THEN `closed_ball(euclid n,d_euclid) a r SUBSET (euclid n)` SUBGOAL_TAC;
20941 REWRITE_TAC[closed_ball;SUBSET];
20944 TYPE_THEN `open_ball(euclid n,d_euclid) a r SUBSET (euclid n)` SUBGOAL_TAC;
20945 REWRITE_TAC[open_ball;SUBSET];
20948 ASM_SIMP_TAC[compact_euclid;closed_ball_closed;metric_euclid;];
20949 REWRITE_TAC[metric_bounded];
20950 TYPE_THEN `a` EXISTS_TAC;
20951 TYPE_THEN `r + &1`EXISTS_TAC;
20952 REWRITE_TAC[open_ball;SUBSET;];
20956 REWRITE_TAC[closed_ball];
20958 TYPE_THEN `d_euclid a a = &0` SUBGOAL_TAC;
20959 ASM_MESON_TAC[d_euclid_zero];
20960 DISCH_THEN_REWRITE;
20961 ASM_MESON_TAC[d_euclid_pos;REAL_ARITH `&0 <= d /\ d <= r ==> &0 <= r`;REAL_ARITH `u <= r ==> (u < r + &1)`];
20962 (* Sat Aug 7 12:15:05 EDT 2004 *)
20967 let set_dist = jordan_def
20968 `set_dist d (K:A->bool) (K':B->bool) =
20969 inf { z | (?p p'. (K p /\ K' p' /\ (z = d p p')))}`;;
20971 let set_dist_inf = prove_by_refinement(
20972 `!(X:A->bool) d K K'. metric_space(X,d) /\ (K SUBSET X) /\
20974 (!p p'. (K p /\ K' p' ==> (set_dist d K K' <= d p p')))`,
20977 REWRITE_TAC[set_dist];
20979 TYPE_THEN `Y = {z | ?p p'. K p /\ K' p' /\ (z = d p p')}` ABBREV_TAC ;
20980 TYPE_THEN `!x. Y x ==> &0 <= x` SUBGOAL_TAC;
20986 RULE_ASSUM_TAC (REWRITE_RULE[metric_space]);
20987 ASM_MESON_TAC[ISUBSET];
20989 TYPE_THEN `Y (d p p')` SUBGOAL_TAC;
20996 TYPE_THEN `~(Y = {}) /\ (?t. !x. Y x ==> t <= x)` SUBGOAL_TAC;
20998 REWRITE_TAC[EMPTY_EXISTS];
20999 TYPE_THEN `d p p'` EXISTS_TAC;
21002 DISCH_THEN (ASSUME_TAC o (MATCH_MP inf_LB));
21007 let set_dist_nn = prove_by_refinement(
21008 `!(X:A->bool) d K K'. metric_space(X,d) /\ (K SUBSET X) /\
21009 ~(K = EMPTY) /\ ~(K' = EMPTY) /\
21010 (K' SUBSET X) ==> (&0 <= set_dist d K K')`,
21013 REWRITE_TAC[set_dist];
21015 TYPE_THEN `Y = {z | ?p p'. K p /\ K' p' /\ (z = d p p')}` ABBREV_TAC ;
21016 TYPE_THEN `!x. Y x ==> &0 <= x` SUBGOAL_TAC;
21023 RULE_ASSUM_TAC (REWRITE_RULE[metric_space]);
21024 ASM_MESON_TAC[ISUBSET];
21026 TYPE_THEN `~(Y = {})` SUBGOAL_TAC;
21027 REWRITE_TAC[EMPTY_EXISTS];
21028 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
21030 TYPE_THEN `d u' u` EXISTS_TAC;
21035 TYPE_THEN `~(Y = {}) /\ (?t. !x. Y x ==> t <= x)` SUBGOAL_TAC;
21037 DISCH_THEN (ASSUME_TAC o (MATCH_MP inf_LB));
21042 let set_dist_eq = prove_by_refinement(
21043 `!(X:A->bool) d K K'. metric_space(X,d) /\ (K SUBSET X) /\
21044 ~(K = EMPTY) /\ ~(K' = EMPTY) /\
21045 (compact (top_of_metric(X,d)) K) /\
21046 (compact (top_of_metric (X,d)) K') /\
21048 (?p p'. K p /\ K' p' /\ (set_dist d K K' = d p p'))`,
21051 REWRITE_TAC[set_dist];
21053 TYPE_THEN `Y = {z | ?p p'. K p /\ K' p' /\ (z = d p p')}` ABBREV_TAC ;
21054 TYPE_THEN `!x. Y x ==> &0 <= x` SUBGOAL_TAC;
21061 RULE_ASSUM_TAC (REWRITE_RULE[metric_space]);
21062 ASM_MESON_TAC[ISUBSET];
21064 TYPE_THEN `~(Y = {})` SUBGOAL_TAC;
21065 REWRITE_TAC[EMPTY_EXISTS];
21066 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
21068 TYPE_THEN `d u' u` EXISTS_TAC;
21073 TYPE_THEN `~(Y = {}) /\ (?t. !x. Y x ==> t <= x)` SUBGOAL_TAC;
21075 DISCH_THEN (ASSUME_TAC o (MATCH_MP inf_LB));
21076 TYPE_THEN `(?p p'. K p /\ K' p' /\ (!q q'. K q /\ K' q' ==> d p p' <= d q q'))` SUBGOAL_TAC;
21077 IMATCH_MP_TAC compact_distance;
21078 TYPE_THEN `X` EXISTS_TAC;
21081 TYPE_THEN `p` EXISTS_TAC;
21082 TYPE_THEN `p'` EXISTS_TAC;
21085 TYPE_THEN `Y (d p p')` SUBGOAL_TAC;
21090 IMATCH_MP_TAC (REAL_ARITH `a <= b /\ b <= a ==> (a = b)`);
21092 FIRST_ASSUM IMATCH_MP_TAC ;
21094 FIRST_ASSUM IMATCH_MP_TAC ;
21099 FIRST_ASSUM IMATCH_MP_TAC ;
21101 (* Sat Aug 7 13:19:01 EDT 2004 *)
21106 (* ------------------------------------------------------------------ *)
21108 (* ------------------------------------------------------------------ *)
21111 let simple_arc_compact = prove_by_refinement(
21112 `!C. simple_arc top2 C ==> compact top2 C`,
21116 REWRITE_TAC[simple_arc];
21119 IMATCH_MP_TAC image_compact;
21120 TYPE_THEN `top_of_metric(UNIV,d_real)` EXISTS_TAC;
21122 ASM_SIMP_TAC[inj_image_subset;interval_compact;];
21123 (* Sat Aug 7 12:24:22 EDT 2004 *)
21129 let simple_arc_nonempty = prove_by_refinement(
21130 `!C. simple_arc top2 C ==> ~(C = EMPTY)`,
21133 REWRITE_TAC[simple_arc;EMPTY_EXISTS;];
21135 ASM_REWRITE_TAC[IMAGE;];
21136 TYPE_THEN `f (&0)` EXISTS_TAC;
21137 TYPE_THEN `&0` EXISTS_TAC;
21143 let graph_edge_compact = prove_by_refinement(
21144 `!G e. (plane_graph G) /\ (graph_edge G e) ==>
21148 REWRITE_TAC [plane_graph];
21150 USE 3 (REWRITE_RULE[SUBSET]);
21151 ASM_MESON_TAC[simple_arc_compact];
21155 let graph_vertex_exist = prove_by_refinement(
21156 `!G. graph (G:(A,B)graph_t) /\ ~(graph_edge G = EMPTY) ==>
21157 (?v. graph_vertex G v)`,
21161 REWRITE_TAC[EMPTY_EXISTS];
21163 TYPE_THEN `graph_inc G u SUBSET graph_vertex G` SUBGOAL_TAC;
21164 ASM_SIMP_TAC[graph_inc_subset];
21166 TYPE_THEN `graph_inc G u HAS_SIZE 2` SUBGOAL_TAC;
21167 ASM_SIMP_TAC[graph_edge2;];
21168 REWRITE_TAC[has_size2];
21172 REWRITE_TAC[SUBSET ;INR in_pair ];
21178 let graph_vertex_2 = prove_by_refinement(
21179 `!G. graph (G:(A,B)graph_t) /\ ~(graph_edge G = EMPTY) ==>
21180 (?v v'. graph_vertex G v /\ graph_vertex G v' /\ ~(v = v'))`,
21183 REWRITE_TAC[EMPTY_EXISTS];
21185 TYPE_THEN `graph_inc G u SUBSET graph_vertex G` SUBGOAL_TAC;
21186 ASM_SIMP_TAC[graph_inc_subset];
21188 TYPE_THEN `graph_inc G u HAS_SIZE 2` SUBGOAL_TAC;
21189 ASM_SIMP_TAC[graph_edge2;];
21190 REWRITE_TAC[has_size2];
21193 TYPE_THEN `a` EXISTS_TAC;
21194 TYPE_THEN `b` EXISTS_TAC ;
21196 REWRITE_TAC[SUBSET ;INR in_pair ];
21201 let graph_disk_lemma1 = prove_by_refinement(
21202 `!G. plane_graph G /\ FINITE (graph_vertex G) /\ FINITE (graph_edge G)
21204 FINITE {z | (?e v. graph_edge G e /\ graph_vertex G v /\
21205 ~(graph_inc G e v) /\ (z = (e,v)))}`,
21209 TYPE_THEN `Y = {z | (?e v. graph_edge G e /\ graph_vertex G v /\ ~(graph_inc G e v) /\ (z = (e,v)))}` ABBREV_TAC ;
21210 IMATCH_MP_TAC FINITE_SUBSET;
21211 TYPE_THEN `{(e,v) | graph_edge G e /\ graph_vertex G v}` EXISTS_TAC;
21212 TYPEL_THEN [`graph_edge G `;`graph_vertex G `] (fun t -> ASSUME_TAC (ISPECL t FINITE_PRODUCT));
21216 REWRITE_TAC[SUBSET];
21218 (* Sat Aug 7 14:21:19 EDT 2004 *)
21223 let image_empty = prove_by_refinement(
21224 `!(A:A->bool) (f:A->B). (IMAGE f A = EMPTY) <=> (A = EMPTY)`,
21227 REWRITE_TAC[IMAGE;FUN_EQ_THM;];
21233 let pair_apply = prove_by_refinement(
21234 `!P. (!x. P x) <=> ! (u:A) (v:B) . P (u,v)`,
21243 TYPEL_THEN [`FST x`;`SND x`] (USE 0 o ISPECL);
21244 USE 0(REWRITE_RULE[]);
21249 let set_dist_pos = prove_by_refinement(
21250 `!(X:A->bool) d K K'. metric_space(X,d) /\ (K SUBSET X) /\
21251 ~(K = EMPTY) /\ ~(K' = EMPTY) /\
21252 (compact (top_of_metric(X,d)) K) /\
21253 (compact (top_of_metric (X,d)) K') /\ (K INTER K' = EMPTY) /\
21255 (&0 < (set_dist d K K' ))`,
21259 IMATCH_MP_TAC (REAL_ARITH `~(x = &0) /\ (&0 <= x) ==> (&0 < x)`);
21261 TYPE_THEN `(?p p'. K p /\ K' p' /\ (set_dist d K K' = d p p'))` SUBGOAL_TAC;
21262 IMATCH_MP_TAC set_dist_eq;
21263 TYPE_THEN `X` EXISTS_TAC;
21266 TYPE_THEN `p = p'` SUBGOAL_TAC;
21268 TYPE_THEN `X p /\ X p'` SUBGOAL_TAC;
21269 ASM_MESON_TAC[ISUBSET];
21274 ASM_MESON_TAC [metric_space_zero2];
21278 REWRITE_TAC[EQ_EMPTY;INTER;];
21280 IMATCH_MP_TAC set_dist_nn;
21281 TYPE_THEN `X` EXISTS_TAC;
21286 let closed_ball_inter = prove_by_refinement(
21287 `!(x:A) y r r' X d. (metric_space(X,d) /\
21288 ~(closed_ball(X,d) x r INTER closed_ball(X,d) y r' = EMPTY) ==>
21289 (d x y <= r + r'))`,
21293 REWRITE_TAC[closed_ball;EMPTY_EXISTS;INTER];
21295 TYPE_THEN `d x y <= d x u + d u y` SUBGOAL_TAC;
21296 IMATCH_MP_TAC metric_space_triangle;
21298 TYPE_THEN `d u y = d y u` SUBGOAL_TAC;
21299 IMATCH_MP_TAC metric_space_symm;
21308 let graph_disk = prove_by_refinement(
21309 `!G. plane_graph G /\
21310 FINITE (graph_edge G) /\ FINITE (graph_vertex G) /\
21311 ~(graph_edge G = EMPTY)
21312 ==> (?r. (&0 < r ) /\
21313 (!v v'. graph_vertex G v /\ graph_vertex G v' /\ ~(v = v') ==>
21314 (closed_ball (euclid 2,d_euclid) v r INTER
21315 closed_ball (euclid 2,d_euclid) v' r = EMPTY)) /\
21316 (!e v. (graph_edge G e /\ graph_vertex G v /\ ~(graph_inc G e v) ==>
21317 (e INTER closed_ball (euclid 2,d_euclid) v r = EMPTY) )))`,
21323 TYPE_THEN `A = { (v,v') | (graph_vertex G v) /\ graph_vertex G v' /\ ~(v = v') }` ABBREV_TAC ;
21324 TYPE_THEN `FINITE A` SUBGOAL_TAC;
21325 IMATCH_MP_TAC FINITE_SUBSET;
21326 TYPE_THEN `{ (v,v') | (graph_vertex G v) /\ graph_vertex G v'}` EXISTS_TAC;
21327 TYPEL_THEN [`graph_vertex G`;`graph_vertex G`] (fun t-> ASSUME_TAC (ISPECL t FINITE_PRODUCT));
21331 REWRITE_TAC[SUBSET];
21334 TYPE_THEN `A' = IMAGE (\ (v,v'). (d_euclid v v')/(&2)) A` ABBREV_TAC ;
21335 TYPE_THEN `FINITE A'` SUBGOAL_TAC;
21337 IMATCH_MP_TAC FINITE_IMAGE;
21341 TYPE_THEN `B = { (e,v) | graph_edge G e /\ graph_vertex G v /\ ~(graph_inc G e v) }` ABBREV_TAC ;
21342 TYPE_THEN `B' = IMAGE (\ (e,v). (set_dist d_euclid {v} e)) B` ABBREV_TAC ;
21343 TYPE_THEN `FINITE B'` SUBGOAL_TAC;
21345 IMATCH_MP_TAC FINITE_IMAGE;
21346 TYPE_THEN `B = {z | (?e v. graph_edge G e /\ graph_vertex G v /\ ~( graph_inc G e v) /\ (z = (e,v)))}` SUBGOAL_TAC;
21348 IMATCH_MP_TAC EQ_EXT;
21351 DISCH_THEN_REWRITE;
21352 IMATCH_MP_TAC graph_disk_lemma1;
21355 (* [C] : A' B' C nonempty *)
21356 TYPE_THEN `C' = A' UNION B'` ABBREV_TAC ;
21357 TYPE_THEN `FINITE C' /\ ~(C' = EMPTY)` SUBGOAL_TAC;
21359 ASM_REWRITE_TAC[FINITE_UNION];
21361 REWRITE_TAC[EMPTY_EXISTS;UNION;];
21362 TYPE_THEN `~(A' = EMPTY)` SUBGOAL_TAC;
21364 REWRITE_TAC[image_empty; ];
21365 TYPE_THEN `(?v v'. graph_vertex G v /\ graph_vertex G v' /\ ~(v = v'))` SUBGOAL_TAC;
21366 IMATCH_MP_TAC graph_vertex_2;
21368 ASM_MESON_TAC[plane_graph];
21373 REWRITE_TAC[EMPTY_EXISTS];
21374 CONV_TAC (dropq_conv "u");
21375 TYPE_THEN `v` EXISTS_TAC;
21376 TYPE_THEN `v'` EXISTS_TAC ;
21378 REWRITE_TAC[EMPTY_EXISTS];
21381 (* [D]: C(inf C) *)
21382 TYPE_THEN `graph_vertex G SUBSET (euclid 2)` SUBGOAL_TAC;
21384 REWRITE_TAC[plane_graph];
21388 TYPE_THEN `C'(inf C')` SUBGOAL_TAC;
21389 IMATCH_MP_TAC finite_inf;
21393 TYPE_THEN `!x. C' x ==> (inf C' <= x)` SUBGOAL_TAC;
21394 IMATCH_MP_TAC finite_inf_min;
21398 TYPE_THEN `!v. (graph_vertex G v ==> compact top2 {v})` SUBGOAL_TAC;
21400 IMATCH_MP_TAC compact_point;
21402 REWRITE_TAC[SUBSET;top2_unions];
21407 TYPE_THEN `!e. (graph_edge G e ==> compact top2 e)` SUBGOAL_TAC;
21408 ASM_MESON_TAC[graph_edge_compact];
21411 TYPE_THEN `!x. A' x <=> (?v' v''. graph_vertex G v' /\ graph_vertex G v'' /\ ~(v' = v'') /\ (x = d_euclid v' v'' / &2))` SUBGOAL_TAC;
21414 REWRITE_TAC[IMAGE];
21416 CONV_TAC (dropq_conv "x'");
21417 (*** Next steps removed by JRH: now paired beta-conversion automatic ***)
21420 TYPE_THEN `!x. B' x <=> (?e' v'. graph_edge G e' /\ graph_vertex G v' /\ ~(graph_inc G e' v') /\ (x = set_dist d_euclid { v' } e'))`
21424 REWRITE_TAC[IMAGE];
21426 CONV_TAC (dropq_conv "x'");
21427 (*** Next steps removed by JRH: now paired beta-conversion automatic ***)
21430 TYPE_THEN `!x. C' x ==> (&0 < x)` SUBGOAL_TAC;
21432 REWRITE_TAC[UNION];
21434 DISCH_THEN DISJ_CASES_TAC;
21438 ASM_REWRITE_TAC[REAL_LT_HALF1];
21439 IMATCH_MP_TAC (REAL_ARITH `(&0 <= y /\ ~(y = &0) ) ==> &0 < y `);
21440 TYPE_THEN `euclid 2 v' /\ euclid 2 v''` SUBGOAL_TAC;
21441 ASM_MESON_TAC[ISUBSET];
21443 ASM_MESON_TAC [d_euclid_pos;d_euclid_zero;];
21449 IMATCH_MP_TAC set_dist_pos;
21450 TYPE_THEN `euclid 2` EXISTS_TAC ;
21451 REWRITE_TAC[metric_euclid;single_subset];
21454 REWRITE_TAC[SUBSET];
21458 REWRITE_TAC[EMPTY_EXISTS;INR IN_SING;];
21461 IMATCH_MP_TAC simple_arc_nonempty;
21464 REWRITE_TAC[plane_graph;SUBSET;];
21466 REWRITE_TAC[GSYM top2];
21469 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
21473 TYPE_THEN `v'` (fun u -> FIRST_ASSUM (fun t-> (MP_TAC (AP_THM t u))));
21474 ASM_REWRITE_TAC[EQ_EMPTY;];
21475 REWRITE_TAC[INTER];
21476 ASM_REWRITE_TAC[INR IN_SING;];
21480 REWRITE_TAC[compact;top2_unions];
21483 (* [E] r good for A' *)
21484 TYPE_THEN `?r. (&0 < r /\ r < inf C')` SUBGOAL_TAC;
21485 TYPE_THEN `inf C' /(&2)` EXISTS_TAC;
21486 IMATCH_MP_TAC half_pos;
21491 TYPE_THEN `r` EXISTS_TAC;
21495 TYPE_THEN `A' ((d_euclid v v')/(&2))` SUBGOAL_TAC;
21500 TYPE_THEN `r < ((d_euclid v v')/(&2))` SUBGOAL_TAC;
21501 IMATCH_MP_TAC (REAL_ARITH `(?t . (r < t /\ t <= u)) ==> (r < u)`);
21502 TYPE_THEN `inf C'` EXISTS_TAC;
21504 FIRST_ASSUM IMATCH_MP_TAC ;
21506 REWRITE_TAC[UNION];
21509 REWRITE_TAC[EQ_EMPTY ;INTER;];
21511 (* -2- triangle ineq *)
21516 POP_ASSUM_LIST (fun t-> ALL_TAC);
21519 TYPE_THEN `d_euclid v v' <= r + r` SUBGOAL_TAC;
21520 IMATCH_MP_TAC closed_ball_inter;
21521 TYPE_THEN `euclid 2` EXISTS_TAC;
21522 REWRITE_TAC[INTER;EMPTY_EXISTS ;metric_euclid;];
21525 TYPE_THEN `d_euclid v v' < d_euclid v v'/(&2) + d_euclid v v'/(&2)` SUBGOAL_TAC;
21526 IMATCH_MP_TAC (REAL_ARITH `(?t. (d <= t + t /\ t < u)) ==> (d < u + u)`);
21527 TYPE_THEN `r` EXISTS_TAC;
21529 REWRITE_TAC[REAL_HALF_DOUBLE];
21531 (* [F] good for B' *)
21533 PROOF_BY_CONTR_TAC;
21534 USE 27(REWRITE_RULE[EMPTY_EXISTS;INTER;]);
21537 TYPE_THEN `B' (set_dist d_euclid {v} e)` SUBGOAL_TAC;
21539 TYPE_THEN `e` EXISTS_TAC;
21540 TYPE_THEN `v` EXISTS_TAC;
21544 TYPE_THEN `r < set_dist d_euclid {v} e` SUBGOAL_TAC;
21545 IMATCH_MP_TAC (REAL_ARITH `(?t. (r < t /\ t <= q)) ==> (r < q)`);
21546 TYPE_THEN `inf C'` EXISTS_TAC;
21548 FIRST_ASSUM IMATCH_MP_TAC ;
21550 REWRITE_TAC[UNION];
21554 TYPE_THEN `(!p p'. ({v} p /\ e p' ==> (set_dist d_euclid {v} e <= d_euclid p p')))` SUBGOAL_TAC;
21555 IMATCH_MP_TAC set_dist_inf;
21556 TYPE_THEN `euclid 2` EXISTS_TAC;
21557 ASM_REWRITE_TAC[metric_euclid;single_subset;];
21561 MESON_TAC[ISUBSET];
21564 REWRITE_TAC[compact;top2_unions;];
21567 TYPE_THEN `set_dist d_euclid {v} e <= d_euclid v u` SUBGOAL_TAC;
21568 FIRST_ASSUM IMATCH_MP_TAC ;
21569 ASM_REWRITE_TAC[INR IN_SING];
21570 TYPE_THEN `d_euclid v u <= r` SUBGOAL_TAC;
21572 REWRITE_TAC[closed_ball];
21576 (* Sat Aug 7 21:33:13 EDT 2004 *)
21582 let norm2 = jordan_def `norm2 x = d_euclid x euclid0`;;
21584 let cis = jordan_def `cis x = point(cos(x),sin(x))`;;
21586 let norm2_cis = prove_by_refinement(
21587 `!x. norm2(cis(x)) = &1`,
21590 REWRITE_TAC[norm2;cis;euclid0_point;d_euclid_point];
21592 ONCE_REWRITE_TAC [REAL_ARITH `(x + y) = (y + x)`];
21593 REWRITE_TAC[SIN_CIRCLE;SQRT_1];
21594 (* Sat Aug 7 21:47:16 EDT 2004 *)
21598 let norm2_nn = prove_by_refinement(
21599 `!x . (euclid 2 x) ==> &0 <= norm2 x`,
21602 REWRITE_TAC[norm2;euclid0_point];
21603 ASM_MESON_TAC[d_euclid_pos;euclid_point];
21604 (* Sat Aug 7 21:52:31 EDT 2004 *)
21609 let norm2_0 = prove_by_refinement(
21610 `!x. (euclid 2 x) /\ (norm2 x = &0) <=> (x = euclid0)`,
21615 REWRITE_TAC[norm2;euclid0_point;];
21616 MESON_TAC[d_euclid_zero;euclid_point];
21617 DISCH_THEN_REWRITE;
21618 REWRITE_TAC[euclid0_point;euclid_point;norm2;];
21619 ASM_MESON_TAC[d_euclid_zero;euclid_point];
21620 (* Sat Aug 7 21:59:11 EDT 2004 *)
21624 let cis_inj = prove_by_refinement(
21625 `!t t'. (&0 <= t /\ t < &2*pi) /\ (&0 <= t' /\ t' < &2*pi) ==>
21626 ((cis t = cis t') <=> (t = t'))`,
21629 (* A trivial direction *)
21631 REWRITE_TAC[cis;point_inj;PAIR_SPLIT ];
21632 ONCE_REWRITE_TAC [EQ_SYM_EQ];
21634 DISCH_THEN_REWRITE;
21637 TYPE_THEN `s = (\t. (if (t < pi) then t else ((&2)*pi - t)))` ABBREV_TAC ;
21638 TYPE_THEN `!t. (&0 <= t /\ t < (&2 * pi)) ==> (&0 <= s t /\ s t <= pi)` SUBGOAL_TAC;
21648 REWRITE_TAC[REAL_MUL_2;];
21652 (* [C] : cos (s t) *)
21653 TYPE_THEN `!t. cos (s t) = cos t` SUBGOAL_TAC;
21658 REWRITE_TAC [REAL_ARITH `x - t = (--. t + x)`;COS_PERIODIC;COS_NEG];
21660 (* D : (s t) = (s t') *)
21661 TYPE_THEN `(s t= s t') ==> ((t = t') \/ (t' = (&2 * pi - t)))` SUBGOAL_TAC;
21671 (* E : show s t = s t' *)
21674 (ASM ONCE_REWRITE_TAC []);
21675 DISCH_THEN (fun t -> MP_TAC (AP_TERM `acs` t));
21677 TYPE_THEN `s t = s t'` SUBGOAL_TAC;
21678 TYPE_THEN `acs (cos (s t)) = s t` SUBGOAL_TAC;
21679 IMATCH_MP_TAC COS_ACS;
21680 FIRST_ASSUM IMATCH_MP_TAC ;
21682 TYPE_THEN `acs (cos (s t')) = s t'` SUBGOAL_TAC;
21683 IMATCH_MP_TAC COS_ACS;
21684 FIRST_ASSUM IMATCH_MP_TAC ;
21689 FIRST_ASSUM DISJ_CASES_TAC;
21691 PROOF_BY_CONTR_TAC;
21694 REWRITE_TAC[(REAL_ARITH `x - y = -- y + x`);SIN_PERIODIC ;SIN_NEG ;];
21695 REWRITE_TAC [(REAL_ARITH `(x = --x) <=> (x = &0)`)];
21696 REWRITE_TAC[SIN_ZERO_PI];
21697 PROOF_BY_CONTR_TAC;
21698 USE 4 (REWRITE_RULE[]);
21699 (* now t is a MULT of pi, finish *)
21700 FIRST_ASSUM DISJ_CASES_TAC;
21705 ASM_SIMP_TAC[REAL_LT_RMUL_EQ];
21706 REWRITE_TAC [REAL_LT];
21707 REWRITE_TAC[ARITH_RULE `n <| 2 <=> (n = 0) \/ (n =1)`];
21709 FIRST_ASSUM DISJ_CASES_TAC;
21722 REWRITE_TAC[REAL_ARITH (` ~(&0 <= -- x) <=> (&0 <. x) `)];
21723 IMATCH_MP_TAC REAL_LT_MUL;
21724 ASM_REWRITE_TAC[REAL_LT ];
21725 REWRITE_TAC[ARITH_RULE `0 <| n <=> ~(n = 0)`];
21730 (* Sun Aug 8 08:42:13 EDT 2004 *)
21735 let norm2_scale_cis = prove_by_refinement(
21736 `!x r. norm2(r *# cis(x)) = abs (r)`,
21740 REWRITE_TAC[norm2;cis;euclid0_point;d_euclid_point;point_scale;];
21742 REWRITE_TAC[POW_MUL;GSYM REAL_LDISTRIB];
21743 ONCE_REWRITE_TAC [REAL_ARITH `(x + y) = (y + x)`];
21744 REWRITE_TAC[SIN_CIRCLE;REAL_MUL_RID;POW_2_SQRT_ABS];
21745 (* Sun Aug 8 08:46:56 EDT 2004 *)
21751 let norm2_scale = prove_by_refinement(
21752 `!x r. (euclid 2 x) ==> (norm2(r *# x) = abs (r)*norm2(x))`,
21756 TYPE_THEN `?u v. (x = point(u,v))` SUBGOAL_TAC;
21757 USE 0 (MATCH_MP point_onto);
21759 TYPE_THEN `FST p` EXISTS_TAC;
21760 TYPE_THEN `SND p` EXISTS_TAC;
21764 REWRITE_TAC[norm2;cis;euclid0_point;d_euclid_point;point_scale;];
21766 REWRITE_TAC[POW_MUL;GSYM REAL_LDISTRIB];
21767 REWRITE_TAC[GSYM POW_2_SQRT_ABS];
21768 IMATCH_MP_TAC SQRT_MUL;
21769 REWRITE_TAC[REAL_LE_SQUARE_POW];
21770 IMATCH_MP_TAC (REAL_ARITH `&0 <= x /\ &0 <= y ==> &0 <= x + y`);
21771 REWRITE_TAC[REAL_LE_SQUARE_POW];
21776 let polar_inj = prove_by_refinement(
21777 `!x x' r r'. (&0 <= r) /\ (&0 <= r') /\ (&0 <= x) /\ (&0 <= x') /\
21778 (x < &2 *pi) /\ (x' < &2 * pi) /\ (r *# cis(x) = r' *# cis(x')) ==>
21779 ((r = &0) /\ (r' = &0)) \/ ((r = r') /\ (x = x'))`,
21784 TYPE_THEN `abs r = abs r'` SUBGOAL_TAC;
21785 FIRST_ASSUM (fun t -> MP_TAC (AP_TERM `norm2` t));
21786 REWRITE_TAC[norm2_scale_cis];
21788 TYPE_THEN `r' = r` SUBGOAL_TAC;
21789 ASM_MESON_TAC[ABS_REFL];
21792 ASM_CASES_TAC `(r = &0)` ;
21796 TYPE_THEN `cis x = cis x'` SUBGOAL_TAC;
21797 IMATCH_MP_TAC euclid_scale_cancel;
21799 ASM_MESON_TAC[cis_inj];
21804 let norm2_bounds = prove_by_refinement(
21805 `!a b s t. (&0 < a) /\ (a < b) /\ (&0 <= t) /\ (t <= &1) ==>
21806 (a <= norm2((a + t*(b-a))*# cis(s))) /\
21807 ( norm2((a + t*(b-a))*# cis(s)) <= b) `,
21811 REWRITE_TAC[norm2_scale_cis];
21812 TYPE_THEN `a <= a + t*(b - a)` SUBGOAL_TAC;
21813 REWRITE_TAC[REAL_ARITH `x <= x + y <=> (&0 <= y)`];
21814 IMATCH_MP_TAC REAL_LE_MUL;
21819 TYPE_THEN `&0 <= a + t*(b-a)` SUBGOAL_TAC;
21824 TYPE_THEN `abs (a + t*(b-a)) = a + t*(b-a)` SUBGOAL_TAC;
21825 REWRITE_TAC[ABS_REFL];
21827 DISCH_THEN_REWRITE;
21829 ineq_le_tac `(a + t*(b-a)) + (&1 - t)*(b - a) = b`;
21830 (* Sun Aug 8 09:12:18 EDT 2004 *)
21835 let norm2_point = prove_by_refinement(
21836 `!u v. norm2(point(u,v)) = sqrt(u pow 2 + v pow 2)`,
21839 REWRITE_TAC[norm2;euclid0_point;d_euclid_point;];
21844 let cis_exist_lemma = prove_by_refinement(
21845 `!x. (euclid 2 x) /\ (norm2 x = &1) ==>
21846 (? t. x = cis(t))`,
21850 TYPE_THEN `? u v. x = point (u,v)` SUBGOAL_TAC;
21851 USE 1 (MATCH_MP point_onto);
21853 TYPE_THEN `FST p` EXISTS_TAC;
21854 TYPE_THEN `SND p` EXISTS_TAC;
21860 REWRITE_TAC[norm2_point];
21862 USE 0 (fun t -> AP_TERM `\t. t pow 2` t);
21866 TYPE_THEN `(sqrt (u pow 2 + v pow 2) pow 2 = u pow 2 + v pow 2)` SUBGOAL_TAC;
21867 IMATCH_MP_TAC SQRT_POW_2;
21868 IMATCH_MP_TAC (REAL_ARITH `&0 <= x /\ &0 <= y ==> &0 <= x + y`);
21869 ASM_REWRITE_TAC[REAL_LE_POW_2];
21870 DISCH_THEN_REWRITE;
21871 DISCH_THEN (fun t -> MP_TAC (MATCH_MP CIRCLE_SINCOS t));
21873 ASM_REWRITE_TAC[cis];
21879 let cos_period = prove_by_refinement(
21880 `! j t. (cos (t + &j * &2 *pi) = cos(t))`,
21885 REWRITE_TAC[ADD1;GSYM REAL_ADD;REAL_ADD_RDISTRIB;REAL_ADD_ASSOC;];
21887 REWRITE_TAC[COS_PERIODIC];
21892 let sin_period = prove_by_refinement(
21893 `! j t. (sin (t + &j * &2 *pi) = sin(t))`,
21898 REWRITE_TAC[ADD1;GSYM REAL_ADD;REAL_ADD_RDISTRIB;REAL_ADD_ASSOC;];
21900 REWRITE_TAC[SIN_PERIODIC];
21905 let cos_period_neg = prove_by_refinement(
21906 `! j t. (cos (t - &j * &2 *pi) = cos(t))`,
21910 ASSUME_TAC cos_period;
21911 TYPEL_THEN [`j`;`t - &j * &2 * pi`] (USE 0 o ISPECL);
21912 RULE_ASSUM_TAC (REWRITE_RULE [REAL_ARITH `t - x + x = t`]);
21918 let sin_period_neg = prove_by_refinement(
21919 `! j t. (sin (t - &j * &2 *pi) = sin(t))`,
21923 ASSUME_TAC sin_period;
21924 TYPEL_THEN [`j`;`t - &j * &2 * pi`] (USE 0 o ISPECL);
21925 RULE_ASSUM_TAC (REWRITE_RULE [REAL_ARITH `t - x + x = t`]);
21931 let cos_period_int = prove_by_refinement(
21932 `!m t. (cos (t + real_of_int m * &2 *pi) = cos (t))`,
21936 ASSUME_TAC INT_REP2 ;
21939 FIRST_ASSUM DISJ_CASES_TAC;
21940 ASM_REWRITE_TAC[int_of_num_th;cos_period];
21941 ASM_REWRITE_TAC[int_of_num_th;int_neg_th;cos_period_neg;GSYM real_sub;REAL_MUL_LNEG];
21945 let sin_period_int = prove_by_refinement(
21946 `!m t. (sin (t + real_of_int m * &2 *pi) = sin (t))`,
21950 ASSUME_TAC INT_REP2 ;
21953 FIRST_ASSUM DISJ_CASES_TAC;
21954 ASM_REWRITE_TAC[int_of_num_th;sin_period];
21955 ASM_REWRITE_TAC[int_of_num_th;int_neg_th;sin_period_neg;GSYM real_sub;REAL_MUL_LNEG];
21959 let cos_sin_reduce = prove_by_refinement(
21960 `!t. ?t'. (cos t = cos t') /\
21961 (sin t = sin t') /\ (&0 <= t') /\ (t' < &2 * pi)`,
21966 ASSUME_TAC floor_ineq;
21967 TSPEC `t/(&2 *pi)` 0;
21968 TYPE_THEN `f = floor (t/(&2 * pi))` ABBREV_TAC ;
21970 TYPE_THEN `t' = t - real_of_int(f)*(&2)*pi` ABBREV_TAC ;
21971 TYPE_THEN `t'` EXISTS_TAC;
21972 TYPE_THEN `t' = t + real_of_int (--: f) *(&2)*pi` SUBGOAL_TAC;
21974 REWRITE_TAC[REAL_ARITH `x -y = x + (-- y)`;REAL_ARITH `-- (x * y) = (-- x)*y`;GSYM int_neg_th];
21977 ASM_REWRITE_TAC[cos_period_int];
21979 ASM_REWRITE_TAC[sin_period_int];
21981 TYPE_THEN `&0 < (&2 *pi)` SUBGOAL_TAC;
21982 REWRITE_TAC[REAL_MUL_2];
21986 TYPE_THEN `~(&0 = &2* pi)` SUBGOAL_TAC;
21990 TYPE_THEN `t = (t/(&2 *pi))*(&2 *pi)` SUBGOAL_TAC;
21991 ASM_SIMP_TAC[REAL_DIV_RMUL];
21994 TYPE_THEN `&0 <= (t/(&2*pi))*(&2*pi) - real_of_int f * (&2*pi)` SUBGOAL_TAC;
21995 REWRITE_TAC[GSYM REAL_SUB_RDISTRIB];
21996 IMATCH_MP_TAC REAL_LE_MUL;
22002 DISCH_THEN_REWRITE;
22004 TYPE_THEN ` (t/(&2*pi))*(&2*pi) - real_of_int f * (&2*pi) < &1* &2*pi` SUBGOAL_TAC;
22005 REWRITE_TAC[GSYM REAL_SUB_RDISTRIB];
22006 IMATCH_MP_TAC REAL_LT_RMUL;
22012 (* Tue Aug 10 09:57:36 EDT 2004 *)
22018 let cis_lemma = prove_by_refinement(
22019 `!x. (euclid 2 x) /\ (norm2 x = &1) ==>
22020 (?t. &0 <= t /\ t < &2 * pi /\ (x = cis t))`,
22024 TYPE_THEN `(?t. x = cis t)` SUBGOAL_TAC;
22025 IMATCH_MP_TAC cis_exist_lemma;
22028 ASSUME_TAC cos_sin_reduce;
22031 ASM_REWRITE_TAC[cis;point_inj;PAIR_SPLIT];
22033 (* Tue Aug 10 10:01:55 EDT 2004 *)
22037 let polar_exist = prove_by_refinement(
22038 `!x. (euclid 2 x) ==>
22039 (?r t. (&0 <= t /\ t < &2 * pi /\ &0 <= r /\ (x = r *# cis(t))))`,
22042 (* A: trivial case of norm 0 *)
22044 ASM_CASES_TAC `norm2 x = &0` ;
22045 TYPE_THEN `x = euclid0` SUBGOAL_TAC;
22046 ASM_MESON_TAC[norm2_0];
22047 DISCH_THEN_REWRITE;
22048 TYPE_THEN `&0` EXISTS_TAC;
22049 TYPE_THEN `&0` EXISTS_TAC;
22050 REWRITE_TAC[euclid_scale0;REAL_MUL_2 ];
22053 (* B: rescale to 1 *)
22054 TYPE_THEN `&0 < norm2 x` SUBGOAL_TAC;
22055 IMATCH_MP_TAC (REAL_ARITH `~(x = &0) /\ (&0 <= x) ==> (&0 < x)`);
22057 IMATCH_MP_TAC norm2_nn;
22059 TYPE_THEN `r = norm2 x ` ABBREV_TAC ;
22061 TYPE_THEN `r` EXISTS_TAC;
22062 TYPE_THEN `y = (&1/r)*# x` ABBREV_TAC ;
22063 TYPE_THEN `x = r*# y` SUBGOAL_TAC;
22065 REWRITE_TAC[euclid_scale_act;GSYM real_div_assoc];
22067 ASM_SIMP_TAC[REAL_DIV_REFL; euclid_scale_one;];
22071 TYPE_THEN `euclid 2 y` SUBGOAL_TAC;
22073 IMATCH_MP_TAC euclid_scale_closure;
22077 ASM_SIMP_TAC[norm2_scale];
22078 TYPE_THEN `abs r = r` SUBGOAL_TAC;
22079 ASM_REWRITE_TAC[REAL_ABS_REFL];
22082 DISCH_THEN_REWRITE;
22084 TYPE_THEN `norm2 y = &1` SUBGOAL_TAC;
22085 IMATCH_MP_TAC REAL_EQ_LCANCEL_IMP;
22086 TYPE_THEN `r` EXISTS_TAC;
22090 (* C: invoke norm2=1 case *)
22091 TYPE_THEN `(?t. &0 <= t /\ t < &2 * pi /\ (y = cis t))` SUBGOAL_TAC;
22092 IMATCH_MP_TAC cis_lemma;
22095 TYPE_THEN `t` EXISTS_TAC;
22103 vert r = hyperplane 2 e1 r
22104 horz r = hyperplane 2 e2 r
22105 cf. line2D_F..., line2D_S....
22108 let subset_union_pair = prove_by_refinement(
22109 `!(A:A->bool) B A' B'. (A SUBSET A') /\ (B SUBSET B') ==>
22110 (A UNION B) SUBSET (A' UNION B')`,
22113 REWRITE_TAC[SUBSET;UNION];
22118 let subset_inter_pair = prove_by_refinement(
22119 `!(A:A->bool) B A' B'. (A SUBSET A') /\ (B SUBSET B') ==>
22120 (A INTER B) SUBSET (A' INTER B')`,
22123 REWRITE_TAC[SUBSET;INTER];
22128 let simple_arc_end_simple = prove_by_refinement(
22129 `!C v v'. simple_arc_end C v v' ==> simple_arc top2 C`,
22132 REWRITE_TAC[simple_arc_end;simple_arc];
22134 REWRITE_TAC[top2_unions];
22135 TYPE_THEN `f` EXISTS_TAC;
22137 (* Tue Aug 10 10:33:30 EDT 2004 *)
22142 let simple_arc_end_restriction = prove_by_refinement(
22143 `!C K K' . simple_arc top2 C /\ closed_ top2 K /\
22144 closed_ top2 K' /\ (C INTER K INTER K' = EMPTY ) /\
22145 ~(C INTER K = EMPTY ) /\ ~(C INTER K' = EMPTY) ==>
22146 (?C' v v'. C' SUBSET C /\ simple_arc_end C' v v' /\
22147 (C' INTER K = {v}) /\ (C' INTER K' = {v'})) `,
22152 TYPE_THEN `(?C' f. (C' = IMAGE f {x | &0 <= x /\ x <= &1 }) /\ C' SUBSET C /\ continuous f (top_of_metric (UNIV,d_real)) top2 /\ INJ f {x | &0 <= x /\ x <= (&1)} (euclid 2) /\ (C' INTER K = {(f (&0))}) /\ (C' INTER K' = {(f (&1))}))` SUBGOAL_TAC;
22153 IMATCH_MP_TAC curve_restriction;
22157 TYPE_THEN `C'` EXISTS_TAC;
22158 TYPE_THEN `f(&0)` EXISTS_TAC;
22159 TYPE_THEN `f(&1)` EXISTS_TAC;
22161 REWRITE_TAC[simple_arc_end];
22162 TYPE_THEN `f` EXISTS_TAC;
22168 let simple_arc_end_trans = prove_by_refinement(
22169 `!C C' v v' v'' . simple_arc_end C v v' /\ simple_arc_end C' v' v'' /\
22170 ( C INTER C' = {v'}) ==>
22171 simple_arc_end (C UNION C') v v''`,
22174 REWRITE_TAC[simple_arc_end];
22176 TYPE_THEN `continuous f (top_of_metric (UNIV,d_real)) top2 /\ INJ f {x | &0 <= x /\ x <= &1} (euclid 2) /\ &0 < &1/(&2) /\ &0 < &1` SUBGOAL_TAC;
22177 ASM_REWRITE_TAC[REAL_LT_HALF1];
22179 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
22182 TYPE_THEN `continuous f' (top_of_metric (UNIV,d_real)) top2 /\ INJ f' {x | &0 <= x /\ x <= &1} (euclid 2) /\ &1/(&2) < &1 /\ &0 < &1` SUBGOAL_TAC;
22183 ASM_REWRITE_TAC[REAL_LT_HALF2];
22185 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
22188 TYPE_THEN `joinf g g' (&1/(&2))` EXISTS_TAC;
22190 TYPE_THEN `&0 < &1/(&2) /\ &1/(&2) < &1` SUBGOAL_TAC;
22191 REWRITE_TAC[REAL_LT_HALF1;REAL_LT_HALF2];
22195 TYPE_THEN `{x | &0 <= x /\ x <= &1} = {x | &0 <= x /\ x < &1/(&2)} UNION {x | &1/(&2) <= x /\ x <= &1}` SUBGOAL_TAC;
22196 IMATCH_MP_TAC (GSYM union_closed_interval);
22201 TYPE_THEN `{x | &0 <= x /\ x < &1} SUBSET {x | &0 <= x /\ x <= &1}` SUBGOAL_TAC;
22202 REWRITE_TAC[SUBSET];
22206 TYPE_THEN `{x | &0 <= x /\ x < &1 / &2} SUBSET {x | x < &1/(&2)}` SUBGOAL_TAC;
22207 REWRITE_TAC[SUBSET];
22211 TYPE_THEN `{x | &1 / &2 <= x /\ x <= &1} SUBSET {x | &1/ (&2) <= x}` SUBGOAL_TAC;
22212 REWRITE_TAC[SUBSET];
22215 TYPE_THEN `{x | &0 <= x /\ x <= &1/(&2)} = {x | &0 <= x /\ x < &1/(&2)} UNION {(&1 /(&2))}` SUBGOAL_TAC;
22216 IMATCH_MP_TAC EQ_EXT;
22217 REWRITE_TAC[UNION;INR IN_SING ];
22223 TYPE_THEN `g (&1/(&2)) = g' (&1/(&2))` SUBGOAL_TAC;
22229 ASM_REWRITE_TAC[IMAGE_UNION];
22230 ASM_SIMP_TAC[joinf_image_above;joinf_image_below];
22231 IMATCH_MP_TAC SUBSET_ANTISYM;
22233 REWRITE_TAC[union_subset];
22236 REWRITE_TAC[SUBSET_UNION];
22237 REWRITE_TAC[SUBSET;UNION];
22238 REWRITE_TAC[IMAGE;INR IN_SING;];
22241 CONV_TAC (dropq_conv "x''");
22243 DISCH_THEN_REWRITE;
22245 DISCH_THEN_REWRITE;
22247 TYPE_THEN `&1/(&2)` EXISTS_TAC;
22251 REWRITE_TAC[SUBSET_UNION];
22254 ASM_REWRITE_TAC[GSYM IMAGE_UNION];
22255 REWRITE_TAC[union_subset];
22257 IMATCH_MP_TAC SUBSET_TRANS;
22258 TYPE_THEN `IMAGE g {x | &0 <= x /\ x <= &1/(&2)}` EXISTS_TAC;
22260 IMATCH_MP_TAC IMAGE_SUBSET;
22261 ASM_REWRITE_TAC[SUBSET;];
22263 REWRITE_TAC[SUBSET_UNION];
22264 REWRITE_TAC[SUBSET_UNION];
22266 (* [C]: cont,INJ *)
22268 IMATCH_MP_TAC joinf_cont;
22273 IMATCH_MP_TAC inj_split;
22274 ASM_SIMP_TAC[joinf_inj_above;joinf_inj_below];
22276 IMATCH_MP_TAC inj_subset_domain;
22277 TYPE_THEN `{x | &0 <= x /\ x <= &1/(&2)}` EXISTS_TAC;
22278 ASM_REWRITE_TAC[SUBSET_UNION];
22280 TYPE_THEN `IMAGE (joinf g g' (&1 / &2)) {x | &0 <= x /\ x < &1 / &2} = IMAGE g {x | &0 <= x /\ x < &1 / &2}` SUBGOAL_TAC;
22281 ASM_SIMP_TAC[joinf_image_below];
22282 DISCH_THEN_REWRITE;
22283 TYPE_THEN `IMAGE (joinf g g' (&1 / &2)) {x | &1 / &2 <= x /\ x <= &1} = IMAGE g' {x | &1 / &2 <= x /\ x <= &1}` SUBGOAL_TAC;
22284 ASM_SIMP_TAC[joinf_image_above];
22285 DISCH_THEN_REWRITE;
22286 TYPE_THEN `IMAGE g {x | &0 <= x /\ x < &1 / &2} INTER IMAGE g' {x | &1 / &2 <= x /\ x <= &1} SUBSET {v'}` SUBGOAL_TAC;
22288 DISCH_THEN (fun t -> REWRITE_TAC[SYM t]);
22291 IMATCH_MP_TAC subset_inter_pair;
22292 REWRITE_TAC[SUBSET_REFL];
22293 IMATCH_MP_TAC IMAGE_SUBSET;
22294 ASM_REWRITE_TAC[SUBSET ];
22297 TYPE_THEN `IMAGE g {x | &0 <= x /\ x < &1 /(&2)} INTER {v'} = EMPTY` SUBGOAL_TAC;
22298 REWRITE_TAC[EQ_EMPTY];
22300 REWRITE_TAC[IMAGE;INTER;INR IN_SING;DE_MORGAN_THM;];
22303 IMATCH_MP_TAC (TAUT `(B ==> A) ==> A \/ ~B`);
22304 DISCH_THEN_REWRITE;
22307 TYPE_THEN `x' = &1/(&2)` SUBGOAL_TAC;
22308 USE 15 (REWRITE_RULE[INJ]);
22310 FIRST_ASSUM IMATCH_MP_TAC ;
22314 TYPE_THEN `g x' = g(&1/(&2))` SUBGOAL_TAC;
22316 DISCH_THEN_REWRITE;
22323 REWRITE_TAC[SUBSET;EQ_EMPTY ;INTER;INR IN_SING;];
22324 POP_ASSUM_LIST (fun t -> ALL_TAC);
22330 (* [D] final touches *)
22332 REWRITE_TAC[joinf];
22335 REWRITE_TAC[joinf];
22336 ASM_SIMP_TAC [REAL_ARITH `&1/(&2) < &1 ==> (&1 < &1/ &2 <=> F)`];
22338 (* Tue Aug 10 13:15:07 EDT 2004 *)
22343 let continuous_uninduced = prove_by_refinement(
22345 continuous f U (induced_top V Y) /\ IMAGE f (UNIONS U) SUBSET Y
22346 ==> continuous f U V`,
22349 REWRITE_TAC[continuous;];
22351 TSPEC `v INTER Y` 2;
22352 TYPE_THEN `induced_top V Y (v INTER Y)` SUBGOAL_TAC;
22353 REWRITE_TAC[induced_top;IMAGE;];
22358 REWRITE_TAC [preimage;INTER];
22359 TYPE_THEN `{x | UNIONS U x /\ v (f x) /\ Y (f x)} = {x | UNIONS U x /\ v (f x)}` SUBGOAL_TAC;
22360 IMATCH_MP_TAC EQ_EXT;
22363 TYPE_THEN `UNIONS U x ==> Y (f x)` SUBGOAL_TAC;
22365 REWRITE_TAC[IMAGE;SUBSET];
22368 DISCH_THEN_REWRITE;
22369 (* Tue Aug 10 19:11:27 EDT 2004 *)
22374 let simple_arc_homeo = prove_by_refinement(
22375 `!X d (C:A->bool). (simple_arc (top_of_metric(X,d)) C) /\
22376 (metric_space(X,d)) ==>
22377 (?f. homeomorphism f
22378 (top_of_metric({x | &0 <= x /\ x <= &1},d_real))
22379 (top_of_metric(C,d)))`,
22383 REWRITE_TAC[simple_arc];
22385 TYPE_THEN `(UNIONS (top_of_metric(X,d)) = X) ` SUBGOAL_TAC;
22386 ASM_SIMP_TAC[GSYM top_of_metric_unions];
22390 TYPE_THEN `C SUBSET X` SUBGOAL_TAC;
22392 IMATCH_MP_TAC inj_image_subset;
22396 TYPE_THEN ` (UNIONS (top_of_metric(C,d)) = C)` SUBGOAL_TAC;
22398 ASM_MESON_TAC [GSYM top_of_metric_unions;metric_subspace];
22401 TYPE_THEN `{x | &0 <= x /\ x <= &1} SUBSET UNIV` SUBGOAL_TAC;
22402 REWRITE_TAC[SUBSET_UNIV];
22405 TYPE_THEN `metric_space ({x | &0 <= x /\ x <= &1},d_real)` SUBGOAL_TAC;
22406 IMATCH_MP_TAC metric_subspace;
22407 TYPE_THEN `UNIV:real->bool` EXISTS_TAC;
22408 ASM_REWRITE_TAC[metric_real];
22411 ASSUME_TAC metric_real;
22413 TYPE_THEN `compact (top_of_metric({x | &0 <= x /\ x <= &1},d_real)) {x | &0 <= x /\ x <= &1}` SUBGOAL_TAC;
22414 TYPEL_THEN [`UNIV:real->bool`;`{x| &0 <= x /\ x <= &1}`;`d_real`] (fun t-> ASSUME_TAC (ISPECL t compact_subset));
22417 ASM_REWRITE_TAC[interval_compact];
22422 (* A: show homeomorphism *)
22423 TYPE_THEN `f` EXISTS_TAC;
22424 IMATCH_MP_TAC hausdorff_homeomorphsim;
22425 ASM_SIMP_TAC[GSYM top_of_metric_unions];
22426 ASM_SIMP_TAC[top_of_metric_top;metric_subspace];
22428 TYPE_THEN `metric_space (C,d)` SUBGOAL_TAC;
22429 ASM_MESON_TAC [metric_subspace];
22431 TYPE_THEN `IMAGE f {x| &0 <= x /\ x <= &1} SUBSET C` SUBGOAL_TAC;
22432 ASM_REWRITE_TAC[SUBSET_REFL ];
22434 TYPE_THEN `IMAGE f {x| &0 <= x /\ x <= &1} SUBSET X` SUBGOAL_TAC;
22435 IMATCH_MP_TAC SUBSET_TRANS;
22436 TYPE_THEN `C` EXISTS_TAC;
22439 (* B: final obligations *)
22442 IMATCH_MP_TAC inj_bij;
22447 TYPE_THEN `induced_top (top_of_metric (UNIV,d_real)) {x| &0 <= x /\ x <= &1} {x | &0 <= x /\ x <= &1}` SUBGOAL_TAC;
22448 ASM_SIMP_TAC[top_of_metric_induced];
22449 TYPE_THEN `topology_ (top_of_metric ({x | &0 <= x /\ x <= &1},d_real))` SUBGOAL_TAC;
22450 ASM_SIMP_TAC[top_of_metric_top];
22451 DISCH_THEN (fun t-> MP_TAC (MATCH_MP top_univ t));
22452 ASM_SIMP_TAC[GSYM top_of_metric_unions];
22454 TYPE_THEN `continuous f (induced_top (top_of_metric (UNIV,d_real)) {x | &0 <= x /\ x <= &1}) (top_of_metric(X,d))` SUBGOAL_TAC;
22455 IMATCH_MP_TAC continuous_induced_domain;
22457 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real];
22458 ASM_SIMP_TAC[metric_real;top_of_metric_induced];
22459 ASM_SIMP_TAC[metric_continuous_continuous;metric_subspace];
22460 REWRITE_TAC[metric_continuous;metric_continuous_pt];
22461 DISCH_THEN_REWRITE;
22462 ASM_SIMP_TAC[top_of_metric_top];
22463 IMATCH_MP_TAC metric_hausdorff;
22465 (* Tue Aug 10 20:34:30 EDT 2004 *)
22471 let continuous_metric_extend = prove_by_refinement(
22472 `!(f:A->B) U C X d. (metric_space(X,d) /\
22473 continuous f U (top_of_metric (C,d)) /\
22474 IMAGE f (UNIONS U) SUBSET C /\ C SUBSET X ==>
22475 continuous f U (top_of_metric(X,d)))`,
22479 TYPE_THEN `metric_space(C,d)` SUBGOAL_TAC;
22480 IMATCH_MP_TAC metric_subspace;
22484 TYPE_THEN `top_of_metric(C,d) = induced_top(top_of_metric(X,d)) C` SUBGOAL_TAC;
22485 ASM_SIMP_TAC[top_of_metric_induced];
22488 IMATCH_MP_TAC continuous_uninduced;
22489 TYPE_THEN `C` EXISTS_TAC;
22491 (* Tue Aug 10 20:47:53 EDT 2004 *)
22496 let simple_arc_end_distinct = prove_by_refinement(
22497 `!C v v'. simple_arc_end C v v' ==> ~(v = v')`,
22500 REWRITE_TAC[simple_arc_end;INJ];
22502 TYPE_THEN `&0 = &1` SUBGOAL_TAC;
22503 FIRST_ASSUM IMATCH_MP_TAC ;
22504 TYPE_THEN `f (&0) = f(&1)` SUBGOAL_TAC;
22506 DISCH_THEN_REWRITE;
22512 let bij_imp_image = prove_by_refinement(
22513 `!(f:A->B) X Y. BIJ f X Y ==> (IMAGE f X = Y)`,
22516 REWRITE_TAC[BIJ;SURJ];
22518 REWRITE_TAC[IMAGE];
22519 IMATCH_MP_TAC EQ_EXT;
22525 let homeo_inj = prove_by_refinement(
22526 `!(f:A->B) U C X d. (homeomorphism f U (top_of_metric(C,d))) /\
22527 (C SUBSET X) /\ (metric_space (X,d)) ==>
22528 ( continuous f U (top_of_metric(X,d)) /\ INJ f (UNIONS U) C /\
22529 (IMAGE f (UNIONS U) = C))`,
22532 REWRITE_TAC[homeomorphism];
22534 TYPE_THEN`metric_space(C,d)` SUBGOAL_TAC;
22535 ASM_MESON_TAC [metric_subspace];
22539 ASM_SIMP_TAC[GSYM top_of_metric_unions;];
22542 TYPE_THEN `IMAGE f (UNIONS U)= C` SUBGOAL_TAC;
22543 IMATCH_MP_TAC bij_imp_image ;
22547 RULE_ASSUM_TAC (REWRITE_RULE[BIJ]);
22549 IMATCH_MP_TAC continuous_metric_extend;
22550 TYPE_THEN `C` EXISTS_TAC;
22551 ASM_REWRITE_TAC[SUBSET_REFL ];
22552 (* Tue Aug 10 20:58:37 EDT 2004 *)
22558 let simple_arc_coord = prove_by_refinement(
22559 `!X d (C:A->bool). (simple_arc (top_of_metric(X,d)) C) /\
22560 (metric_space(X,d)) ==>
22562 (continuous f (top_of_metric(C,d)) (top_of_metric(UNIV,d_real))) /\
22564 (IMAGE f C = {x | &0 <= x /\ x <= &1}))`,
22569 TYPE_THEN `(UNIONS (top_of_metric(X,d)) = X) ` SUBGOAL_TAC;
22570 ASM_SIMP_TAC[GSYM top_of_metric_unions];
22573 TYPE_THEN `C SUBSET X` SUBGOAL_TAC;
22575 RULE_ASSUM_TAC (REWRITE_RULE[simple_arc]);
22580 IMATCH_MP_TAC inj_image_subset;
22584 TYPE_THEN ` (UNIONS (top_of_metric(C,d)) = C)` SUBGOAL_TAC;
22585 ASM_MESON_TAC [GSYM top_of_metric_unions;metric_subspace];
22588 TYPE_THEN `{x | &0 <= x /\ x <= &1} SUBSET UNIV` SUBGOAL_TAC;
22589 REWRITE_TAC[SUBSET_UNIV];
22592 TYPE_THEN `metric_space ({x | &0 <= x /\ x <= &1},d_real)` SUBGOAL_TAC;
22593 IMATCH_MP_TAC metric_subspace;
22594 TYPE_THEN `UNIV:real->bool` EXISTS_TAC;
22595 ASM_REWRITE_TAC[metric_real];
22598 ASSUME_TAC metric_real;
22600 TYPE_THEN `(?f. homeomorphism f (top_of_metric({x | &0 <= x /\ x <= &1},d_real)) (top_of_metric(C,d)))` SUBGOAL_TAC;
22601 IMATCH_MP_TAC simple_arc_homeo;
22602 TYPE_THEN `X` EXISTS_TAC; (* // *)
22606 TYPE_THEN ` g = (INV f ({x | &0 <= x /\ x <= &1}) (C:A->bool))` ABBREV_TAC ;
22607 TYPE_THEN `g = INV f (UNIONS((top_of_metric({x | &0 <= x /\ x <= &1},d_real)))) (UNIONS((top_of_metric(C,d))))` SUBGOAL_TAC;
22609 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_subspace;];
22612 TYPE_THEN `g` EXISTS_TAC;
22614 (* TYPE_THEN `U = top_of_metric({x | &0 <= x /\ x <= &1},d_real)` ABBREV_TAC ; *)
22615 TYPE_THEN `(homeomorphism g (top_of_metric(C,d)) (top_of_metric({x | &0 <= x /\ x <= &1},d_real))) /\ ({x | &0 <= x /\ x <= &1} SUBSET UNIV) /\ (metric_space (UNIV,d_real))` SUBGOAL_TAC;
22617 TYPEL_THEN [`f`;`(top_of_metric({x | &0 <= x /\ x <= &1},d_real))`;`top_of_metric(C,d)`] (fun t-> ASSUME_TAC (ISPECL t homeomorphism_inv));
22620 USE 11 (MATCH_MP homeo_inj);
22629 POP_ASSUM_LIST (fun t-> ALL_TAC);
22632 ASM_MESON_TAC[INJ_UNIV];
22633 (* Tue Aug 10 21:49:22 EDT 2004 *)
22639 let image_interval = prove_by_refinement(
22640 `!a b f. (a < b) /\
22641 (continuous f (top_of_metric(UNIV,d_real))
22642 (top_of_metric( UNIV,d_real))) /\
22643 (INJ f {x | a <= x /\ x <= b} UNIV) ==>
22644 (?c d. (c < d) /\ ({ c , d} = {(f a),(f b)}) /\
22645 (IMAGE f {x | a <= x /\ x <= b} =
22646 {x | c <= x /\ x <= d})
22652 ASSUME_TAC connect_real;
22653 TYPE_THEN `!a b. connected (top_of_metric(UNIV,d_real)) (IMAGE f {x | a<= x /\ x <= b})` SUBGOAL_TAC;
22655 IMATCH_MP_TAC connect_image;
22656 TYPE_THEN `top_of_metric(UNIV,d_real)` EXISTS_TAC ;
22657 ASM_SIMP_TAC[GSYM top_of_metric_unions;metric_real];
22660 TYPE_THEN `c = min_real (f a) (f b)` ABBREV_TAC ;
22661 TYPE_THEN `d = max_real (f a) (f b)` ABBREV_TAC ;
22662 TYPE_THEN `c`EXISTS_TAC;
22663 TYPE_THEN `d` EXISTS_TAC;
22664 TYPE_THEN `~(f a = f b)` SUBGOAL_TAC;
22665 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
22667 TYPE_THEN `a = b` SUBGOAL_TAC;
22668 FIRST_ASSUM IMATCH_MP_TAC ;
22679 REWRITE_TAC[min_real;max_real];
22680 TYPE_THEN `f a < f b \/ f b < f a` SUBGOAL_TAC;
22683 DISCH_THEN DISJ_CASES_TAC;
22684 TYPE_THEN `~(f b < f a)` SUBGOAL_TAC;
22687 DISCH_THEN_REWRITE;
22689 TYPE_THEN `~(f a < f b)` SUBGOAL_TAC;
22692 DISCH_THEN_REWRITE;
22697 IMATCH_MP_TAC EQ_EXT;
22698 REWRITE_TAC[in_pair];
22701 REWRITE_TAC[max_real;min_real];
22702 TYPE_THEN `f a < f b \/ f b < f a` SUBGOAL_TAC;
22705 DISCH_THEN DISJ_CASES_TAC;
22706 TYPE_THEN `~(f b < f a)` SUBGOAL_TAC;
22709 DISCH_THEN_REWRITE;
22711 TYPE_THEN `~(f a < f b)` SUBGOAL_TAC;
22714 DISCH_THEN_REWRITE;
22719 IMATCH_MP_TAC SUBSET_ANTISYM;
22720 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
22722 IMATCH_MP_TAC connected_nogap;
22726 REWRITE_TAC[max_real;min_real];
22727 TYPE_THEN `f a < f b \/ f b < f a` SUBGOAL_TAC;
22730 DISCH_THEN DISJ_CASES_TAC;
22731 TYPE_THEN `~(f b < f a)` SUBGOAL_TAC;
22734 DISCH_THEN_REWRITE;
22736 REWRITE_TAC[IMAGE;SUBSET];
22737 ASM_MESON_TAC[REAL_ARITH `a<= a`;REAL_ARITH `a < b ==> a <= b`];
22738 TYPE_THEN `~(f a < f b)` SUBGOAL_TAC;
22741 DISCH_THEN_REWRITE;
22743 REWRITE_TAC[IMAGE;SUBSET];
22744 ASM_MESON_TAC[REAL_ARITH `a<= a`;REAL_ARITH `a < b ==> a <= b`];
22746 (* C set up cases *)
22747 REWRITE_TAC[IMAGE;SUBSET;];
22750 PROOF_BY_CONTR_TAC;
22751 USE 14 (REWRITE_RULE[DE_MORGAN_THM]);
22752 USE 9 (REWRITE_RULE[FUN_EQ_THM;in_pair ]);
22753 TYPE_THEN `((c = f a) /\ (d = f b)) \/ ((c = f b) /\ (d = f a))` SUBGOAL_TAC;
22757 TYPE_THEN `f x' < c \/ d < f x'` SUBGOAL_TAC;
22764 (* D generic case *)
22765 TYPE_THEN `!r s t. (a <= r /\ r <= b /\ a <= s /\ s <= b /\ a <= t /\ t <= b /\ (r < t) /\ (f r < f s) /\ (f s < f t) ==> (r < s /\ s < t))` SUBGOAL_TAC;
22767 PROOF_BY_CONTR_TAC;
22768 TYPEL_THEN [`r`;`t`] (USE 4 o ISPECL);
22769 USE 4(REWRITE_RULE[connected]);
22771 TYPE_THEN `IMAGE f {x | r <= x /\ x <= t} SUBSET {x | x < f s} \/ IMAGE f {x | r <= x /\ x <= t} SUBSET {x | f s < x}` SUBGOAL_TAC;
22772 FIRST_ASSUM IMATCH_MP_TAC ;
22773 REWRITE_TAC[half_open;half_open_above;EQ_EMPTY;INTER;];
22776 REWRITE_TAC[IMAGE;SUBSET;UNION;];
22779 IMATCH_MP_TAC (REAL_ARITH `~(f x'' = f s) ==> (f x'' < f s \/ f s < f x'')` );
22781 TYPE_THEN `x'' = s` SUBGOAL_TAC;
22782 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
22784 FIRST_ASSUM IMATCH_MP_TAC ;
22796 POP_ASSUM_LIST (fun t-> ALL_TAC);
22798 TYPE_THEN `~(r = s)` SUBGOAL_TAC;
22799 ASM_MESON_TAC[REAL_ARITH `a < b ==> ~(a=b)`];
22800 TYPE_THEN `~(s = t)` SUBGOAL_TAC;
22801 ASM_MESON_TAC[REAL_ARITH `a < b ==> ~(a=b)`];
22809 REWRITE_TAC[DE_MORGAN_THM ];
22811 REWRITE_TAC[IMAGE;SUBSET;];
22813 TYPE_THEN `f t` EXISTS_TAC;
22821 REWRITE_TAC[IMAGE;SUBSET;];
22823 TYPE_THEN `f r` EXISTS_TAC;
22831 (* D' generic case *)
22832 TYPE_THEN `!r s t. (a <= r /\ r <= b /\ a <= s /\ s <= b /\ a <= t /\ t <= b /\ (t < r) /\ (f r < f s) /\ (f s < f t) ==> (t < s /\ s < r))` SUBGOAL_TAC;
22834 PROOF_BY_CONTR_TAC;
22835 TYPEL_THEN [`t`;`r`] (USE 4 o ISPECL);
22836 USE 4(REWRITE_RULE[connected]);
22838 TYPE_THEN `IMAGE f {x | t <= x /\ x <= r} SUBSET {x | x < f s} \/ IMAGE f {x | t <= x /\ x <= r} SUBSET {x | f s < x}` SUBGOAL_TAC;
22839 FIRST_ASSUM IMATCH_MP_TAC ;
22840 REWRITE_TAC[half_open;half_open_above;EQ_EMPTY;INTER;];
22843 REWRITE_TAC[IMAGE;SUBSET;UNION;];
22846 IMATCH_MP_TAC (REAL_ARITH `~(f x'' = f s) ==> (f x'' < f s \/ f s < f x'')` );
22848 TYPE_THEN `x'' = s` SUBGOAL_TAC;
22849 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
22851 FIRST_ASSUM IMATCH_MP_TAC ;
22863 POP_ASSUM_LIST (fun t-> ALL_TAC);
22865 TYPE_THEN `~(r = s)` SUBGOAL_TAC;
22866 ASM_MESON_TAC[REAL_ARITH `a < b ==> ~(a=b)`];
22867 TYPE_THEN `~(s = t)` SUBGOAL_TAC;
22868 ASM_MESON_TAC[REAL_ARITH `a < b ==> ~(a=b)`];
22876 REWRITE_TAC[DE_MORGAN_THM ];
22878 REWRITE_TAC[IMAGE;SUBSET;];
22880 TYPE_THEN `f t` EXISTS_TAC;
22888 REWRITE_TAC[IMAGE;SUBSET;];
22890 TYPE_THEN `f r` EXISTS_TAC;
22907 (* E: actual cases *)
22913 TYPEL_THEN[`x'`;`a`;`b`] (USE 9 o ISPECL);
22914 TYPE_THEN `~(f x' = f b)` SUBGOAL_TAC;
22915 REPEAT (POP_ASSUM MP_TAC);
22918 TYPE_THEN `~(x' = b)` SUBGOAL_TAC;
22920 REPEAT (POP_ASSUM MP_TAC);
22924 TYPEL_THEN [`a`;`b`;`x'`] (USE 9 o ISPECL);
22925 TYPE_THEN `~(f a = f x')` SUBGOAL_TAC;
22926 REPEAT (POP_ASSUM MP_TAC);
22929 TYPE_THEN `~(a = x')` SUBGOAL_TAC;
22931 REPEAT (POP_ASSUM MP_TAC);
22935 TYPEL_THEN [`x'`;`b`;`a`] (USE 11 o ISPECL);
22936 TYPE_THEN `~(f x' = f a)` SUBGOAL_TAC;
22937 REPEAT (POP_ASSUM MP_TAC);
22940 TYPE_THEN `~(a = x')` SUBGOAL_TAC;
22942 REPEAT (POP_ASSUM MP_TAC);
22946 TYPEL_THEN [`b`;`a`;`x'`] (USE 11 o ISPECL);
22947 TYPE_THEN `~(f x' = f b)` SUBGOAL_TAC;
22948 REPEAT (POP_ASSUM MP_TAC);
22951 TYPE_THEN `~(b = x')` SUBGOAL_TAC;
22953 REPEAT (POP_ASSUM MP_TAC);
22955 (* Wed Aug 11 09:36:14 EDT 2004 *)
22959 let metric_continuous_range = prove_by_refinement(
22960 `!(f:A->B) X dX Y dY Y'.
22961 metric_continuous f (X,dX) (Y,dY) <=>
22962 metric_continuous f (X,dX) (Y',dY)`,
22965 REWRITE_TAC[metric_continuous;metric_continuous_pt];
22969 let continuous_range = prove_by_refinement(
22970 `!(f:A->B) X dX Y dY Y'.
22971 metric_space(X,dX) /\ metric_space(Y,dY) /\ metric_space(Y',dY) /\
22972 continuous f (top_of_metric(X,dX)) (top_of_metric(Y,dY)) /\
22973 IMAGE f X SUBSET Y /\ IMAGE f X SUBSET Y' ==>
22974 continuous f (top_of_metric(X,dX)) (top_of_metric(Y',dY))`,
22978 TYPE_THEN `continuous f (top_of_metric (X,dX)) (top_of_metric (Y',dY)) = metric_continuous f (X,dX) (Y',dY)` SUBGOAL_TAC;
22979 IMATCH_MP_TAC metric_continuous_continuous;
22982 TYPE_THEN `continuous f (top_of_metric (X,dX)) (top_of_metric (Y,dY)) = metric_continuous f (X,dX) (Y,dY)` SUBGOAL_TAC;
22983 IMATCH_MP_TAC metric_continuous_continuous;
22988 ASM_MESON_TAC[metric_continuous_range];
22992 let metric_continuous_domain = prove_by_refinement(
22993 `!(f:A->B) X dX Y dY Y' A.
22994 metric_continuous f (X,dX) (Y,dY) /\ A SUBSET X ==>
22995 metric_continuous f (A,dX) (Y',dY)`,
22998 REWRITE_TAC[metric_continuous;metric_continuous_pt;SUBSET];
23003 let pair_order_endpoint = prove_by_refinement(
23004 `!a b c d . (c < d) /\ ({c , d} = {a ,b}) ==>
23005 (c = min_real a b) /\ (d = max_real a b)`,
23009 USE 0 (REWRITE_RULE[FUN_EQ_THM;in_pair]);
23010 TYPE_THEN `((c = a) /\ (d = b)) \/ ((c = b) /\ (d = a))` SUBGOAL_TAC;
23012 DISCH_THEN DISJ_CASES_TAC;
23015 ASM_REWRITE_TAC[min_real;max_real];
23016 ASM_SIMP_TAC[REAL_ARITH `a < b ==> ~(b < a)`];
23019 ASM_REWRITE_TAC[min_real;max_real];
23020 ASM_SIMP_TAC[REAL_ARITH `a < b ==> ~(b < a)`];
23024 let cont_extend_real_lemma = prove_by_refinement(
23025 `!a b (f:real->A) Y dY. (a < b) /\
23026 (continuous f (top_of_metric({x | a <= x /\ x <= b},d_real))
23027 (top_of_metric(Y,dY))) /\ (metric_space(Y,dY)) /\
23028 IMAGE f {x | a <= x /\ x <= b} SUBSET Y ==>
23030 ?g. (continuous g (top_of_metric(UNIV,d_real))
23031 (top_of_metric(Y,dY))) /\
23032 (!x. (a <= x /\ x <= b) ==> (f x = g x)))`,
23036 TYPE_THEN `?t. (a < t /\ t < b)` SUBGOAL_TAC;
23037 TYPE_THEN `(a+b)/(&2)` EXISTS_TAC;
23038 ASM_MESON_TAC[real_middle1_lt;real_middle2_lt];
23040 ASSUME_TAC metric_real;
23041 TYPE_THEN `{x | a <= x /\ x <= b} SUBSET UNIV` SUBGOAL_TAC;
23042 ASM_REWRITE_TAC[SUBSET_UNIV];
23044 TYPE_THEN `metric_space ({x | a <= x /\ x <= b},d_real)` SUBGOAL_TAC;
23045 IMATCH_MP_TAC metric_subspace;
23046 TYPE_THEN `UNIV:real->bool` EXISTS_TAC ;
23050 TYPE_THEN `metric_continuous f ({x | a <= x /\ x <= b},d_real) (Y,dY)` SUBGOAL_TAC;
23052 ASM_SIMP_TAC [metric_continuous_continuous];
23054 TYPE_THEN `A = {x | x <= a}` ABBREV_TAC ;
23055 TYPE_THEN `B = {x | b <= x}` ABBREV_TAC ;
23056 TYPE_THEN `fA = (\(t:real). f a)` ABBREV_TAC ;
23057 TYPE_THEN `fB = (\(t:real). f b)` ABBREV_TAC ;
23058 ASSUME_TAC half_closed;
23059 ASSUME_TAC half_closed_above;
23061 TYPE_THEN `!r A. (Y r) ==> (metric_continuous (\t. r) (A,d_real) (Y,dY))` SUBGOAL_TAC;
23062 REWRITE_TAC[metric_continuous;metric_continuous_pt];
23066 TYPE_THEN `epsilon` EXISTS_TAC;
23069 ASM_MESON_TAC[metric_space_zero];
23072 TYPE_THEN `metric_continuous (subf A fA fB) (A UNION B,d_real) (Y,dY)` SUBGOAL_TAC;
23073 IMATCH_MP_TAC subf_cont;
23074 TYPE_THEN `UNIV:real->bool` EXISTS_TAC;
23081 TYPE_THEN `!x. x <= a /\ b <= x <=> F` SUBGOAL_TAC;
23084 DISCH_THEN_REWRITE;
23085 TYPE_THEN `Y (f a) /\ Y(f b)` SUBGOAL_TAC;
23087 REWRITE_TAC[IMAGE;SUBSET];
23088 TYPE_THEN `a <= a /\ a <= b /\ b <= b` SUBGOAL_TAC;
23094 FIRST_ASSUM IMATCH_MP_TAC ;
23096 FIRST_ASSUM IMATCH_MP_TAC ;
23100 TYPE_THEN `A' = A UNION B` ABBREV_TAC ;
23101 TYPE_THEN `B' = {x | a <= x /\ x <= b}` ABBREV_TAC ;
23102 TYPE_THEN `fA' = subf A fA fB` ABBREV_TAC ;
23103 TYPE_THEN `metric_continuous (subf A' fA' f) (A' UNION B',d_real) (Y,dY)` SUBGOAL_TAC;
23104 IMATCH_MP_TAC subf_cont;
23105 TYPE_THEN `UNIV:real->bool` EXISTS_TAC;
23110 IMATCH_MP_TAC closed_union;
23113 ASM_SIMP_TAC[top_of_metric_top];
23114 ASM_REWRITE_TAC[interval_closed];
23119 REWRITE_TAC[UNION];
23122 TYPE_THEN `(x = a) \/ (x = b)` SUBGOAL_TAC;
23127 DISCH_THEN DISJ_CASES_TAC;
23129 DISCH_THEN_REWRITE;
23130 REWRITE_TAC[subf;REAL_ARITH `a <= a`];
23132 DISCH_THEN_REWRITE;
23134 TYPE_THEN `~(b <= a)` SUBGOAL_TAC;
23137 DISCH_THEN_REWRITE;
23140 TYPE_THEN `A' UNION B' = UNIV` SUBGOAL_TAC;
23145 IMATCH_MP_TAC EQ_EXT;
23146 REWRITE_TAC[UNION];
23150 TYPE_THEN `g = subf A' fA' f` ABBREV_TAC ;
23151 TYPE_THEN `!x. A x ==> (g x = f a)` SUBGOAL_TAC;
23155 REWRITE_TAC[UNION];
23166 TYPE_THEN `!x. B x ==> (g x = f b)` SUBGOAL_TAC;
23170 REWRITE_TAC[UNION];
23176 TYPE_THEN `~(A x)` SUBGOAL_TAC;
23183 DISCH_THEN_REWRITE;
23188 TYPE_THEN `!x. B' x ==> (g x = f x)` SUBGOAL_TAC;
23190 TYPE_THEN `A x` ASM_CASES_TAC;
23191 TYPE_THEN `A x /\ B' x ==> (x = a)` SUBGOAL_TAC;
23199 TYPE_THEN `B x` ASM_CASES_TAC;
23200 TYPE_THEN `B x /\ B' x ==> (x = b)` SUBGOAL_TAC;
23207 TYPE_THEN `~(A' x)` SUBGOAL_TAC;
23211 REWRITE_TAC[UNION];
23215 DISCH_THEN_REWRITE;
23217 (* B start on goal *)
23218 TYPE_THEN `g` EXISTS_TAC;
23219 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
23225 TYPE_THEN `IMAGE g UNIV SUBSET Y /\ metric_space (UNIV,d_real) /\ metric_space (Y,dY)` SUBGOAL_TAC;
23228 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
23229 REWRITE_TAC[IMAGE_UNION;union_subset];
23232 REWRITE_TAC[IMAGE_UNION;union_subset];
23235 REWRITE_TAC[IMAGE;SUBSET];
23236 TYPE_THEN `Y (f a) /\ Y(f b)` SUBGOAL_TAC;
23239 REWRITE_TAC[IMAGE;SUBSET];
23240 TYPE_THEN `a <= a /\ a <= b /\ b <= b` SUBGOAL_TAC;
23248 REWRITE_TAC[IMAGE;SUBSET];
23253 USE 28 (MATCH_MP metric_continuous_continuous);
23256 (* Wed Aug 11 12:37:40 EDT 2004 *)
23261 let image_interval2 = prove_by_refinement(
23262 `!a b f. (a < b) /\
23263 (continuous f (top_of_metric({x | a <= x /\ x <= b},d_real))
23264 (top_of_metric( UNIV,d_real))) /\
23265 (INJ f {x | a <= x /\ x <= b} UNIV) ==>
23266 (?c d. (c < d) /\ ({ c , d} = {(f a),(f b)}) /\
23267 (IMAGE f {x | a <= x /\ x <= b} =
23268 {x | c <= x /\ x <= d})
23273 TYPE_THEN `?g. (continuous g (top_of_metric(UNIV,d_real)) (top_of_metric(UNIV,d_real))) /\ (!x. (a <= x /\ x <= b) ==> (f x = g x))` SUBGOAL_TAC;
23274 IMATCH_MP_TAC cont_extend_real_lemma;
23275 ASM_REWRITE_TAC[metric_real];
23277 TYPE_THEN `(a < b) /\ (continuous g (top_of_metric(UNIV,d_real)) (top_of_metric( UNIV,d_real))) /\ (INJ g {x | a <= x /\ x <= b} UNIV)` SUBGOAL_TAC;
23279 TYPE_THEN `INJ g {x | a <= x /\ x <= b} UNIV= INJ f {x | a <= x /\ x <= b} UNIV` SUBGOAL_TAC;
23280 IMATCH_MP_TAC inj_domain_sub;
23283 DISCH_THEN_REWRITE;
23285 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP image_interval t));
23288 TYPE_THEN `c` EXISTS_TAC;
23289 TYPE_THEN `d` EXISTS_TAC;
23292 TYPE_THEN `(f a = g a) /\ (f b = g b)` SUBGOAL_TAC;
23295 MESON_TAC[REAL_ARITH `(a < b) ==> (a<= a /\ a <= b /\ b <= b)`];
23296 DISCH_THEN_REWRITE;
23299 IMATCH_MP_TAC image_domain_sub;
23301 (* Wed Aug 11 12:51:52 EDT 2004 *)
23306 let simple_arc_euclid = prove_by_refinement(
23307 `!C. (simple_arc top2 C ==> (C SUBSET (euclid 2)))`,
23311 USE 0 (MATCH_MP simple_arc_compact);
23312 RULE_ASSUM_TAC (REWRITE_RULE[compact;top2_unions]);
23317 let simple_arc_end_inj = prove_by_refinement(
23318 `!A B C v v'. (simple_arc_end A v v' /\ simple_arc_end B v v') /\
23319 (simple_arc top2 C) /\ (A SUBSET C) /\ (B SUBSET C) ==>
23324 REWRITE_TAC[simple_arc_end];
23326 TYPE_THEN `simple_arc (top_of_metric(euclid 2,d_euclid)) C /\ (metric_space(euclid 2,d_euclid))` SUBGOAL_TAC;
23327 ASM_REWRITE_TAC[GSYM top2;metric_euclid];
23328 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP simple_arc_coord t));
23330 (* push to reals *)
23331 TYPE_THEN `(IMAGE f'' A = IMAGE f'' B) <=> (A = B)` SUBGOAL_TAC;
23332 IMATCH_MP_TAC INJ_IMAGE ;
23333 TYPE_THEN `C` EXISTS_TAC;
23335 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
23337 TYPE_THEN `C SUBSET (euclid 2)` SUBGOAL_TAC;
23338 IMATCH_MP_TAC simple_arc_euclid;
23342 TYPE_THEN `metric_space (C,d_euclid )` SUBGOAL_TAC;
23343 ASM_MESON_TAC[metric_subspace;metric_euclid];
23346 TYPE_THEN `{x | &0 <= x /\ x <= &1} SUBSET UNIV` SUBGOAL_TAC;
23347 REWRITE_TAC[SUBSET_UNIV];
23350 TYPE_THEN `metric_space ({x | &0 <= x /\ x <= &1},d_real)` SUBGOAL_TAC;
23351 IMATCH_MP_TAC metric_subspace;
23352 TYPE_THEN `UNIV:real->bool` EXISTS_TAC ;
23353 ASM_REWRITE_TAC[metric_real];
23357 TYPE_THEN `g = f'' o f` ABBREV_TAC ;
23358 TYPE_THEN `g'= f'' o f'` ABBREV_TAC ;
23359 TYPE_THEN `top_of_metric({x| &0 <= x /\ x <= &1},d_real) = induced_top(top_of_metric(UNIV,d_real)) {x | &0 <= x /\ x <= &1}` SUBGOAL_TAC;
23360 IMATCH_MP_TAC (GSYM top_of_metric_induced);
23361 ASM_REWRITE_TAC[metric_real];
23364 TYPE_THEN `continuous f (top_of_metric({x| &0 <= x /\ x<= &1},d_real)) top2` SUBGOAL_TAC;
23365 ASM_REWRITE_TAC[top2 ];
23366 IMATCH_MP_TAC continuous_induced_domain;
23367 ASM_SIMP_TAC [GSYM top2; GSYM top_of_metric_unions; metric_real];
23370 TYPE_THEN `continuous f' (top_of_metric({x| &0 <= x /\ x<= &1},d_real)) top2` SUBGOAL_TAC;
23371 ASM_REWRITE_TAC[top2 ];
23372 IMATCH_MP_TAC continuous_induced_domain;
23373 ASM_SIMP_TAC [GSYM top2; GSYM top_of_metric_unions; metric_real];
23378 TYPE_THEN `(&0 < &1) /\ (continuous g (top_of_metric({x | &0 <= x /\ x <= &1},d_real)) (top_of_metric( UNIV,d_real))) /\ (INJ g {x | &0 <= x /\ x <= &1} UNIV)` SUBGOAL_TAC;
23383 IMATCH_MP_TAC continuous_comp;
23384 TYPE_THEN `top_of_metric(C,d_euclid)` EXISTS_TAC;
23387 ASM_SIMP_TAC[GSYM top_of_metric_unions];
23388 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
23392 IMATCH_MP_TAC continuous_range;
23393 TYPE_THEN `euclid 2` EXISTS_TAC;
23394 ASM_REWRITE_TAC[GSYM top2];
23395 ASM_SIMP_TAC[metric_euclid];
23396 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
23401 IMATCH_MP_TAC SUBSET_TRANS;
23402 TYPE_THEN `C` EXISTS_TAC;
23406 IMATCH_MP_TAC (REWRITE_RULE[GSYM comp_comp] COMP_INJ);
23407 TYPE_THEN `C` EXISTS_TAC;
23409 IMATCH_MP_TAC inj_subset;
23410 TYPE_THEN `(euclid 2)` EXISTS_TAC;
23414 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP image_interval2 t));
23418 REWRITE_TAC[GSYM IMAGE_o];
23421 TYPE_THEN `(&0 < &1) /\ (continuous g' (top_of_metric({x | &0 <= x /\ x <= &1},d_real)) (top_of_metric( UNIV,d_real))) /\ (INJ g' {x | &0 <= x /\ x <= &1} UNIV)` SUBGOAL_TAC;
23426 IMATCH_MP_TAC continuous_comp;
23427 TYPE_THEN `top_of_metric(C,d_euclid)` EXISTS_TAC;
23430 ASM_SIMP_TAC[GSYM top_of_metric_unions];
23431 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
23435 IMATCH_MP_TAC continuous_range;
23436 TYPE_THEN `euclid 2` EXISTS_TAC;
23437 ASM_REWRITE_TAC[GSYM top2];
23438 ASM_SIMP_TAC[metric_euclid];
23439 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
23444 IMATCH_MP_TAC SUBSET_TRANS;
23445 TYPE_THEN `C` EXISTS_TAC;
23449 IMATCH_MP_TAC (REWRITE_RULE[GSYM comp_comp] COMP_INJ);
23450 TYPE_THEN `C` EXISTS_TAC;
23452 IMATCH_MP_TAC inj_subset;
23453 TYPE_THEN `(euclid 2)` EXISTS_TAC;
23457 DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP image_interval2 t));
23459 (* C final steps *)
23460 TYPE_THEN `(g (&0) = g'(&0)) /\ (g(&1) = g'(&1))` SUBGOAL_TAC;
23463 REWRITE_TAC[o_DEF ];
23470 TYPE_THEN `(c = min_real (g'(&0)) (g'(&1))) /\ (d = max_real(g'(&0)) (g'(&1)))` SUBGOAL_TAC;
23471 IMATCH_MP_TAC pair_order_endpoint;
23473 DISCH_THEN_REWRITE;
23474 TYPE_THEN `(c' = min_real (g'(&0)) (g'(&1))) /\ (d' = max_real(g'(&0)) (g'(&1)))` SUBGOAL_TAC;
23475 IMATCH_MP_TAC pair_order_endpoint;
23477 DISCH_THEN_REWRITE;
23478 (* Wed Aug 11 15:10:02 EDT 2004 *)
23483 let simple_arc_end_cut = prove_by_refinement(
23484 `!C v v' v''. simple_arc_end C v v' /\ (C v'') /\ ~(v'' = v) /\
23486 (?C' C''. (simple_arc_end C' v v'') /\ (simple_arc_end C'' v'' v') /\
23487 (C' INTER C'' = {v''}) /\ (C' UNION C'' = C))`,
23490 REWRITE_TAC[simple_arc_end];
23493 TYPE_THEN `?t. (&0 <= t /\ t <= &1 /\ (f t = v''))` SUBGOAL_TAC;
23496 REWRITE_TAC[IMAGE];
23499 TYPE_THEN `IMAGE f {x | &0 <= x /\ x <= t}` EXISTS_TAC;
23500 TYPE_THEN `IMAGE f {x | t <= x /\ x <= &1}` EXISTS_TAC;
23502 TYPE_THEN `IMAGE f {x | &0 <= x /\ x <= t} INTER IMAGE f {x | t <= x /\ x <= &1} = IMAGE f ({x | &0 <= x /\ x <= t} INTER {x | t <= x /\ x <= &1})` SUBGOAL_TAC;
23503 IMATCH_MP_TAC (GSYM inj_inter );
23504 TYPE_THEN `{x | &0 <= x /\ x <= &1}` EXISTS_TAC;
23505 TYPE_THEN `(euclid 2)` EXISTS_TAC;
23507 REWRITE_TAC[SUBSET];
23511 DISCH_THEN_REWRITE;
23512 TYPE_THEN `{x | &0 <= x /\ x <= t} INTER {x | t <= x /\ x <= &1} = {t}` SUBGOAL_TAC;
23513 IMATCH_MP_TAC EQ_EXT;
23514 REWRITE_TAC[INTER;INR IN_SING];
23518 DISCH_THEN_REWRITE;
23519 REWRITE_TAC[image_sing];
23522 REWRITE_TAC[GSYM IMAGE_UNION];
23523 TYPE_THEN `{x | &0 <= x /\ x <= t} UNION {x | t <= x /\ x <= &1} = {x | &0 <= x /\ x <= &1}` SUBGOAL_TAC;
23524 IMATCH_MP_TAC EQ_EXT;
23525 REWRITE_TAC[UNION;];
23529 DISCH_THEN_REWRITE;
23530 (* B FIRST piece *)
23532 TYPE_THEN `continuous f (top_of_metric (UNIV,d_real)) top2 /\ INJ f {x | &0 <= x /\ x <= t} (euclid 2) /\ &0 < &1 /\ &0 < t` SUBGOAL_TAC;
23535 IMATCH_MP_TAC inj_subset_domain;
23536 TYPE_THEN `{x | &0 <= x /\ x <= &1}` EXISTS_TAC;
23538 REWRITE_TAC[SUBSET];
23541 TYPE_THEN `~(&0 = t)` SUBGOAL_TAC;
23542 PROOF_BY_CONTR_TAC;
23547 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
23549 TYPE_THEN `g` EXISTS_TAC;
23553 TYPE_THEN `continuous f (top_of_metric (UNIV,d_real)) top2 /\ INJ f {x | t <= x /\ x <= &1} (euclid 2) /\ &0 < &1 /\ t < &1` SUBGOAL_TAC;
23556 IMATCH_MP_TAC inj_subset_domain;
23557 TYPE_THEN `{x | &0 <= x /\ x <= &1}` EXISTS_TAC;
23559 REWRITE_TAC[SUBSET];
23562 TYPE_THEN `~( &1 = t)` SUBGOAL_TAC;
23563 PROOF_BY_CONTR_TAC;
23568 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
23570 TYPE_THEN `g` EXISTS_TAC;
23573 (* Wed Aug 11 15:54:37 EDT 2004 *)
23578 let simple_closed_curve_pt = prove_by_refinement(
23579 `!C v. (simple_closed_curve top2 C /\ C v) ==>
23580 (?f. (C = IMAGE f {x | &0 <= x /\ x <= &1}) /\
23581 continuous f (top_of_metric (UNIV,d_real)) top2 /\
23582 INJ f {x | &0 <= x /\ x < &1} (UNIONS top2) /\
23584 (f (&0) = f (&1)))`,
23587 REWRITE_TAC[simple_closed_curve];
23589 TYPE_THEN `f(&0) = v` ASM_CASES_TAC;
23590 TYPE_THEN `f` EXISTS_TAC;
23594 TYPE_THEN `?t. (&0 <= t /\ t <= &1 /\ (f t = v))` SUBGOAL_TAC;
23597 REWRITE_TAC[IMAGE];
23600 TYPE_THEN `~(t = &0)` SUBGOAL_TAC;
23601 PROOF_BY_CONTR_TAC;
23606 TYPE_THEN `~(t = &1)` SUBGOAL_TAC;
23607 PROOF_BY_CONTR_TAC;
23611 TYPE_THEN `{x | t <= x /\ x <= &1} = {x | t <= x /\ x < &1} UNION {(&1)}` SUBGOAL_TAC;
23612 IMATCH_MP_TAC EQ_EXT;
23613 REWRITE_TAC[UNION;INR IN_SING];
23618 TYPE_THEN `INJ f {x | t <= x /\ x <= &1} (euclid 2)` SUBGOAL_TAC;
23620 IMATCH_MP_TAC inj_split;
23622 IMATCH_MP_TAC inj_subset_domain;
23623 TYPE_THEN `{x | &0 <= x /\ x < &1}` EXISTS_TAC ;
23624 ASM_REWRITE_TAC[GSYM top2_unions];
23625 REWRITE_TAC[SUBSET];
23629 REWRITE_TAC[INJ;INR IN_SING;];
23630 USE 2 (REWRITE_RULE[top2_unions]);
23631 TYPE_THEN `euclid 2 (f (&0))` SUBGOAL_TAC;
23632 USE 2 (REWRITE_RULE[INJ]);
23634 FIRST_ASSUM IMATCH_MP_TAC ;
23638 REWRITE_TAC[EQ_EMPTY;IMAGE;INTER;image_sing;INR IN_SING;];
23640 CONV_TAC (dropq_conv "x''");
23643 TYPE_THEN `x' = &0` SUBGOAL_TAC;
23644 USE 2(REWRITE_RULE[INJ]);
23646 FIRST_ASSUM IMATCH_MP_TAC ;
23656 (* [A] reparameter 1st part *)
23657 TYPE_THEN `(continuous f (top_of_metric (UNIV,d_real)) top2) /\ (INJ f {x | t <= x /\ x <= &1} (euclid 2)) /\ (&0 < &1/(&2)) /\ (t < &1)` SUBGOAL_TAC;
23658 ASM_REWRITE_TAC[REAL_LT_HALF1];
23662 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
23666 TYPE_THEN `(continuous f (top_of_metric (UNIV,d_real)) top2) /\ (INJ f {x | &0 <= x /\ x <= t} (euclid 2)) /\ (&1/(&2) < &1) /\ (&0 < t)` SUBGOAL_TAC;
23667 ASM_REWRITE_TAC[REAL_LT_HALF2];
23669 USE 2(REWRITE_RULE[top2_unions]);
23670 IMATCH_MP_TAC inj_subset_domain;
23671 TYPE_THEN `{x | &0 <= x /\ x < &1} ` EXISTS_TAC;
23672 ASM_REWRITE_TAC[SUBSET];
23679 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
23682 (* [C] JOIN functions *)
23683 TYPE_THEN `joinf g g' (&1/(&2))` EXISTS_TAC;
23684 TYPE_THEN `&0 < &1/(&2)` SUBGOAL_TAC;
23685 ASM_REWRITE_TAC[REAL_LT_HALF1];
23688 TYPE_THEN `&1/(&2) < &1` SUBGOAL_TAC;
23689 ASM_REWRITE_TAC[REAL_LT_HALF2];
23693 TYPE_THEN `joinf g g' (&1/(&2)) (&0) = v` SUBGOAL_TAC;
23694 ASM_REWRITE_TAC[joinf];
23698 TYPE_THEN `joinf g g' (&1/(&2)) (&1) = v` SUBGOAL_TAC;
23699 ASM_REWRITE_TAC[joinf];
23700 ASM_SIMP_TAC[REAL_ARITH `(&1/ &2 < &1) ==> ~(&1 < (&1/(&2)))`];
23705 TYPE_THEN `continuous (joinf g g' (&1 / &2)) (top_of_metric (UNIV,d_real)) top2` SUBGOAL_TAC;
23707 IMATCH_MP_TAC joinf_cont;
23708 ASM_REWRITE_TAC[GSYM top2];
23710 DISCH_THEN_REWRITE;
23712 TYPE_THEN `{x | &0 <= x /\ x < &1} = {x | &0 <= x /\ x < (&1/(&2))} UNION {x | (&1/(&2)) <= x /\ x < &1}` SUBGOAL_TAC;
23713 IMATCH_MP_TAC EQ_EXT;
23714 ASM_REWRITE_TAC[UNION];
23718 DISCH_THEN_REWRITE;
23720 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
23721 REWRITE_TAC[top2_unions];
23722 RULE_ASSUM_TAC (REWRITE_RULE[top2_unions]);
23724 IMATCH_MP_TAC inj_split;
23725 TYPE_THEN `INJ (joinf g g' (&1 / &2)) {x | &0 <= x /\ x < &1 / &2} = INJ g {x | &0 <= x /\ x < &1 / &2}` SUBGOAL_TAC;
23726 IMATCH_MP_TAC joinf_inj_below;
23727 REWRITE_TAC[SUBSET];
23729 DISCH_THEN_REWRITE;
23730 TYPE_THEN `INJ (joinf g g' (&1 / &2)) {x | &1 / &2 <= x /\ x < &1} = INJ g' {x | &1 / &2 <= x /\ x < &1}` SUBGOAL_TAC;
23731 IMATCH_MP_TAC joinf_inj_above;
23732 REWRITE_TAC[SUBSET];
23734 DISCH_THEN_REWRITE ;
23736 IMATCH_MP_TAC inj_subset_domain;
23737 TYPE_THEN `{x | &0 <= x /\ x <= &1/(&2)}` EXISTS_TAC;
23739 REWRITE_TAC[SUBSET];
23742 IMATCH_MP_TAC inj_subset_domain;
23743 TYPE_THEN `{x | &1/(&2) <= x /\ x <= &1}` EXISTS_TAC;
23745 REWRITE_TAC[SUBSET];
23747 (* --2-- E IMAGE *)
23748 REWRITE_TAC[EQ_EMPTY];
23749 TYPE_THEN `IMAGE (joinf g g' (&1 / &2)) {x | &0 <= x /\ x < &1 / &2} = IMAGE g {x | &0 <= x /\ x < &1 / &2}` SUBGOAL_TAC;
23750 IMATCH_MP_TAC joinf_image_below;
23751 REWRITE_TAC[SUBSET];
23753 DISCH_THEN_REWRITE;
23754 TYPE_THEN `IMAGE (joinf g g' (&1 / &2)) {x | &1 / &2 <= x /\ x < &1} = IMAGE g' {x | &1 / &2 <= x /\ x < &1}` SUBGOAL_TAC;
23755 IMATCH_MP_TAC joinf_image_above;
23756 REWRITE_TAC[SUBSET];
23758 DISCH_THEN_REWRITE;
23759 REWRITE_TAC[INTER];
23761 REWRITE_TAC[IMAGE;];
23766 USE 13 (REWRITE_RULE[FUN_EQ_THM ]);
23768 USE 13 (REWRITE_RULE[IMAGE]);
23769 TYPE_THEN `(?x. (&0 <= x /\ x <= &1 / &2) /\ (g x' = g x))` SUBGOAL_TAC;
23770 ASM_MESON_TAC[REAL_ARITH `x' < u ==> x' <= u`];
23775 USE 14 (REWRITE_RULE[FUN_EQ_THM;]);
23777 USE 14 (REWRITE_RULE[IMAGE]);
23778 TYPE_THEN `(?x. (&1 / &2 <= x /\ x <= &1) /\ (g' x'' = g' x))` SUBGOAL_TAC;
23779 ASM_MESON_TAC[REAL_ARITH `x' < u ==> x' <= u`];
23784 TYPE_THEN `(x = x''')` SUBGOAL_TAC;
23785 USE 2 (REWRITE_RULE[INJ]);
23787 FIRST_ASSUM IMATCH_MP_TAC ;
23789 TYPE_THEN `~(x = &0)` SUBGOAL_TAC;
23791 TYPE_THEN `g (&1/(&2)) = g (x')` SUBGOAL_TAC;
23794 TYPE_THEN `&1/(&2) = x'` SUBGOAL_TAC;
23795 USE 17(REWRITE_RULE[INJ]);
23797 FIRST_ASSUM IMATCH_MP_TAC ;
23805 TYPE_THEN `~(x = &1)` SUBGOAL_TAC;
23807 TYPE_THEN `g (&1/(&2)) = g (x')` SUBGOAL_TAC;
23810 TYPE_THEN `&1/(&2) = x'` SUBGOAL_TAC;
23811 USE 17(REWRITE_RULE[INJ]);
23813 FIRST_ASSUM IMATCH_MP_TAC ;
23831 TYPE_THEN `x = t` SUBGOAL_TAC;
23839 TYPE_THEN `g' (&1) = g'(x'')` SUBGOAL_TAC;
23842 TYPE_THEN `&1 = x''` SUBGOAL_TAC;
23843 USE 22(REWRITE_RULE[INJ]);
23845 FIRST_ASSUM IMATCH_MP_TAC ;
23854 TYPE_THEN `{x | &0 <= x /\ x <= &1} = {x | &0 <= x /\ x < &1/(&2)} UNION {x | &1/(&2) <= x /\ x <= &1}` SUBGOAL_TAC;
23855 IMATCH_MP_TAC EQ_EXT;
23856 REWRITE_TAC[UNION ];
23861 TYPEL_THEN [`joinf g g' (&1/(&2))`;`{x | &0 <= x /\ x < &1/(&2)}`;`{x | &1/(&2) <= x /\ x <= &1}`] (fun t-> ASSUME_TAC (ISPECL t IMAGE_UNION ));
23865 TYPE_THEN `IMAGE (joinf g g' (&1 / &2)) {x | &0 <= x /\ x < &1 / &2} = IMAGE g {x | &0 <= x /\ x < &1 / &2}` SUBGOAL_TAC;
23866 IMATCH_MP_TAC joinf_image_below;
23867 REWRITE_TAC[SUBSET];
23869 DISCH_THEN_REWRITE;
23870 TYPE_THEN `IMAGE (joinf g g' (&1 / &2)) {x | &1 / &2 <= x /\ x <= &1} = IMAGE g' {x | &1 / &2 <= x /\ x <= &1}` SUBGOAL_TAC;
23871 IMATCH_MP_TAC joinf_image_above;
23872 REWRITE_TAC[SUBSET];
23874 DISCH_THEN_REWRITE;
23878 TYPE_THEN `{x | &0 <= x /\ x <= &1} = {x | &0 <= x /\ x < &1} UNION {(&1)}` SUBGOAL_TAC;
23879 IMATCH_MP_TAC EQ_EXT;
23880 REWRITE_TAC[UNION;INR IN_SING];
23884 TYPE_THEN `IMAGE f {x | &0 <= x /\ x <= &1} = IMAGE f {x | &0 <= x /\ x < &1}` SUBGOAL_TAC;
23886 REWRITE_TAC[IMAGE_UNION;image_sing; ];
23887 IMATCH_MP_TAC SUBSET_ANTISYM;
23889 REWRITE_TAC[union_subset;SUBSET_REFL];
23890 REWRITE_TAC[SUBSET;INR IN_SING;];
23892 DISCH_THEN_REWRITE;
23894 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
23895 REWRITE_TAC[IMAGE];
23896 TYPE_THEN `&0` EXISTS_TAC;
23899 REWRITE_TAC[SUBSET_UNION];
23903 TYPE_THEN `IMAGE g {x | &0 <= x /\ x < &1/(&2)} = IMAGE f {x | t <= x /\ x < &1}` SUBGOAL_TAC;
23904 IMATCH_MP_TAC SUBSET_ANTISYM;
23906 IMATCH_MP_TAC SUBSET_TRANS;
23907 TYPE_THEN `IMAGE f {x | t <= x /\ x <= &1} DELETE (f (&1))` EXISTS_TAC;
23909 ASM_REWRITE_TAC[SUBSET_DELETE];
23911 REWRITE_TAC[IMAGE;];
23913 TYPE_THEN `x = (&1/(&2))` SUBGOAL_TAC;
23914 USE 17(REWRITE_RULE[INJ]);
23916 FIRST_ASSUM IMATCH_MP_TAC ;
23923 IMATCH_MP_TAC IMAGE_SUBSET;
23924 REWRITE_TAC[SUBSET];
23926 REWRITE_TAC[DELETE;IMAGE;SUBSET;];
23927 REWRITE_TAC[REAL_ARITH `x <= &1 <=> (x < &1 \/ (x = &1))`];
23930 IMATCH_MP_TAC SUBSET_TRANS;
23931 TYPE_THEN `IMAGE g {x | &0 <= x /\ x <= &1/(&2)} DELETE (g (&1/(&2)))` EXISTS_TAC;
23935 ASM_REWRITE_TAC[SUBSET_DELETE];
23937 REWRITE_TAC[IMAGE;];
23939 TYPE_THEN `&1 = x` SUBGOAL_TAC;
23940 USE 12(REWRITE_RULE[INJ]);
23942 FIRST_ASSUM IMATCH_MP_TAC ;
23950 IMATCH_MP_TAC IMAGE_SUBSET;
23951 REWRITE_TAC[SUBSET];
23953 REWRITE_TAC[DELETE;IMAGE;SUBSET;];
23954 REWRITE_TAC[REAL_ARITH `x <= &1/(&2) <=> (x < &1/(&2) \/ (x = &1/(&2)))`];
23956 DISCH_THEN_REWRITE;
23958 REWRITE_TAC[GSYM IMAGE_UNION];
23960 IMATCH_MP_TAC EQ_EXT;
23961 REWRITE_TAC[UNION];
23966 (* -- World's worst proof *)
23967 (* Thu Aug 12 07:44:29 EDT 2004 *)
23974 let shift_inj = prove_by_refinement(
23975 `!(f:real->A) X t. (INJ f {x | &0 <= x /\ x < &1} X) /\
23976 (f (&0) = f(&1)) /\ (&0 < t) ==>
23977 INJ f {x | t <= x /\ x <= &1} X`,
23984 TYPE_THEN `x < &1` ASM_CASES_TAC;
23985 FIRST_ASSUM IMATCH_MP_TAC ;
23990 TYPE_THEN `x = &1` SUBGOAL_TAC;
23994 DISCH_THEN_REWRITE;
23997 FIRST_ASSUM IMATCH_MP_TAC ;
24001 TYPE_THEN `((x = &1) /\ (y = &1)) \/ ((x < &1) /\ (y = &1)) \/ ((x = &1) /\ (y < &1)) \/ ((x < &1) /\ (y < &1))` SUBGOAL_TAC;
24009 TYPE_THEN `x = &0` SUBGOAL_TAC;
24010 FIRST_ASSUM IMATCH_MP_TAC ;
24020 TYPE_THEN `y = &0` SUBGOAL_TAC;
24021 FIRST_ASSUM IMATCH_MP_TAC ;
24029 FIRST_ASSUM IMATCH_MP_TAC ;
24035 (* Thu Aug 12 08:33:16 EDT 2004 *)
24040 let simple_arc_segment = prove_by_refinement(
24042 continuous f (top_of_metric (UNIV,d_real)) top2 /\
24043 INJ f {x | &0 <= x /\ x < &1} (euclid 2) /\
24044 (f (&0) = f (&1)) /\
24045 (&0 <= u /\ u < v /\ v <= &1 /\ (&0 < u \/ v < &1)) ==>
24046 simple_arc_end (IMAGE f {x | u <= x /\ x <= v}) (f u) (f v)`,
24050 REWRITE_TAC[simple_arc_end];
24052 TYPE_THEN `(&0 < u) ==> INJ f { x | u <= x /\ x <= &1} (euclid 2)` SUBGOAL_TAC ;
24054 IMATCH_MP_TAC shift_inj;
24058 TYPE_THEN `INJ f { x | u <= x /\ x <= v } (euclid 2)` SUBGOAL_TAC;
24060 DISCH_THEN DISJ_CASES_TAC;
24061 IMATCH_MP_TAC inj_subset_domain;
24062 TYPE_THEN `{x | u <= x /\ x <= &1}` EXISTS_TAC;
24064 ASM_REWRITE_TAC[SUBSET ];
24067 IMATCH_MP_TAC inj_subset_domain;
24068 TYPE_THEN `{x | &0 <= x /\ x < &1}` EXISTS_TAC;
24070 REWRITE_TAC[SUBSET];
24076 TYPE_THEN `continuous f (top_of_metric (UNIV,d_real)) top2 /\ INJ f {x | u <= x /\ x <= v} (euclid 2) /\ &0 < &1 /\ u < v` SUBGOAL_TAC;
24079 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP arc_reparameter_gen t));
24081 TYPE_THEN `g` EXISTS_TAC;
24083 (* Thu Aug 12 08:55:11 EDT 2004 *)
24088 let simple_closed_cut = prove_by_refinement(
24089 `!C v v'. (simple_closed_curve top2 C /\ C v /\ C v' /\ ~(v = v')
24090 ==> (?C' C''. simple_arc_end C' v v' /\ simple_arc_end C'' v v'
24091 /\ ( C' UNION C'' = C) /\ (C' INTER C'' = {v,v'})))`,
24095 TYPE_THEN `simple_closed_curve top2 C /\ C v` SUBGOAL_TAC;
24097 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP simple_closed_curve_pt t));
24100 TYPE_THEN `?t. (&0 <= t /\ t <= &1 /\ (f(t) = v'))` SUBGOAL_TAC;
24102 ASM_REWRITE_TAC[IMAGE];
24105 TYPE_THEN `t < &1` SUBGOAL_TAC;
24106 IMATCH_MP_TAC (REAL_ARITH `~( t= &1) /\ (t <= &1) ==> (t < &1)`);
24113 TYPE_THEN `&0 < t` SUBGOAL_TAC;
24114 IMATCH_MP_TAC (REAL_ARITH `~(t = &0) /\ (&0 <= t) ==> (&0 < t)`);
24120 TYPE_THEN `C' = IMAGE f {x | &0 <= x /\ x <= t}` ABBREV_TAC ;
24121 TYPE_THEN `C'' = IMAGE f {x | t <= x /\ x <= &1}` ABBREV_TAC ;
24122 TYPE_THEN `C'` EXISTS_TAC;
24123 TYPE_THEN `C''` EXISTS_TAC;
24128 IMATCH_MP_TAC simple_arc_segment;
24129 RULE_ASSUM_TAC (REWRITE_RULE[top2_unions]);
24131 ASM_MESON_TAC[REAL_ARITH `x <= x`];
24138 IMATCH_MP_TAC simple_arc_end_symm;
24139 IMATCH_MP_TAC simple_arc_segment;
24140 RULE_ASSUM_TAC (REWRITE_RULE[top2_unions]);
24148 REWRITE_TAC[GSYM IMAGE_UNION];
24150 IMATCH_MP_TAC EQ_EXT;
24151 REWRITE_TAC[UNION];
24156 TYPE_THEN `C'' = IMAGE f {x | t <= x /\ x < &1} UNION IMAGE f {(&1)}` SUBGOAL_TAC;
24157 REWRITE_TAC[GSYM IMAGE_UNION];
24160 IMATCH_MP_TAC EQ_EXT;
24161 REWRITE_TAC[UNION;INR IN_SING ];
24164 DISCH_THEN_REWRITE;
24166 REWRITE_TAC[UNION_OVER_INTER;image_sing];
24168 TYPE_THEN `(IMAGE f ({x | &0 <= x /\ x <= t} INTER {x | t <= x /\ x < &1})) = (IMAGE f {x | &0 <= x /\ x <= t} INTER IMAGE f {x | t <= x /\ x < &1})` SUBGOAL_TAC;
24169 IMATCH_MP_TAC inj_inter;
24170 TYPE_THEN `{x | &0 <= x /\ x < &1}` EXISTS_TAC;
24171 TYPE_THEN `(UNIONS top2)` EXISTS_TAC;
24173 REWRITE_TAC[SUBSET];
24177 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
24179 TYPE_THEN `({x | &0 <= x /\ x <= t} INTER {x | t <= x /\ x < &1}) = {t}` SUBGOAL_TAC;
24180 IMATCH_MP_TAC EQ_EXT;
24181 REWRITE_TAC[INTER;INR IN_SING];
24185 DISCH_THEN_REWRITE;
24186 TYPE_THEN `{(f (&1))} = IMAGE f {(&0)}` SUBGOAL_TAC;
24187 REWRITE_TAC[image_sing];
24189 DISCH_THEN_REWRITE;
24190 TYPE_THEN `(IMAGE f ({x | &0 <= x /\ x <= t} INTER {(&0)}) ) = (IMAGE f {x | &0 <= x /\ x <= t} INTER IMAGE f {(&0)} )` SUBGOAL_TAC;
24191 IMATCH_MP_TAC inj_inter;
24192 TYPE_THEN `{x | &0 <= x /\ x < &1}` EXISTS_TAC;
24193 TYPE_THEN `UNIONS top2` EXISTS_TAC;
24195 REWRITE_TAC[SUBSET;INR IN_SING];
24199 DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
24201 TYPE_THEN `({x | &0 <= x /\ x <= t} INTER {(&0)}) = {(&0)}` SUBGOAL_TAC;
24202 IMATCH_MP_TAC EQ_EXT;
24203 REWRITE_TAC[INTER;INR IN_SING ];
24206 DISCH_THEN_REWRITE;
24207 REWRITE_TAC[image_sing];
24208 IMATCH_MP_TAC EQ_EXT;
24209 REWRITE_TAC[in_pair];
24210 REWRITE_TAC[UNION;INR IN_SING];
24212 (* Thu Aug 12 09:35:48 EDT 2004 *)
24217 (* ------------------------------------------------------------------ *)
24219 (* ------------------------------------------------------------------ *)
24222 let closed_point = prove_by_refinement(
24223 `!x. (euclid 2 x) ==> (closed_ top2 {x})`,
24227 IMATCH_MP_TAC compact_closed;
24228 REWRITE_TAC[top2_top];
24229 ASM_SIMP_TAC[top2;metric_hausdorff;metric_euclid];
24230 IMATCH_MP_TAC compact_point;
24231 ASM_REWRITE_TAC[GSYM top2;top2_unions];
24232 (* Fri Aug 13 08:42:22 EDT 2004 *)
24237 let simple_arc_end_closed = prove_by_refinement(
24238 `!C v v'. (simple_arc_end C v v' ==> closed_ top2 C) `,
24242 IMATCH_MP_TAC compact_closed;
24243 REWRITE_TAC[top2_top];
24244 ASM_SIMP_TAC[top2;metric_hausdorff;metric_euclid];
24245 REWRITE_TAC [GSYM top2];
24246 IMATCH_MP_TAC simple_arc_compact;
24247 IMATCH_MP_TAC simple_arc_end_simple;
24249 (* Fri Aug 13 09:33:35 EDT 2004 *)
24254 let simple_arc_end_end = prove_by_refinement(
24255 `!C v v'. (simple_arc_end C v v' ==> C v)`,
24258 REWRITE_TAC[simple_arc_end];
24262 REWRITE_TAC[IMAGE;];
24263 TYPE_THEN `&0` EXISTS_TAC;
24266 (* Fri Aug 13 09:40:59 EDT 2004 *)
24271 let simple_arc_end_end2 = prove_by_refinement(
24272 `!C v v'. (simple_arc_end C v v' ==> C v')`,
24275 REWRITE_TAC[simple_arc_end];
24279 REWRITE_TAC[IMAGE;];
24280 TYPE_THEN `&1` EXISTS_TAC;
24283 (* Fri Aug 13 09:42:07 EDT 2004 *)
24287 let simple_arc_end_end_closed = prove_by_refinement(
24288 `!C v v'. simple_arc_end C v v' ==> closed_ top2 {v}`,
24292 IMATCH_MP_TAC closed_point;
24293 TYPE_THEN `C SUBSET euclid 2` SUBGOAL_TAC;
24294 IMATCH_MP_TAC simple_arc_euclid;
24295 IMATCH_MP_TAC simple_arc_end_simple;
24297 TYPE_THEN `C v` SUBGOAL_TAC;
24298 IMATCH_MP_TAC simple_arc_end_end;
24300 MESON_TAC[ISUBSET];
24304 let simple_arc_end_end_closed2 = prove_by_refinement(
24305 `!C v v'. simple_arc_end C v v' ==> closed_ top2 {v'}`,
24309 ASM_MESON_TAC[simple_arc_end_end_closed;simple_arc_end_symm;];
24314 let simple_arc_sep3 = prove_by_refinement(
24315 `!A C1 C2 C3 x p1 p2 p3.
24316 (C1 UNION C2 UNION C3 SUBSET A) /\
24317 (simple_arc_end C1 x p1) /\ ~(C1 p2) /\ ~(C1 p3) /\
24318 (simple_arc_end C2 x p2) /\ ~(C2 p1) /\ ~(C2 p3) /\
24319 (simple_arc_end C3 x p3) /\ ~(C3 p1) /\ ~(C3 p2) ==>
24321 (C1' UNION C2' UNION C3' SUBSET A) /\
24322 (simple_arc_end C1' x' p1) /\
24323 (simple_arc_end C2' x' p2) /\
24324 (simple_arc_end C3' x' p3) /\
24325 ~(C2' p3) /\ ~(C3' p2) /\
24326 (C1' INTER C2' = {x'} ) /\
24327 (C1' INTER C3' = {x'} ))
24332 TYPE_THEN `K = C2 UNION C3` ABBREV_TAC ;
24333 TYPE_THEN `~((C1 INTER K) = EMPTY)` SUBGOAL_TAC;
24335 REWRITE_TAC[EMPTY_EXISTS;INTER ];
24336 REWRITE_TAC[UNION];
24337 TYPE_THEN `x` EXISTS_TAC;
24338 ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
24341 TYPE_THEN `closed_ top2 K` SUBGOAL_TAC;
24343 IMATCH_MP_TAC closed_union;
24344 ASM_MESON_TAC[simple_arc_end_closed;top2_top];
24347 TYPE_THEN `~((C1 INTER {p1}) = EMPTY)` SUBGOAL_TAC;
24348 REWRITE_TAC[INTER;EMPTY_EXISTS;INR IN_SING];
24349 ASM_MESON_TAC[simple_arc_end_end2];
24352 TYPE_THEN `(?C1' x' v'. C1' SUBSET C1 /\ simple_arc_end C1' x' v' /\ (C1' INTER K = {x'}) /\ (C1' INTER {p1} = {v'}))` SUBGOAL_TAC;
24353 IMATCH_MP_TAC simple_arc_end_restriction;
24354 ASM_REWRITE_TAC[EQ_EMPTY;INTER;INR IN_SING ];
24356 ASM_MESON_TAC[simple_arc_end_simple];
24358 IMATCH_MP_TAC simple_arc_end_end_closed2;
24360 CONV_TAC (dropq_conv "x");
24361 REWRITE_TAC[DE_MORGAN_THM];
24364 REWRITE_TAC[UNION];
24368 TYPE_THEN `v' = p1` SUBGOAL_TAC;
24369 USE 14 (REWRITE_RULE[FUN_EQ_THM]);
24370 USE 14 (REWRITE_RULE[INTER;INR IN_SING]);
24372 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
24375 (* [A] case x' = x *)
24376 TYPE_THEN `x' = x` ASM_CASES_TAC;
24378 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
24379 TYPE_THEN `x` EXISTS_TAC;
24380 TYPE_THEN `C1` EXISTS_TAC;
24381 TYPE_THEN `C2` EXISTS_TAC;
24382 TYPE_THEN `C3` EXISTS_TAC;
24384 TYPE_THEN `C1' = C1` SUBGOAL_TAC;
24385 IMATCH_MP_TAC simple_arc_end_inj;
24386 TYPE_THEN `C1` EXISTS_TAC;
24387 TYPE_THEN `x` EXISTS_TAC;
24388 TYPE_THEN `p1` EXISTS_TAC;
24389 ASM_REWRITE_TAC[SUBSET_REFL ];
24390 IMATCH_MP_TAC simple_arc_end_simple;
24392 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
24395 IMATCH_MP_TAC EQ_EXT;
24397 REWRITE_TAC[INTER;INR IN_SING];
24399 USE 15 (REWRITE_RULE[FUN_EQ_THM;]);
24400 USE 14 (REWRITE_RULE[INTER;INR IN_SING]);
24403 REWRITE_TAC[UNION];
24405 DISCH_THEN_REWRITE;
24406 ASM_MESON_TAC[simple_arc_end_end];
24408 IMATCH_MP_TAC EQ_EXT;
24410 REWRITE_TAC[INTER;INR IN_SING];
24412 USE 15 (REWRITE_RULE[FUN_EQ_THM;]);
24413 USE 14 (REWRITE_RULE[INTER;INR IN_SING]);
24416 REWRITE_TAC[UNION];
24418 DISCH_THEN_REWRITE;
24419 ASM_MESON_TAC[simple_arc_end_end];
24420 (* B cut C1 at- x' *)
24421 TYPE_THEN `~(x' = p1)` SUBGOAL_TAC;
24422 ASM_MESON_TAC[simple_arc_end_distinct];
24425 TYPE_THEN `C1' x'` SUBGOAL_TAC;
24426 IMATCH_MP_TAC simple_arc_end_end;
24430 TYPE_THEN `simple_arc_end C1 x p1 /\ C1 x' /\ ~(x' = x) /\ ~(x' = p1)` SUBGOAL_TAC;
24434 MESON_TAC[ISUBSET];
24435 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP simple_arc_end_cut t));
24438 TYPE_THEN `C'' = C1'` SUBGOAL_TAC;
24439 IMATCH_MP_TAC simple_arc_end_inj;
24440 TYPE_THEN `C1` EXISTS_TAC;
24441 TYPE_THEN `x'` EXISTS_TAC;
24442 TYPE_THEN `p1` EXISTS_TAC;
24445 IMATCH_MP_TAC simple_arc_end_simple;
24448 SET_TAC[UNION;SUBSET];
24449 DISCH_THEN (fun t -> RULE_ASSUM_TAC (REWRITE_RULE[t]));
24451 TYPE_THEN `C1 x'` SUBGOAL_TAC;
24454 MESON_TAC[ISUBSET];
24457 TYPE_THEN `x'` EXISTS_TAC;
24458 TYPE_THEN `C1'` EXISTS_TAC;
24460 ONCE_REWRITE_TAC[union_subset];
24461 TYPE_THEN `C1' SUBSET A` SUBGOAL_TAC;
24462 IMATCH_MP_TAC SUBSET_TRANS;
24463 TYPE_THEN `C1 UNION K ` EXISTS_TAC;
24465 IMATCH_MP_TAC SUBSET_TRANS;
24466 TYPE_THEN `C1` EXISTS_TAC;
24467 ASM_REWRITE_TAC[SUBSET_UNION];
24468 DISCH_THEN_REWRITE;
24471 TYPE_THEN `C2 x'` ASM_CASES_TAC;
24472 TYPE_THEN `simple_arc_end C2 x p2 /\ C2 x' /\ ~(x' = x) /\ ~(x' = p2)` SUBGOAL_TAC;
24475 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP simple_arc_end_cut t));
24477 TYPE_THEN `C2' = C''''` ABBREV_TAC ;
24480 TYPE_THEN `C2'` EXISTS_TAC;
24482 TYPE_THEN `C2' SUBSET C2` SUBGOAL_TAC;
24483 USE 26 ( (REWRITE_RULE[FUN_EQ_THM]));
24484 USE 26 (REWRITE_RULE[UNION]);
24486 REWRITE_TAC[SUBSET];
24489 TYPE_THEN `~C2' p3` SUBGOAL_TAC;
24492 MESON_TAC[ISUBSET];
24493 DISCH_THEN_REWRITE;
24494 ONCE_REWRITE_TAC [union_subset];
24495 TYPE_THEN `C2' SUBSET A` SUBGOAL_TAC;
24496 IMATCH_MP_TAC SUBSET_TRANS;
24497 TYPE_THEN `C1 UNION K` EXISTS_TAC;
24499 IMATCH_MP_TAC SUBSET_TRANS;
24500 TYPE_THEN `C2` EXISTS_TAC;
24503 REWRITE_TAC[SUBSET;UNION];
24505 DISCH_THEN_REWRITE;
24506 TYPE_THEN `C1' INTER C2' = {x'}` SUBGOAL_TAC;
24507 IMATCH_MP_TAC EQ_EXT;
24508 REWRITE_TAC[INTER;INR IN_SING];
24514 REWRITE_TAC [eq_sing];
24515 REWRITE_TAC[INTER;UNION;SUBSET];
24517 DISCH_THEN_REWRITE;
24519 ASM_MESON_TAC[simple_arc_end_end];
24520 DISCH_THEN_REWRITE;
24521 (* --[C2]-- branch again for C3 x' -- *)
24522 TYPE_THEN `C3 x'` ASM_CASES_TAC;
24523 TYPE_THEN `simple_arc_end C3 x p3 /\ C3 x' /\ ~(x' = x) /\ ~(x' = p3)` SUBGOAL_TAC;
24526 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP simple_arc_end_cut t));
24528 TYPE_THEN `C3' = C''''''` ABBREV_TAC ;
24530 TYPE_THEN `C3'` EXISTS_TAC;
24532 TYPE_THEN `C3' SUBSET C3` SUBGOAL_TAC;
24534 SET_TAC[UNION;SUBSET];
24537 IMATCH_MP_TAC SUBSET_TRANS;
24538 TYPE_THEN `C1 UNION K` EXISTS_TAC;
24542 REWRITE_TAC[SUBSET;UNION];
24547 MESON_TAC[ISUBSET];
24548 TYPE_THEN `C3' x'` SUBGOAL_TAC;
24549 IMATCH_MP_TAC simple_arc_end_end;
24552 IMATCH_MP_TAC EQ_EXT;
24553 REWRITE_TAC[INR IN_SING];
24559 REWRITE_TAC[eq_sing ];
24560 REWRITE_TAC[UNION;SUBSET;INTER];
24562 DISCH_THEN_REWRITE;
24563 REWRITE_TAC[INTER];
24565 (* --[C2']-- now C3 doesn't meet x'. This will be repeated for C2 *)
24566 (* -- cut C' from {x'} to FIRST point on C3 -- *)
24567 TYPEL_THEN [`C'`;`{x'}`;`C3`] (fun t-> MP_TAC (ISPECL t simple_arc_end_restriction));
24568 DISCH_THEN ANT_TAC;
24571 IMATCH_MP_TAC simple_arc_end_simple;
24574 IMATCH_MP_TAC simple_arc_end_end_closed;
24577 IMATCH_MP_TAC simple_arc_end_closed;
24581 REWRITE_TAC[EQ_EMPTY;INTER;INR IN_SING];
24584 REWRITE_TAC[EMPTY_EXISTS];
24585 REWRITE_TAC[INTER;INR IN_SING];
24586 USE 23 (MATCH_MP simple_arc_end_end2);
24589 REWRITE_TAC[EMPTY_EXISTS];
24590 REWRITE_TAC[INTER;INR IN_SING];
24591 USE 23 (MATCH_MP simple_arc_end_end);
24593 USE 2 (MATCH_MP simple_arc_end_end);
24598 TYPE_THEN `C3a = C'''''` ABBREV_TAC ;
24600 TYPE_THEN `v = x'` SUBGOAL_TAC;
24601 USE 33(REWRITE_RULE[FUN_EQ_THM]);
24602 USE 33(REWRITE_RULE[INTER;INR IN_SING]);
24605 DISCH_THEN (fun t -> (RULE_ASSUM_TAC (REWRITE_RULE[t])));
24607 TYPE_THEN `C3a SUBSET C1` SUBGOAL_TAC;
24608 IMATCH_MP_TAC SUBSET_TRANS;
24609 TYPE_THEN `C'` EXISTS_TAC;
24612 SET_TAC[UNION;SUBSET];
24614 TYPE_THEN `C3a SUBSET A /\ simple_arc_end C3a x' v'' /\ ~(C3a p2) /\ (C1' INTER C3a = {(x')}) /\ (C3 INTER C3a = {(v'')}) /\ (~C3a p3)` SUBGOAL_TAC ;
24617 IMATCH_MP_TAC SUBSET_TRANS;
24618 TYPE_THEN `C1 UNION K` EXISTS_TAC;
24620 IMATCH_MP_TAC SUBSET_TRANS;
24621 TYPE_THEN `C1` EXISTS_TAC;
24622 REWRITE_TAC[SUBSET_UNION];
24623 IMATCH_MP_TAC SUBSET_TRANS;
24624 TYPE_THEN `C1` EXISTS_TAC;
24625 ASM_REWRITE_TAC[SUBSET_REFL ];
24629 MESON_TAC[ISUBSET];
24631 IMATCH_MP_TAC EQ_EXT;
24633 REWRITE_TAC[INR IN_SING];
24637 REWRITE_TAC[eq_sing];
24638 REWRITE_TAC[SUBSET;INTER];
24640 DISCH_THEN_REWRITE;
24641 REWRITE_TAC[INTER];
24643 ASM_MESON_TAC[simple_arc_end_end];
24646 IMATCH_MP_TAC EQ_EXT;
24648 REWRITE_TAC[INR IN_SING];
24651 REWRITE_TAC[eq_sing];
24652 REWRITE_TAC[SUBSET;INTER];
24654 DISCH_THEN_REWRITE;
24655 REWRITE_TAC[INTER];
24658 REWRITE_TAC[eq_sing];
24659 REWRITE_TAC[INTER];
24662 USE 20 (REWRITE_RULE[FUN_EQ_THM]);
24663 USE 20 (REWRITE_RULE[UNION]);
24666 MESON_TAC [ISUBSET];
24673 TYPE_THEN `(v'' = x)` ASM_CASES_TAC;
24674 FIRST_ASSUM (fun t -> RULE_ASSUM_TAC (REWRITE_RULE[t]));
24675 TYPE_THEN `C3 UNION C3a` EXISTS_TAC;
24678 ONCE_REWRITE_TAC[union_subset];
24682 REWRITE_TAC[union_subset];
24686 IMATCH_MP_TAC simple_arc_end_symm;
24687 IMATCH_MP_TAC simple_arc_end_trans;
24688 TYPE_THEN `x` EXISTS_TAC;
24691 IMATCH_MP_TAC simple_arc_end_symm;
24693 IMATCH_MP_TAC simple_arc_end_symm;
24696 REWRITE_TAC[UNION;DE_MORGAN_THM];
24699 IMATCH_MP_TAC EQ_EXT;
24700 REWRITE_TAC[INTER;UNION;INR IN_SING];
24703 REWRITE_TAC[LEFT_AND_OVER_OR];
24704 DISCH_THEN DISJ_CASES_TAC;
24708 REWRITE_TAC[eq_sing];
24709 REWRITE_TAC[INTER;UNION];
24713 REWRITE_TAC[eq_sing ];
24714 REWRITE_TAC[INTER];
24716 DISCH_THEN_REWRITE;
24719 REWRITE_TAC[eq_sing ];
24720 REWRITE_TAC[INTER];
24723 (* --[c] cut off C3b at- v'' *)
24724 TYPEL_THEN [`C3`;`x`;`p3`;`v''`] (fun t -> MP_TAC (ISPECL t simple_arc_end_cut));
24725 DISCH_THEN ANT_TAC;
24729 REWRITE_TAC[eq_sing ];
24730 REWRITE_TAC[INTER];
24732 PROOF_BY_CONTR_TAC;
24733 USE 39 (REWRITE_RULE[]);
24734 FIRST_ASSUM (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
24738 REWRITE_TAC[eq_sing ];
24739 REWRITE_TAC[INTER];
24742 TYPE_THEN `C3b = C'''''''` ABBREV_TAC ;
24744 TYPE_THEN `C3b SUBSET C3` SUBGOAL_TAC;
24746 SET_TAC[UNION;SUBSET];
24748 (* -- [d] EXISTS_TAC *)
24749 TYPE_THEN `C3a UNION C3b` EXISTS_TAC;
24752 IMATCH_MP_TAC SUBSET_TRANS ;
24753 TYPE_THEN `C1 UNION K` EXISTS_TAC ;
24755 IMATCH_MP_TAC subset_union_pair;
24757 IMATCH_MP_TAC SUBSET_TRANS;
24758 TYPE_THEN `C'` EXISTS_TAC;
24761 SET_TAC[UNION;SUBSET];
24764 REWRITE_TAC[SUBSET;UNION];
24768 IMATCH_MP_TAC simple_arc_end_trans;
24769 (* IMATCH_MP_TAC SUBSET_TRANS; *)
24770 TYPE_THEN `v''` EXISTS_TAC;
24775 REWRITE_TAC[eq_sing ];
24776 REWRITE_TAC[INTER;SUBSET];
24780 REWRITE_TAC[UNION;DE_MORGAN_THM];
24784 MESON_TAC[ISUBSET];
24785 IMATCH_MP_TAC EQ_EXT ;
24786 REWRITE_TAC[INTER;UNION;INR IN_SING;LEFT_AND_OVER_OR];
24789 DISCH_THEN DISJ_CASES_TAC;
24790 FIRST_ASSUM MP_TAC;
24793 REWRITE_TAC[eq_sing];
24794 REWRITE_TAC[INTER];
24796 FIRST_ASSUM MP_TAC;
24800 REWRITE_TAC[eq_sing];
24801 REWRITE_TAC[INTER;UNION;SUBSET];
24803 DISCH_THEN_REWRITE;
24807 MESON_TAC[simple_arc_end_end];
24809 TYPE_THEN `C3 x'` SUBGOAL_TAC;
24812 REWRITE_TAC[eq_sing];
24814 REWRITE_TAC[INTER;UNION];
24817 (* [E] back to ONE goal *)
24818 (* TYPE_THEN `C3 x'` ASM_CASES_TAC; *)
24819 TYPE_THEN `simple_arc_end C3 x p3 /\ C3 x' /\ ~(x' = x) /\ ~(x' = p3)` SUBGOAL_TAC;
24822 DISCH_THEN (fun t-> ASSUME_TAC (MATCH_MP simple_arc_end_cut t));
24824 TYPE_THEN `C3' = C''''` ABBREV_TAC ;
24828 USE 10 (ONCE_REWRITE_RULE[UNION_COMM]);
24829 TYPE_THEN `C3'` EXISTS_TAC;
24831 TYPE_THEN `C3' SUBSET C3` SUBGOAL_TAC;
24832 USE 27 ( (REWRITE_RULE[FUN_EQ_THM]));
24833 USE 27 (REWRITE_RULE[UNION]);
24835 REWRITE_TAC[SUBSET];
24838 TYPE_THEN `~C3' p2` SUBGOAL_TAC;
24841 MESON_TAC[ISUBSET];
24842 DISCH_THEN_REWRITE;
24843 ONCE_REWRITE_TAC [union_subset];
24844 TYPE_THEN `C3' SUBSET A` SUBGOAL_TAC;
24845 IMATCH_MP_TAC SUBSET_TRANS;
24846 TYPE_THEN `C1 UNION K` EXISTS_TAC;
24848 IMATCH_MP_TAC SUBSET_TRANS;
24849 TYPE_THEN `C3` EXISTS_TAC;
24852 REWRITE_TAC[SUBSET;UNION];
24854 DISCH_THEN_REWRITE;
24855 TYPE_THEN `C1' INTER C3' = {x'}` SUBGOAL_TAC;
24856 IMATCH_MP_TAC EQ_EXT;
24857 REWRITE_TAC[INTER;INR IN_SING];
24863 REWRITE_TAC [eq_sing];
24864 REWRITE_TAC[INTER;UNION;SUBSET];
24866 DISCH_THEN_REWRITE;
24868 ASM_MESON_TAC[simple_arc_end_end];
24869 DISCH_THEN_REWRITE;
24870 (* --[XC2]-- now C2 doesn't meet x'. This is repeat. *)
24871 (* -- cut C' from {x'} to FIRST point on C2 -- *)
24872 TYPEL_THEN [`C'`;`{x'}`;`C2`] (fun t-> MP_TAC (ISPECL t simple_arc_end_restriction));
24873 DISCH_THEN ANT_TAC;
24876 IMATCH_MP_TAC simple_arc_end_simple;
24879 IMATCH_MP_TAC simple_arc_end_end_closed;
24882 IMATCH_MP_TAC simple_arc_end_closed;
24886 REWRITE_TAC[EQ_EMPTY;INTER;INR IN_SING];
24889 REWRITE_TAC[EMPTY_EXISTS];
24890 REWRITE_TAC[INTER;INR IN_SING];
24891 USE 23 (MATCH_MP simple_arc_end_end2);
24894 REWRITE_TAC[EMPTY_EXISTS];
24895 REWRITE_TAC[INTER;INR IN_SING];
24896 USE 23 (MATCH_MP simple_arc_end_end);
24898 USE 5 (MATCH_MP simple_arc_end_end);
24903 TYPE_THEN `C2a = C'''''` ABBREV_TAC ;
24905 TYPE_THEN `v = x'` SUBGOAL_TAC;
24906 USE 33(REWRITE_RULE[FUN_EQ_THM]);
24907 USE 33(REWRITE_RULE[INTER;INR IN_SING]);
24910 DISCH_THEN (fun t -> (RULE_ASSUM_TAC (REWRITE_RULE[t])));
24912 TYPE_THEN `C2a SUBSET C1` SUBGOAL_TAC;
24913 IMATCH_MP_TAC SUBSET_TRANS;
24914 TYPE_THEN `C'` EXISTS_TAC;
24917 SET_TAC[UNION;SUBSET];
24919 TYPE_THEN `C2a SUBSET A /\ simple_arc_end C2a x' v'' /\ ~(C2a p3) /\ (C1' INTER C2a = {(x')}) /\ (C2 INTER C2a = {(v'')}) /\ (~C2a p2)` SUBGOAL_TAC ;
24922 IMATCH_MP_TAC SUBSET_TRANS;
24923 TYPE_THEN `C1 UNION K` EXISTS_TAC;
24925 IMATCH_MP_TAC SUBSET_TRANS;
24926 TYPE_THEN `C1` EXISTS_TAC;
24927 REWRITE_TAC[SUBSET_UNION];
24928 IMATCH_MP_TAC SUBSET_TRANS;
24929 TYPE_THEN `C1` EXISTS_TAC;
24930 ASM_REWRITE_TAC[SUBSET_REFL ];
24934 MESON_TAC[ISUBSET];
24936 IMATCH_MP_TAC EQ_EXT;
24938 REWRITE_TAC[INR IN_SING];
24942 REWRITE_TAC[eq_sing];
24943 REWRITE_TAC[SUBSET;INTER];
24945 DISCH_THEN_REWRITE;
24946 REWRITE_TAC[INTER];
24948 ASM_MESON_TAC[simple_arc_end_end];
24951 IMATCH_MP_TAC EQ_EXT;
24953 REWRITE_TAC[INR IN_SING];
24956 REWRITE_TAC[eq_sing];
24957 REWRITE_TAC[SUBSET;INTER];
24959 DISCH_THEN_REWRITE;
24960 REWRITE_TAC[INTER];
24963 REWRITE_TAC[eq_sing];
24964 REWRITE_TAC[INTER];
24967 USE 20 (REWRITE_RULE[FUN_EQ_THM]);
24968 USE 20 (REWRITE_RULE[UNION]);
24971 MESON_TAC [ISUBSET];
24975 KILL 35; (* attention *)
24978 TYPE_THEN `(v'' = x)` ASM_CASES_TAC;
24979 FIRST_ASSUM (fun t -> RULE_ASSUM_TAC (REWRITE_RULE[t]));
24980 TYPE_THEN `C2 UNION C2a` EXISTS_TAC;
24983 ONCE_REWRITE_TAC[union_subset];
24987 REWRITE_TAC[union_subset];
24991 IMATCH_MP_TAC simple_arc_end_symm;
24992 IMATCH_MP_TAC simple_arc_end_trans;
24993 TYPE_THEN `x` EXISTS_TAC;
24996 IMATCH_MP_TAC simple_arc_end_symm;
24998 IMATCH_MP_TAC simple_arc_end_symm;
25001 REWRITE_TAC[UNION;DE_MORGAN_THM];
25004 IMATCH_MP_TAC EQ_EXT;
25005 REWRITE_TAC[INTER;UNION;INR IN_SING];
25008 REWRITE_TAC[LEFT_AND_OVER_OR];
25009 DISCH_THEN DISJ_CASES_TAC;
25013 REWRITE_TAC[eq_sing];
25014 REWRITE_TAC[INTER;UNION];
25018 REWRITE_TAC[eq_sing ];
25019 REWRITE_TAC[INTER];
25021 DISCH_THEN_REWRITE;
25024 REWRITE_TAC[eq_sing ];
25025 REWRITE_TAC[INTER];
25028 (* --[Xc] cut off C3b at- v'' *)
25029 TYPEL_THEN [`C2`;`x`;`p2`;`v''`] (fun t -> MP_TAC (ISPECL t simple_arc_end_cut));
25030 DISCH_THEN ANT_TAC;
25034 REWRITE_TAC[eq_sing ];
25035 REWRITE_TAC[INTER];
25037 PROOF_BY_CONTR_TAC;
25038 USE 39 (REWRITE_RULE[]);
25039 FIRST_ASSUM (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
25043 REWRITE_TAC[eq_sing ];
25044 REWRITE_TAC[INTER];
25047 TYPE_THEN `C2b = C''''''` ABBREV_TAC ;
25049 TYPE_THEN `C2b SUBSET C2` SUBGOAL_TAC;
25051 SET_TAC[UNION;SUBSET];
25053 (* -- [Xd] EXISTS_TAC *)
25054 TYPE_THEN `C2a UNION C2b` EXISTS_TAC;
25057 REWRITE_TAC[union_subset ];
25059 IMATCH_MP_TAC SUBSET_TRANS ;
25060 TYPE_THEN `C1 UNION K` EXISTS_TAC ;
25062 IMATCH_MP_TAC SUBSET_TRANS;
25063 TYPE_THEN `C2` EXISTS_TAC;
25066 REWRITE_TAC[SUBSET;UNION];
25070 IMATCH_MP_TAC simple_arc_end_trans;
25071 TYPE_THEN `v''` EXISTS_TAC;
25076 REWRITE_TAC[eq_sing ];
25077 REWRITE_TAC[INTER;SUBSET];
25081 REWRITE_TAC[UNION;DE_MORGAN_THM];
25085 MESON_TAC[ISUBSET];
25086 IMATCH_MP_TAC EQ_EXT ;
25087 REWRITE_TAC[INTER;UNION;INR IN_SING;LEFT_AND_OVER_OR];
25090 DISCH_THEN DISJ_CASES_TAC;
25091 FIRST_ASSUM MP_TAC;
25094 REWRITE_TAC[eq_sing];
25095 REWRITE_TAC[INTER];
25097 FIRST_ASSUM MP_TAC;
25101 REWRITE_TAC[eq_sing];
25102 REWRITE_TAC[INTER;UNION;SUBSET];
25104 DISCH_THEN_REWRITE;
25108 MESON_TAC[simple_arc_end_end];
25109 (* Fri Aug 13 17:43:15 EDT 2004 *)
25116 let simple_arc_sep2 = prove_by_refinement(
25117 `!A C1 C2 C3 x p1 p2 p3.
25119 C1 UNION C2 UNION C3 SUBSET A /\
25120 (simple_arc_end C1 x p1) /\
25121 (simple_arc_end C2 x p2) /\
25122 (simple_arc_end C3 x p3) /\
25123 (C1 INTER C2 = {x}) /\
25124 (C1 INTER C3 = {x}) /\
25125 ~(C2 p3) /\ ~(C3 p2)) ==>
25127 (C1' UNION C2' UNION C3' SUBSET A) /\
25128 (simple_arc_end C1' x' p1) /\
25129 (simple_arc_end C2' x' p2) /\
25130 (simple_arc_end C3' x' p3) /\
25131 (C1' INTER C2' = {x'}) /\
25132 (C2' INTER C3' = {x'}) /\
25133 (C3' INTER C1' = {x'})
25138 TYPEL_THEN[`C2`;`C3`;`{p2}`] (fun t -> ANT_TAC (ISPECL t simple_arc_end_restriction));
25140 IMATCH_MP_TAC simple_arc_end_simple;
25143 IMATCH_MP_TAC simple_arc_end_closed;
25146 IMATCH_MP_TAC simple_arc_end_end_closed;
25147 TYPE_THEN `C2` EXISTS_TAC;
25148 TYPE_THEN `x` EXISTS_TAC;
25149 IMATCH_MP_TAC simple_arc_end_symm;
25151 REWRITE_TAC[EMPTY_EXISTS];
25152 REWRITE_TAC[EQ_EMPTY;INTER;INR IN_SING];
25153 TYPE_THEN `C2 p2` SUBGOAL_TAC;
25154 ASM_MESON_TAC[simple_arc_end_end2];
25155 TYPE_THEN `C2 x` SUBGOAL_TAC;
25156 ASM_MESON_TAC[simple_arc_end_end];
25157 TYPE_THEN `C3 x` SUBGOAL_TAC;
25158 ASM_MESON_TAC[simple_arc_end_end];
25161 TYPE_THEN `v' = p2` SUBGOAL_TAC;
25163 REWRITE_TAC[eq_sing; INR IN_SING;];
25164 REWRITE_TAC[INTER;INR IN_SING ];
25166 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
25168 TYPE_THEN `v` EXISTS_TAC;
25170 TYPE_THEN `C'` EXISTS_TAC;
25173 TYPE_THEN `v = x` ASM_CASES_TAC;
25174 FIRST_ASSUM (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]) THEN REWRITE_TAC[t]);
25175 TYPE_THEN `C' = C2` SUBGOAL_TAC;
25176 IMATCH_MP_TAC simple_arc_end_inj;
25177 TYPE_THEN `C2` EXISTS_TAC;
25178 TYPE_THEN `x` EXISTS_TAC;
25179 TYPE_THEN `p2` EXISTS_TAC;
25182 IMATCH_MP_TAC simple_arc_end_simple;
25184 REWRITE_TAC[SUBSET_REFL];
25185 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]) THEN REWRITE_TAC[t]);
25186 TYPE_THEN `C1` EXISTS_TAC;
25187 TYPE_THEN `C3` EXISTS_TAC;
25189 ONCE_REWRITE_TAC [INTER_COMM];
25191 (* [B] general case *)
25192 TYPEL_THEN [`C3`;`x`;`p3`;`v`] (fun t-> ANT_TAC (ISPECL t simple_arc_end_cut));
25196 REWRITE_TAC[eq_sing;INTER];
25199 FIRST_ASSUM (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
25200 TYPE_THEN `C' p3` SUBGOAL_TAC;
25201 ASM_MESON_TAC[simple_arc_end_end];
25204 REWRITE_TAC[SUBSET];
25207 TYPE_THEN `C1 UNION C''` EXISTS_TAC;
25208 TYPE_THEN `C'''` EXISTS_TAC;
25210 TYPE_THEN `(C1 UNION C'') UNION C' UNION C''' = C1 UNION C' UNION (C'' UNION C''')` SUBGOAL_TAC;
25212 DISCH_THEN_REWRITE;
25214 IMATCH_MP_TAC SUBSET_TRANS;
25215 TYPE_THEN `C1 UNION C2 UNION C3` EXISTS_TAC;
25217 IMATCH_MP_TAC subset_union_pair ;
25218 REWRITE_TAC[SUBSET_REFL];
25219 IMATCH_MP_TAC subset_union_pair ;
25220 ASM_REWRITE_TAC[SUBSET_REFL];
25223 IMATCH_MP_TAC simple_arc_end_symm;
25224 IMATCH_MP_TAC simple_arc_end_trans;
25225 TYPE_THEN `x` EXISTS_TAC;
25228 IMATCH_MP_TAC simple_arc_end_symm;
25230 IMATCH_MP_TAC EQ_EXT;
25231 REWRITE_TAC[INTER;INR IN_SING ];
25235 TYPE_THEN `C'' SUBSET C3` SUBGOAL_TAC;
25237 SET_TAC [SUBSET;UNION];
25238 REWRITE_TAC[eq_sing;INTER;SUBSET];
25240 DISCH_THEN_REWRITE;
25242 ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
25244 TYPE_THEN `(C1 UNION C'') v /\ (C' v) /\ (C''' v)` SUBGOAL_TAC;
25245 REWRITE_TAC[UNION];
25249 ASM_MESON_TAC[simple_arc_end_end2];
25250 ASM_MESON_TAC[simple_arc_end_end;];
25253 TYPE_THEN `C''' SUBSET C3` SUBGOAL_TAC;
25255 SET_TAC[UNION;SUBSET];
25257 TYPE_THEN `C' INTER C''' = {v}` SUBGOAL_TAC;
25258 IMATCH_MP_TAC EQ_EXT;
25259 REWRITE_TAC[INR IN_SING];
25264 REWRITE_TAC[eq_sing;SUBSET;INTER];
25266 DISCH_THEN_REWRITE;
25267 ASM_REWRITE_TAC[INTER;];
25268 DISCH_THEN_REWRITE;
25270 TYPEL_THEN [`C2`;`p2`;`x`;`v`] (fun t-> ANT_TAC(ISPECL t simple_arc_end_cut));
25273 IMATCH_MP_TAC simple_arc_end_symm;
25280 MESON_TAC[ISUBSET];
25281 IMATCH_MP_TAC simple_arc_end_distinct;
25282 TYPE_THEN `C'` EXISTS_TAC;
25286 TYPE_THEN `C'''' = C'` SUBGOAL_TAC;
25287 IMATCH_MP_TAC simple_arc_end_inj;
25288 TYPE_THEN `C2` EXISTS_TAC;
25289 TYPE_THEN `p2` EXISTS_TAC;
25290 TYPE_THEN `v` EXISTS_TAC;
25293 IMATCH_MP_TAC simple_arc_end_symm;
25296 IMATCH_MP_TAC simple_arc_end_simple;
25299 SET_TAC[UNION;SUBSET];
25300 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
25302 TYPE_THEN `~C' x` SUBGOAL_TAC;
25303 PROOF_BY_CONTR_TAC;
25305 TYPE_THEN `C''''' x` SUBGOAL_TAC;
25306 ASM_MESON_TAC[simple_arc_end_end2];
25310 REWRITE_TAC[eq_sing;INTER;];
25318 TYPE_THEN `C'' x` SUBGOAL_TAC;
25319 ASM_MESON_TAC[simple_arc_end_end];
25327 IMATCH_MP_TAC EQ_EXT;
25328 REWRITE_TAC[UNION;INTER;INR IN_SING];
25331 TYPE_THEN `C'' SUBSET C3` SUBGOAL_TAC;
25333 SET_TAC[UNION;SUBSET];
25339 REWRITE_TAC[SUBSET;INTER;eq_sing];
25341 DISCH_THEN_REWRITE;
25344 REWRITE_TAC[eq_sing;INTER];
25347 TYPE_THEN `~ (C''' x)` SUBGOAL_TAC;
25353 REWRITE_TAC[eq_sing;INTER;];
25356 IMATCH_MP_TAC EQ_EXT;
25357 REWRITE_TAC[INTER;UNION;INR IN_SING];
25364 REWRITE_TAC[SUBSET;INTER;eq_sing];
25366 DISCH_THEN_REWRITE;
25369 REWRITE_TAC[UNION];
25370 (* Fri Aug 13 20:36:09 EDT 2004 *)
25376 let simple_arc_sep = prove_by_refinement(
25377 `!A C1 C2 C3 x p1 p2 p3.
25378 (C1 UNION C2 UNION C3 SUBSET A) /\
25379 (simple_arc_end C1 x p1) /\ ~(C1 p2) /\ ~(C1 p3) /\
25380 (simple_arc_end C2 x p2) /\ ~(C2 p1) /\ ~(C2 p3) /\
25381 (simple_arc_end C3 x p3) /\ ~(C3 p1) /\ ~(C3 p2) ==>
25383 (C1' UNION C2' UNION C3' SUBSET A) /\
25384 (simple_arc_end C1' x' p1) /\
25385 (simple_arc_end C2' x' p2) /\
25386 (simple_arc_end C3' x' p3) /\
25387 (C1' INTER C2' = {x'}) /\
25388 (C2' INTER C3' = {x'}) /\
25389 (C3' INTER C1' = {x'})
25395 IMATCH_MP_TAC simple_arc_sep2;
25396 USE 0 (MATCH_MP simple_arc_sep3);
25398 TYPE_THEN `C1'` EXISTS_TAC;
25399 TYPE_THEN `C2'` EXISTS_TAC;
25400 TYPE_THEN `C3'` EXISTS_TAC;
25401 TYPE_THEN `x'` EXISTS_TAC;
25406 (* ------------------------------------------------------------------ *)
25408 (* ------------------------------------------------------------------ *)
25412 let isthree = prove_by_refinement(
25413 `?x. (\t. (t < 3)) x`,
25417 TYPE_THEN `0` EXISTS_TAC;
25420 (* Sat Aug 14 11:56:32 EDT 2004 *)
25425 let three_t = new_type_definition "three_t" ("ABS3","REP3")
25428 let type_bij = prove_by_refinement(
25429 `!X (fXY:A->B) gYX.
25430 (!a. fXY (gYX a) = a) /\ (!r. X r = (gYX (fXY r) = r)) ==>
25431 (BIJ fXY X UNIV) /\ (BIJ gYX UNIV X)`,
25437 IMATCH_MP_TAC bij_inj_image;
25438 REWRITE_TAC[INJ;SUBSET;IMAGE ;];
25441 USE 2 (AP_TERM `gYX:B->A` );
25446 IMATCH_MP_TAC EQ_EXT;
25450 TYPE_THEN `gYX x''` EXISTS_TAC;
25453 IMATCH_MP_TAC bij_inj_image;
25454 REWRITE_TAC[INJ;SUBSET;IMAGE];
25460 USE 2(AP_TERM `fXY:A->B`);
25463 TYPE_THEN `fXY x` EXISTS_TAC;
25470 let thr_bij = prove_by_refinement(
25471 `(BIJ ABS3 {x | x < 3} UNIV) /\ (BIJ REP3 UNIV {x | x < 3})`,
25474 IMATCH_MP_TAC type_bij ;
25475 ASSUME_TAC three_t;
25477 REWRITE_TAC[three_t];
25481 DISCH_THEN_REWRITE;
25485 let thr_finite = prove_by_refinement(
25486 `(UNIV:three_t->bool) HAS_SIZE 3`,
25489 REWRITE_TAC [has_size_bij2];
25490 TYPE_THEN `REP3` EXISTS_TAC;
25491 ASM_REWRITE_TAC[thr_bij];
25492 (* Sat Aug 14 12:28:58 EDT 2004 *)
25496 let has_size3_bij = prove_by_refinement(
25497 `!(A:A->bool). A HAS_SIZE 3 <=> (?f. BIJ f (UNIV:three_t->bool) A)`,
25501 REWRITE_TAC[has_size_bij];
25505 ASSUME_TAC thr_bij;
25506 TYPE_THEN `compose f REP3` EXISTS_TAC;
25507 IMATCH_MP_TAC COMP_BIJ;
25508 TYPE_THEN `{m | m < 3}` EXISTS_TAC;
25512 TYPE_THEN `compose f ABS3` EXISTS_TAC;
25513 IMATCH_MP_TAC COMP_BIJ;
25514 TYPE_THEN `UNIV:three_t->bool` EXISTS_TAC;
25515 ASM_REWRITE_TAC[thr_bij];
25516 (* Sat Aug 14 12:36:22 EDT 2004 *)
25522 let has_size3_bij2 = prove_by_refinement(
25523 `!(A:A->bool). A HAS_SIZE 3 <=> (?f. BIJ f A (UNIV:three_t->bool) )`,
25526 REWRITE_TAC[has_size_bij2];
25530 TYPE_THEN `compose ABS3 f` EXISTS_TAC;
25531 IMATCH_MP_TAC COMP_BIJ;
25532 TYPE_THEN `{m | m < 3}` EXISTS_TAC;
25533 ASM_REWRITE_TAC[thr_bij];
25536 TYPE_THEN `compose REP3 f` EXISTS_TAC;
25537 IMATCH_MP_TAC COMP_BIJ;
25538 TYPE_THEN `UNIV:three_t ->bool` EXISTS_TAC;
25539 ASM_REWRITE_TAC[thr_bij];
25540 (* Sat Aug 14 12:40:48 EDT 2004 *)
25545 let cartesian = jordan_def
25546 `cartesian (X:A->bool) (Y:B->bool) =
25547 { (x,y) | X x /\ Y y}`;;
25549 let cartesian_pair = prove_by_refinement(
25550 `!X Y (x:A) (y:B). cartesian X Y (x,y) <=> (X x) /\ (Y y)`,
25553 REWRITE_TAC[cartesian;PAIR_SPLIT ;];
25558 let cartesian_el = prove_by_refinement(
25559 `!X Y (x:(A#B)). cartesian X Y x <=> (X (FST x)) /\ (Y (SND x))`,
25563 REWRITE_TAC[cartesian];
25568 TYPE_THEN`FST x` EXISTS_TAC;
25569 TYPE_THEN `SND x` EXISTS_TAC;
25574 (* ignore earlier K33 def *)
25576 let k33_graph = jordan_def
25577 `k33_graph = mk_graph_t (
25578 cartesian (UNIV:three_t ->bool) UNIV,
25579 cartesian UNIV UNIV,
25580 (\e. { (FST e,T), (SND e,F)} ) )`;;
25582 let graph_edge_mk_graph = prove_by_refinement(
25583 `!(V:A->bool) (E:B->bool) C. graph_edge(mk_graph_t (V,E,C)) = E`,
25586 REWRITE_TAC[graph_edge;dest_graph_t;part1;drop0];
25590 let graph_vertex_mk_graph = prove_by_refinement(
25591 `!(V:A->bool) (E:B->bool) C. graph_vertex(mk_graph_t (V,E,C)) = V`,
25594 REWRITE_TAC[graph_vertex;dest_graph_t;];
25598 let graph_inc_mk_graph = prove_by_refinement(
25599 `!(V:A->bool) (E:B->bool) C. graph_inc(mk_graph_t (V,E,C)) = C`,
25602 REWRITE_TAC[graph_inc;dest_graph_t;drop1];
25606 let k33_isgraph = prove_by_refinement(
25607 `graph (k33_graph)`,
25610 REWRITE_TAC[graph;has_size2];
25611 REWRITE_TAC[IMAGE;SUBSET;];
25613 REWRITE_TAC[k33_graph;graph_inc_mk_graph;graph_edge_mk_graph;graph_vertex_mk_graph;in_pair;cartesian];
25616 REWRITE_TAC[in_pair];
25619 DISCH_THEN DISJ_CASES_TAC;
25622 TYPE_THEN `(x,T)` EXISTS_TAC;
25623 TYPE_THEN `(y,F)` EXISTS_TAC;
25625 REWRITE_TAC[PAIR_SPLIT];
25626 (* Sat Aug 14 13:18:16 EDT 2004 *)
25631 let k33_iso = prove_by_refinement(
25632 `!(A:A->bool) B (E:B->bool) f.
25633 A HAS_SIZE 3 /\ B HAS_SIZE 3 /\ (A INTER B = EMPTY) /\
25634 BIJ f E (cartesian A B) ==>
25635 (graph_isomorphic k33_graph
25637 (A UNION B, E,( \ e. { (FST (f e)), (SND (f e)) }))))`,
25641 REWRITE_TAC[graph_isomorphic;graph_iso;k33_graph;graph_edge_mk_graph;graph_vertex_mk_graph;graph_inc_mk_graph;];
25642 RULE_ASSUM_TAC (REWRITE_RULE[has_size3_bij]);
25644 TYPE_THEN `u = ( \ t. (if (SND t) then (f'' (FST t)) else (f'(FST t))))` ABBREV_TAC ;
25646 TYPE_THEN `u` EXISTS_TAC;
25647 TYPE_THEN `g = INV f E (cartesian A B)` ABBREV_TAC ;
25648 TYPE_THEN `v = ( \t . (g (f'' (FST t), f' (SND t))))` ABBREV_TAC ;
25650 TYPE_THEN `v` EXISTS_TAC;
25651 TYPE_THEN `(u,v)` EXISTS_TAC;
25655 REWRITE_TAC[BIJ;SURJ;INJ];
25659 REWRITE_TAC[cartesian_el];
25660 REWRITE_TAC[UNION;];
25664 REWRITE_TAC[BIJ;SURJ];
25667 REWRITE_TAC[BIJ;SURJ];
25669 REWRITE_TAC[cartesian_el;];
25675 REWRITE_TAC[BIJ;INJ];
25677 REWRITE_TAC[PAIR_SPLIT];
25679 FIRST_ASSUM IMATCH_MP_TAC ;
25682 PROOF_BY_CONTR_TAC;
25684 REWRITE_TAC[EMPTY_EXISTS ];
25685 TYPE_THEN `f'' (FST x)` EXISTS_TAC;
25686 REWRITE_TAC[INTER];
25687 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
25691 PROOF_BY_CONTR_TAC;
25693 REWRITE_TAC[EMPTY_EXISTS ];
25694 TYPE_THEN `f' (FST x)` EXISTS_TAC;
25695 REWRITE_TAC[INTER];
25696 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
25698 REWRITE_TAC[PAIR_SPLIT];
25701 USE 3(REWRITE_RULE[BIJ;INJ]);
25703 FIRST_ASSUM IMATCH_MP_TAC ;
25705 DISCH_THEN_REWRITE ;
25706 REWRITE_TAC[UNION];
25708 DISCH_THEN DISJ_CASES_TAC;
25709 TYPE_THEN `( ((INV f'' UNIV A) x ), T )` EXISTS_TAC;
25711 REWRITE_TAC[cartesian_el];
25714 IMATCH_MP_TAC inv_comp_right;
25716 TYPE_THEN `( ((INV f' UNIV B) x ), F )` EXISTS_TAC;
25717 REWRITE_TAC[cartesian_el];
25720 IMATCH_MP_TAC inv_comp_right;
25723 REWRITE_TAC[cartesian_el];
25724 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
25728 REWRITE_TAC[IMAGE_CLAUSES];
25731 TYPE_THEN `cartesian A B (f'' (FST e), f' (SND e))` SUBGOAL_TAC;
25732 REWRITE_TAC[cartesian_el];
25733 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
25735 ASM_SIMP_TAC[inv_comp_right];
25737 TYPE_THEN `BIJ g (cartesian A B) E` SUBGOAL_TAC;
25739 IMATCH_MP_TAC INVERSE_BIJ;
25745 REWRITE_TAC[cartesian_el];
25749 USE 7(REWRITE_RULE[BIJ;SURJ]);
25751 FIRST_ASSUM IMATCH_MP_TAC ;
25752 REWRITE_TAC[cartesian_el];
25753 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
25756 TYPE_THEN `(f'' (FST x),f' (SND x)) = (f''(FST y),f' (SND y))` SUBGOAL_TAC;
25757 USE 7(REWRITE_RULE[BIJ;INJ]);
25759 FIRST_ASSUM IMATCH_MP_TAC ;
25760 ASM_REWRITE_TAC [cartesian_el];
25761 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
25763 REWRITE_TAC[PAIR_SPLIT];
25766 USE 2 (REWRITE_RULE[BIJ;INJ]);
25768 FIRST_ASSUM IMATCH_MP_TAC ;
25770 USE 3 (REWRITE_RULE[BIJ;INJ]);
25772 FIRST_ASSUM IMATCH_MP_TAC ;
25775 REWRITE_TAC[INJ;SURJ];
25776 DISCH_THEN_REWRITE;
25777 REWRITE_TAC[cartesian_el];
25781 TYPE_THEN `?u0. (f'' u0 = FST (f x))` SUBGOAL_TAC ;
25782 USE 2 (REWRITE_RULE[BIJ;SURJ]);
25784 FIRST_ASSUM IMATCH_MP_TAC ;
25785 USE 0 (REWRITE_RULE[BIJ;SURJ]);
25789 USE 11(REWRITE_RULE[cartesian_el]);
25793 TYPE_THEN `?u1. (f' u1 = SND (f x))` SUBGOAL_TAC ;
25794 USE 3 (REWRITE_RULE[BIJ;SURJ]);
25796 FIRST_ASSUM IMATCH_MP_TAC ;
25797 USE 0 (REWRITE_RULE[BIJ;SURJ]);
25801 USE 12(REWRITE_RULE[cartesian_el]);
25804 TYPE_THEN `(u0,u1)` EXISTS_TAC;
25807 IMATCH_MP_TAC inv_comp_left;
25809 (* Sat Aug 14 14:58:11 EDT 2004 *)
25815 (* ********************************************************* *)
25817 let mk_segment_inj_image2 = prove_by_refinement(
25819 euclid n x /\ euclid n y /\ ~(x = y)
25820 ==> (?f. continuous f (top_of_metric (UNIV,d_real))
25821 (top_of_metric (euclid n,d_euclid)) /\
25822 INJ f {x | &0 <= x /\ x <= &1} (euclid n) /\
25823 (f (&0) = x) /\ (f (&1) = y) /\
25824 (IMAGE f {t | &0 <= t /\ t <= &1} = mk_segment x y))`,
25828 TYPE_THEN `(joinf (\u. x) (joinf (\t. euclid_plus (t *# y) ((&1 - t) *# x)) (\u. y) (&.1)) (&.0))` EXISTS_TAC;
25830 IMATCH_MP_TAC cont_mk_segment;
25832 REWRITE_TAC[joinf;IMAGE ];
25833 REWRITE_TAC[mk_segment];
25835 TYPE_THEN `((if &0 < &0 then x else if &0 < &1 then euclid_plus (&0 *# y) ((&1 - &0) *# x) else y) = x) /\ ((if &1 < &0 then x else if &1 < &1 then euclid_plus (&1 *# y) ((&1 - &1) *# x) else y) = y)` SUBGOAL_TAC;
25836 REWRITE_TAC[REAL_ARITH `~(&0 < &0) /\ ~(&1 < &0) /\ (&0 < &1) /\ ~(&1 < &1)`];
25838 REWRITE_TAC[euclid_scale0; euclid_scale_one ; euclid_lzero];
25839 DISCH_THEN_REWRITE;
25846 TYPE_THEN `~(x' < &0)` SUBGOAL_TAC;
25849 DISCH_THEN_REWRITE;
25850 ASM_CASES_TAC `x' < &1`;
25852 IMATCH_MP_TAC euclid_add_closure;
25853 CONJ_TAC THEN (IMATCH_MP_TAC euclid_scale_closure) THEN (ASM_REWRITE_TAC[]);
25857 TYPE_THEN `~(x' < &0)` SUBGOAL_TAC;
25860 DISCH_THEN_REWRITE;
25861 TYPE_THEN `~(y' < &0)` SUBGOAL_TAC;
25864 DISCH_THEN_REWRITE;
25865 TYPE_THEN `(if (x' < &1) then (euclid_plus (x' *# y) ((&1 - x') *# x)) else y) = ( euclid_plus (x' *# y) ((&1 - x') *# x))` SUBGOAL_TAC;
25866 TYPE_THEN `(x' < &1) \/ (x' = &1)` SUBGOAL_TAC;
25869 DISCH_THEN DISJ_CASES_TAC;
25871 TYPE_THEN `~(x' < &1)` SUBGOAL_TAC;
25874 DISCH_THEN_REWRITE;
25877 REWRITE_TAC[euclid_scale_one;euclid_scale0;euclid_rzero];
25878 DISCH_THEN_REWRITE;
25880 TYPE_THEN `(if (y' < &1) then (euclid_plus (y' *# y) ((&1 - y') *# x)) else y) = ( euclid_plus (y' *# y) ((&1 - y') *# x))` SUBGOAL_TAC;
25881 TYPE_THEN `(y' < &1) \/ (y' = &1)` SUBGOAL_TAC;
25884 DISCH_THEN DISJ_CASES_TAC;
25886 TYPE_THEN `~(y' < &1)` SUBGOAL_TAC;
25889 DISCH_THEN_REWRITE;
25892 REWRITE_TAC[euclid_scale_one;euclid_scale0;euclid_rzero];
25893 DISCH_THEN_REWRITE;
25895 ONCE_REWRITE_TAC [euclid_eq_minus];
25896 REWRITE_TAC[euclid_minus_scale;euclid_ldistrib;euclid_scale_act];
25897 ONCE_REWRITE_TAC [euclid_plus_pair];
25898 REWRITE_TAC[GSYM euclid_rdistrib];
25900 REWRITE_TAC[REAL_ARITH `x' + -- &1 * y' = x' - y'`];
25901 REWRITE_TAC[REAL_ARITH `&1 - x' - (&1 - y') = -- &1 *(x' - y')`];
25902 REWRITE_TAC[GSYM euclid_scale_act;GSYM euclid_minus_scale;ONCE_REWRITE_RULE[EQ_SYM_EQ] euclid_eq_minus];
25905 PROOF_BY_CONTR_TAC;
25908 IMATCH_MP_TAC euclid_scale_cancel;
25909 TYPE_THEN `(x' - y')` EXISTS_TAC;
25915 IMATCH_MP_TAC EQ_EXT;
25925 ASM_MESON_TAC[REAL_ARITH `~(&0 <=. x /\ x < &.0)`];
25930 TYPE_THEN `&1 - x''` EXISTS_TAC;
25938 ONCE_REWRITE_TAC [euclid_add_comm];
25939 REWRITE_TAC[REAL_ARITH `&1 - (&1 - x) = x`];
25943 TYPE_THEN `&0` EXISTS_TAC;
25948 REWRITE_TAC[euclid_scale_one; euclid_scale0; euclid_lzero;REAL_ARITH `&1 - &0 = &1` ];
25952 TYPE_THEN `&1 - a` EXISTS_TAC ;
25961 ASM_MESON_TAC[REAL_ARITH `&1 - a < &0 ==> ~(a <= &1)`];
25963 REWRITE_TAC[REAL_ARITH `&1 - (&1 - a) = a`];
25964 ASM_MESON_TAC [euclid_add_comm];
25965 TYPE_THEN `a = &.0` SUBGOAL_TAC;
25973 REWRITE_TAC [euclid_scale_one; euclid_scale0; euclid_lzero;REAL_ARITH `&1 - &0 = &1` ];
25977 let mk_segment_simple_arc_end = prove_by_refinement(
25979 (euclid 2 x) /\ (euclid 2 y) /\ ~(x = y) ==>
25980 simple_arc_end (mk_segment x y) x y`,
25985 REWRITE_TAC[simple_arc_end];
25986 TYPEL_THEN [`x`;`y`;`2`] (fun t-> ANT_TAC (ISPECL t mk_segment_inj_image2));
25989 TYPE_THEN `f` EXISTS_TAC;
25990 RULE_ASSUM_TAC (REWRITE_RULE[GSYM top2 ]);
25992 (* Tue Aug 17 10:10:00 EDT 2004 *)
25998 let cis0 = prove_by_refinement(
26002 REWRITE_TAC[cis;COS_0;SIN_0;e1;];
26006 let cispi2 = prove_by_refinement(
26007 `cis (pi/(&2)) = e2`,
26010 REWRITE_TAC [cis;COS_PI2;SIN_PI2;e2];
26014 let neg_point = prove_by_refinement(
26015 `!x y. -- (point (x,y)) = point (--x, --y)`,
26019 REWRITE_TAC[euclid_neg];
26020 IMATCH_MP_TAC EQ_EXT;
26023 MP_TAC (ARITH_RULE `(x' = 0) \/ (x' = 1) \/ (2 <=| x')`);
26025 ASM_REWRITE_TAC[coord01];
26026 ASM_REWRITE_TAC[coord01];
26027 TYPE_THEN `euclid 2(point(x,y)) /\ euclid 2(point(--x,--y))` SUBGOAL_TAC;
26028 ASM_MESON_TAC[euclid_point];
26029 REWRITE_TAC[euclid];
26033 ASM_MESON_TAC[REAL_ARITH `-- &0 = &0`];
26034 (* Tue Aug 17 10:27:14 EDT 2004 *)
26039 let cispi = prove_by_refinement(
26043 REWRITE_TAC[cis;COS_PI ;SIN_PI;e1];
26044 REWRITE_TAC[neg_point];
26046 REWRITE_TAC[PAIR_SPLIT];
26048 (* Tue Aug 17 10:28:55 EDT 2004 *)
26053 let cis3pi2 = prove_by_refinement(
26054 `cis(&3 *pi/(&2)) = -- e2`,
26057 TYPE_THEN `&3 *pi/(&2) = pi/(&2) + pi` SUBGOAL_TAC;
26058 REWRITE_TAC[REAL_ARITH `&3 = &1 + &1 + &1`];
26059 REWRITE_TAC[REAL_ARITH `(x + y)*z = x*z + y*z`];
26061 DISCH_THEN_REWRITE;
26062 REWRITE_TAC[cis;COS_PERIODIC_PI;SIN_PERIODIC_PI;GSYM neg_point;];
26064 REWRITE_TAC[GSYM cis;cispi2];
26065 (* Tue Aug 17 10:34:32 EDT 2004 *)
26070 let closedball_convex = prove_by_refinement(
26071 `!x e n. (convex (closed_ball (euclid n,d_euclid) x e))`,
26074 REWRITE_TAC[convex;closed_ball;SUBSET;mk_segment;];
26080 IMATCH_MP_TAC (euclid_add_closure);
26081 CONJ_TAC THEN (IMATCH_MP_TAC euclid_scale_closure) THEN (ASM_REWRITE_TAC[]);
26083 TYPE_THEN `d_euclid x x'' = d_euclid (a *# x + (&1 - a) *# x) x''` SUBGOAL_TAC;
26084 REWRITE_TAC[trivial_lin_combo];
26085 DISCH_THEN_REWRITE;
26088 ASM_CASES_TAC `a = &0` ;
26090 DISCH_THEN_REWRITE;
26092 ASM_REWRITE_TAC [euclid_scale0;euclid_scale_one;euclid_lzero;];
26093 TYPE_THEN `(!d. (?u v. (d <= u + v) /\ (u <= a*e) /\ (v <= (&1- a)*e)) ==> (d <= e))` SUBGOAL_TAC;
26095 TYPE_THEN `u + v <= (a*e) + (&1 - a)*e` SUBGOAL_TAC;
26096 IMATCH_MP_TAC REAL_LE_ADD2;
26098 REWRITE_TAC[GSYM REAL_RDISTRIB;REAL_ARITH `(a + &1 - a = &1) /\ (&1 * C = C )`];
26101 DISCH_THEN IMATCH_MP_TAC ;
26102 TYPE_THEN `z = a *# x' + (&1 - a) *# x` ABBREV_TAC;
26103 TYPE_THEN `d_euclid (a *# x + (&1 - a)*# x) z` EXISTS_TAC;
26104 TYPE_THEN `d_euclid z x''` EXISTS_TAC;
26105 TYPE_THEN `euclid n z` SUBGOAL_TAC;
26107 IMATCH_MP_TAC (euclid_add_closure);
26108 CONJ_TAC THEN (IMATCH_MP_TAC euclid_scale_closure) THEN (ASM_REWRITE_TAC[]);
26112 IMATCH_MP_TAC metric_space_triangle;
26113 TYPE_THEN `euclid n` EXISTS_TAC;
26114 REWRITE_TAC[metric_euclid];
26115 ASM_REWRITE_TAC[trivial_lin_combo];
26118 TYPE_THEN `(d_euclid (euclid_plus (a *# x) ((&1 - a) *# x)) (euclid_plus (a *# x') ((&1 - a) *# x))) = d_euclid (a *# x) (a *# x') ` SUBGOAL_TAC;
26119 IMATCH_MP_TAC metric_translate;
26120 TYPE_THEN `n` EXISTS_TAC;
26121 REPEAT (CONJ_TAC THEN TRY (IMATCH_MP_TAC euclid_scale_closure) THEN ASM_REWRITE_TAC[]);
26122 DISCH_THEN_REWRITE;
26123 TYPE_THEN `d_euclid (a *# x) (a *# x') = abs (a) * d_euclid x x'` SUBGOAL_TAC;
26124 IMATCH_MP_TAC norm_scale_vec;
26126 DISCH_THEN_REWRITE;
26127 TYPE_THEN `abs a = a` SUBGOAL_TAC;
26128 ASM_MESON_TAC[REAL_ABS_REFL];
26129 DISCH_THEN_REWRITE;
26130 IMATCH_MP_TAC REAL_PROP_LE_LMUL;
26136 TYPE_THEN `d_euclid (euclid_plus (a *# x') ((&1 - a) *# x)) (euclid_plus (a *# x') ((&1 - a) *# y)) = d_euclid ((&1 - a) *# x) ((&1 - a) *# y)` SUBGOAL_TAC;
26137 IMATCH_MP_TAC metric_translate_LEFT;
26138 TYPE_THEN `n` EXISTS_TAC;
26139 REPEAT (CONJ_TAC THEN TRY (IMATCH_MP_TAC euclid_scale_closure) THEN ASM_REWRITE_TAC[]);
26140 DISCH_THEN_REWRITE;
26141 TYPE_THEN `!b. d_euclid (b *# x) (b *# y) = abs (b) * d_euclid x y` SUBGOAL_TAC;
26143 IMATCH_MP_TAC norm_scale_vec;
26145 DISCH_THEN_REWRITE;
26146 TYPE_THEN `abs (&1 - a) = (&1 - a)` SUBGOAL_TAC;
26147 REWRITE_TAC [REAL_ABS_REFL];
26150 DISCH_THEN_REWRITE;
26151 IMATCH_MP_TAC REAL_PROP_LE_LMUL;
26158 let closedball_mk_segment_end = prove_by_refinement(
26160 (closed_ball(euclid n,d_euclid) x e u) /\
26161 (closed_ball(euclid n,d_euclid) x e v) ==>
26162 (mk_segment u v SUBSET (closed_ball(euclid n,d_euclid) x e))`,
26166 ASSUME_TAC closedball_convex;
26167 TYPEL_THEN [`x`;`e`;`n`] (USE 2 o ISPECL);
26168 USE 2 (REWRITE_RULE[convex]);
26169 FIRST_ASSUM IMATCH_MP_TAC ;
26174 let euclid2_e12 = prove_by_refinement(
26175 `euclid 2 e1 /\ euclid 2 e2`,
26178 REWRITE_TAC[e1;e2;euclid_point];
26182 let in_union = prove_by_refinement(
26183 `!X Y Z. (X:A->bool) SUBSET Y \/ (X SUBSET Z) ==> (X SUBSET Y UNION Z)`,
26186 REWRITE_TAC[SUBSET;UNION ];
26191 let mk_segment_hyperplane = prove_by_refinement(
26192 `!p r i. (i < 4) /\ (&0 <r) /\ (euclid 2 p) ==>
26193 (mk_segment p (p + r *# (cis(&i * pi/(&2))))) SUBSET
26194 (hyperplane 2 e2 (p 1) UNION
26195 hyperplane 2 e1 (p 0)) `,
26199 TYPE_THEN `?x y. p = point (x,y)` SUBGOAL_TAC;
26200 USE 0 (MATCH_MP point_onto);
26202 TYPE_THEN `FST p'` EXISTS_TAC;
26203 TYPE_THEN `SND p'` EXISTS_TAC;
26207 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
26208 REWRITE_TAC[coord01];
26210 TYPE_THEN `convex(hyperplane 2 e2 y)` SUBGOAL_TAC;
26211 IMATCH_MP_TAC hyperplane_convex;
26212 REWRITE_TAC[euclid2_e12];
26213 TYPE_THEN `convex(hyperplane 2 e1 x)` SUBGOAL_TAC;
26214 IMATCH_MP_TAC hyperplane_convex;
26215 REWRITE_TAC[euclid2_e12];
26216 REWRITE_TAC[convex];
26218 TYPE_THEN `hyperplane 2 e1 x (point(x,y)) /\ hyperplane 2 e2 y (point(x,y))` SUBGOAL_TAC;
26219 REWRITE_TAC[e1;e2;GSYM line2D_S;GSYM line2D_F];
26221 TYPE_THEN `(x,y)` EXISTS_TAC;
26223 TYPE_THEN `(x,y)` EXISTS_TAC;
26226 USE 2 (MATCH_MP (ARITH_RULE (`(i < 4) ==> (i = 0) \/ (i = 1) \/ (i = 2) \/ (i = 3)`)));
26228 IMATCH_MP_TAC in_union;
26229 TYPE_THEN `z = (euclid_plus (point (x,y)) (r *# cis (&i * pi / &2)))` ABBREV_TAC ;
26230 TYPE_THEN `hyperplane 2 e2 y z \/ hyperplane 2 e1 x z ==> mk_segment (point (x,y)) z SUBSET hyperplane 2 e2 y \/ mk_segment (point (x,y)) z SUBSET hyperplane 2 e1 x` SUBGOAL_TAC;
26232 DISCH_THEN IMATCH_MP_TAC ;
26234 TYPE_THEN `( (cis (&i *pi/(&2))) 0 = &0) ==> (hyperplane 2 e1 x z)` SUBGOAL_TAC;
26235 REWRITE_TAC[e1;GSYM line2D_F];
26237 REWRITE_TAC[cis;coord01];
26238 DISCH_THEN_REWRITE;
26239 REWRITE_TAC[point_scale;point_add];
26241 TYPE_THEN `(x, y+ r*sin (&i *pi/(&2)))` EXISTS_TAC;
26244 TYPE_THEN `( (cis (&i *pi/(&2))) 1 = &0) ==> (hyperplane 2 e2 y z)` SUBGOAL_TAC;
26245 REWRITE_TAC[e2;GSYM line2D_S];
26247 REWRITE_TAC[cis;coord01];
26248 DISCH_THEN_REWRITE;
26249 REWRITE_TAC[point_scale;point_add];
26251 TYPE_THEN `(x + r*cos(&i *pi/(&2)) , y)` EXISTS_TAC;
26254 TYPE_THEN `(cis (&i * pi / &2) 0 = &0) \/ (cis (&i * pi / &2) 1 = &0) ==> hyperplane 2 e2 y z \/ hyperplane 2 e1 x z` SUBGOAL_TAC;
26256 DISCH_THEN IMATCH_MP_TAC ;
26258 POP_ASSUM_LIST (fun t-> ALL_TAC);
26263 ASM_REWRITE_TAC[cis0;e1;coord01];
26266 ASM_REWRITE_TAC[cispi2;e2;coord01];
26268 REWRITE_TAC[REAL_MUL_2];
26270 ASM_REWRITE_TAC[cispi;e1;coord01;neg_point];
26272 ASM_REWRITE_TAC[cis3pi2;e2;coord01;neg_point];
26274 (* Tue Aug 17 11:46:56 EDT 2004 *)
26279 let d_euclid_mk_segment = prove_by_refinement(
26280 `!n a p q . (&0 <= a) /\ (a <= &1) /\ (euclid n p) /\ (euclid n q) ==>
26281 (d_euclid p (a*#p + (&1 - a)*#q) = (&1 - a)*(d_euclid p q))`,
26285 TYPE_THEN `!z. d_euclid (a*# p + (&1 - a)*# p) z = d_euclid p z` SUBGOAL_TAC;
26286 REWRITE_TAC[trivial_lin_combo];
26287 DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t]);
26288 TYPE_THEN `d_euclid (euclid_plus (a *# p) ((&1 - a) *# p)) (euclid_plus (a *# p) ((&1 - a) *# q)) = d_euclid ( ((&1 - a) *# p)) ( ((&1 - a) *# q))` SUBGOAL_TAC;
26289 ASM_MESON_TAC [metric_translate_LEFT;euclid_scale_closure];
26290 DISCH_THEN_REWRITE;
26291 TYPE_THEN `d_euclid ((&1 - a) *# p) ((&1 - a) *# q) = abs (&1- a) * d_euclid p q` SUBGOAL_TAC;
26292 ASM_MESON_TAC[euclid_scale_closure;norm_scale_vec];
26293 DISCH_THEN_REWRITE;
26294 TYPE_THEN `abs (&1 - a) = (&1 - a)` SUBGOAL_TAC;
26297 DISCH_THEN_REWRITE;
26298 REWRITE_TAC[trivial_lin_combo];
26299 (* Tue Aug 17 12:24:07 EDT 2004 *)
26304 let mk_segment_eq = prove_by_refinement(
26305 `! a p x y. ((a*# p + (&1 - a)*# x) = (a *# p + (&1 - a)*# y)) ==>
26306 (a = &1) \/ (x = y)`,
26309 ONCE_REWRITE_TAC[euclid_eq_minus];
26310 REWRITE_TAC[euclid_minus;euclid_plus;euclid0;euclid_scale];
26312 USE 0 (REWRITE_RULE[FUN_EQ_THM]);
26313 IMATCH_MP_TAC (TAUT `(~A ==>B) ==> (A \/ B)`);
26315 IMATCH_MP_TAC EQ_EXT;
26318 USE 0 (SPEC `x':num` );
26320 REWRITE_TAC[REAL_ARITH `(a*b + r*c ) - (a*b + r*d) = r*c - r*d`];
26321 REWRITE_TAC[REAL_ARITH `a*y - a*z = a*(y-z)`];
26322 REWRITE_TAC[REAL_ENTIRE];
26328 let mk_segment_endpoint = prove_by_refinement(
26329 `!p x y n . (d_euclid p x = d_euclid p y) /\ ~(x = y) /\
26330 (euclid n x) /\ (euclid n y) /\ (euclid n p) ==>
26331 (mk_segment p x INTER mk_segment p y = {p})`,
26335 IMATCH_MP_TAC EQ_EXT;
26336 REWRITE_TAC[INTER;INR IN_SING];
26340 REWRITE_TAC[mk_segment];
26343 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
26344 PROOF_BY_CONTR_TAC;
26345 TYPE_THEN `~(a' = &1)` SUBGOAL_TAC;
26348 DISCH_THEN (fun t -> RULE_ASSUM_TAC (REWRITE_RULE[t]));
26351 REWRITE_TAC[euclid_scale0;euclid_scale_one;euclid_rzero];
26354 TYPE_THEN `(&1- a')*d_euclid p y = (&1- a)*d_euclid p x` SUBGOAL_TAC;
26356 ASM_MESON_TAC[d_euclid_mk_segment];
26358 PROOF_BY_CONTR_TAC;
26361 TYPE_THEN `d_euclid p y = &0` ASM_CASES_TAC;
26362 TYPE_THEN `p = y` SUBGOAL_TAC;
26363 ASM_MESON_TAC [d_euclid_zero];
26364 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
26365 ASM_MESON_TAC[d_euclid_zero];
26366 USE 12 (REWRITE_RULE[REAL_EQ_MUL_RCANCEL]);
26368 TYPE_THEN `a' = a` SUBGOAL_TAC;
26371 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
26372 USE 8 (MATCH_MP mk_segment_eq);
26375 DISCH_THEN_REWRITE;
26376 REWRITE_TAC[mk_segment_end];
26377 (* Tue Aug 17 14:04:19 EDT 2004 *)
26382 let cases4 = prove_by_refinement(
26383 `!i j. (i < j) /\ (j < 4) ==> ((i=0) /\ (j=1))\/ ((i=0) /\ (j=2)) \/
26384 ((i=0) /\ (j=3)) \/ ((i=1) /\ (j=2)) \/ ((i=1) /\ (j=3)) \/
26389 TYPE_THEN `!k. (k < 4) ==> (k = 0) \/ (k =1)\/ (k=2) \/ (k=3)` SUBGOAL_TAC;
26392 TYPE_THEN `(j = 0) \/ (j = 1) \/ (j = 2) \/ (j = 3)` SUBGOAL_TAC;
26393 FIRST_ASSUM IMATCH_MP_TAC ;
26396 TYPE_THEN `~(j=0)` SUBGOAL_TAC;
26399 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
26400 TYPE_THEN `(i < 3)` SUBGOAL_TAC;
26405 TYPE_THEN `(i=0) \/ (i = 1) \/ (i=2)` SUBGOAL_TAC;
26410 USE 3 (REWRITE_RULE [RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR]);
26411 TYPE_THEN `!k. ~((i = k) /\ (j = k))` SUBGOAL_TAC;
26415 DISCH_THEN (fun t-> USE 3 (REWRITE_RULE[t]));
26416 TYPE_THEN `~((i=2) /\ (j = 1))` SUBGOAL_TAC;
26419 DISCH_THEN (fun t-> USE 3(REWRITE_RULE[t]));
26422 REP_CASES_TAC THEN (ASM_REWRITE_TAC[]);
26426 let cis_distinct = prove_by_refinement(
26427 `!i j r p. (i < 4) /\ (j < 4) /\ ~(i = j) /\ (&0 < r) ==>
26428 ~((p + r*# (cis(&i * pi/(&2)))) = (p + r*# (cis(&j * pi/(&2)))))`,
26432 TYPE_THEN `!i j r p. (i < 4) /\ (j < 4) /\ ~(i = j) /\ (i < j) /\ (&0 < r) ==> ~((p + r*# (cis(&i * pi/(&2)))) = (p + r*# (cis(&j * pi/(&2)))))` SUBGOAL_TAC;
26434 TYPE_THEN `!p x y. (euclid_plus p x = euclid_plus p y) ==> (x = y)` SUBGOAL_TAC;
26435 REWRITE_TAC[euclid_plus];
26437 USE 6 (REWRITE_RULE[FUN_EQ_THM]);
26438 IMATCH_MP_TAC EQ_EXT;
26443 DISCH_THEN (fun t-> USE 0 (MATCH_MP t));
26444 USE 0 (AP_TERM `( *# ) (&1/r)`);
26445 USE 0 (REWRITE_RULE [euclid_scale_act]);
26446 TYPE_THEN `&1/r * r = &1` SUBGOAL_TAC;
26447 ONCE_REWRITE_TAC [REAL_ARITH `x*y = y*x`];
26448 ASM_MESON_TAC[REAL_DIV_LMUL;REAL_ARITH `&0 < r ==> ~(r = &0)`];
26449 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
26450 USE 0(REWRITE_RULE[euclid_scale_one]);
26451 TYPE_THEN `((i=0) /\ (j=1))\/ ((i=0) /\ (j=2)) \/ ((i=0) /\ (j=3)) \/ ((i=1) /\ (j=2)) \/ ((i=1) /\ (j=3)) \/ ((i=2)/\ (j=3))` SUBGOAL_TAC;
26452 IMATCH_MP_TAC cases4;
26454 REP_CASES_TAC THEN (FIRST_ASSUM MP_TAC) THEN (DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t;REAL_ARITH `(&1*x=x) /\ (&0*x= &0)`;e1;e2;cis0;cispi;cispi2;cis3pi2;neg_point;point_inj; PAIR_SPLIT; REAL_ARITH `~(&1 = &0) /\ ~(&0 = &1) /\ (-- &0 = &0) /\ ~(&1 = -- &1) /\ ~(-- &1 = &0) /\ ~(&0 = -- &1)`;REAL_MUL_2; REAL_HALF_DOUBLE ]))) THEN (ASM_REWRITE_TAC[]);
26456 TYPE_THEN `( i <| j) \/ (j <| i)` SUBGOAL_TAC;
26460 TYPEL_THEN [`i`;`j`;`r`] (USE 5 o ISPECL);
26462 TYPEL_THEN [`j`;`i`;`r`] (USE 5 o ISPECL);
26464 (* Tue Aug 17 15:01:38 EDT 2004 *)
26473 let cis_nz = prove_by_refinement(
26474 `!t. ~(cis(t) = euclid0)`,
26478 USE 0 (AP_TERM `norm2`);
26479 RULE_ASSUM_TAC (REWRITE_RULE[norm2_cis]);
26480 ASM_MESON_TAC[REAL_ARITH `~(&1= &0)`;norm2_0;];
26484 let polar_nz = prove_by_refinement(
26485 `!r t. ~(r = &0) ==> ~(r *# cis(t) =euclid0)`,
26489 USE 0 (AP_TERM `norm2`);
26490 RULE_ASSUM_TAC (REWRITE_RULE[norm2_scale_cis]);
26491 ASM_MESON_TAC[REAL_ARITH `(abs r = &0) ==> (r = &0)`;norm2_0];
26495 let polar_euclid = prove_by_refinement(
26496 `!r t. euclid 2 (r *# (cis t))`,
26499 REWRITE_TAC[cis;point_scale;euclid_point];
26503 let d_euclidpq = prove_by_refinement(
26504 `!n p q . (euclid n p) /\ (euclid n q) ==> (d_euclid p (p+q) =
26505 d_euclid q euclid0)`,
26509 TYPE_THEN `!z. d_euclid p z = d_euclid (p + euclid0) z` SUBGOAL_TAC;
26510 REWRITE_TAC[euclid_rzero];
26511 DISCH_THEN (fun t->ONCE_REWRITE_TAC[t]);
26512 TYPE_THEN `d_euclid (euclid_plus p euclid0) (euclid_plus p q) = d_euclid euclid0 q` SUBGOAL_TAC;
26513 IMATCH_MP_TAC metric_translate_LEFT;
26514 TYPE_THEN `n` EXISTS_TAC;
26515 ASM_REWRITE_TAC[euclid_euclid0;polar_euclid;];
26516 DISCH_THEN_REWRITE;
26517 IMATCH_MP_TAC metric_space_symm;
26518 TYPE_THEN `euclid n` EXISTS_TAC ;
26519 ASM_REWRITE_TAC[metric_euclid;euclid_euclid0;polar_euclid];
26523 let degree4_vertex_hv = prove_by_refinement(
26524 `!r p. (&0 < r) /\ (euclid 2 p) ==>
26527 simple_arc_end (C i) p (p + r*# (cis(&i * pi/(&2))))) /\
26529 (C i = mk_segment p (p + r*# (cis(&i * pi/(&2)))))) /\
26530 (!i j. (i < 4) /\ (j < 4) /\ (~(i=j)) ==>
26531 (C i INTER C j = {p})) /\
26533 (C i INTER {x | r <= d_euclid p x } =
26534 { (p + r *# (cis(&i* pi/(&2)))) })) /\
26536 C i SUBSET (closed_ball (euclid 2,d_euclid) p r)) /\
26538 C i SUBSET (hyperplane 2 e2 (p 1) UNION
26539 hyperplane 2 e1 (p 0)))) `,
26543 TYPE_THEN `(\i. mk_segment p (euclid_plus p (r *# cis (&i * pi / &2))))` EXISTS_TAC;
26547 TYPE_THEN `!i. ~(r *# cis (&i * pi/(&2)) = euclid0)` SUBGOAL_TAC;
26549 ASM_MESON_TAC[polar_nz;REAL_ARITH `&0 < r ==> ~( r= &0)`];
26552 TYPE_THEN `!i . euclid 2 (r *# cis (&i * pi/(&2)))` SUBGOAL_TAC;
26554 REWRITE_TAC[polar_euclid];
26559 IMATCH_MP_TAC mk_segment_simple_arc_end;
26562 ASM_SIMP_TAC[euclid_add_closure];
26566 TYPE_THEN `z =r *# cis(&i *pi/(&2))` ABBREV_TAC ;
26567 REWRITE_TAC[euclid0];
26568 IMATCH_MP_TAC EQ_EXT;
26570 USE 5 (REWRITE_RULE[FUN_EQ_THM ]);
26573 REWRITE_TAC[euclid_plus];
26578 IMATCH_MP_TAC mk_segment_endpoint;
26579 TYPE_THEN `2` EXISTS_TAC;
26582 TYPE_THEN `!i. d_euclid p (euclid_plus p (r *# cis (&i * pi / &2))) = d_euclid (r *# cis (&i * pi / &2)) euclid0` SUBGOAL_TAC;
26584 IMATCH_MP_TAC d_euclidpq;
26585 TYPE_THEN `2` EXISTS_TAC;
26586 ASM_REWRITE_TAC[polar_euclid];
26587 DISCH_THEN_REWRITE;
26588 REWRITE_TAC[GSYM norm2];
26589 REWRITE_TAC[norm2_scale_cis];
26591 IMATCH_MP_TAC cis_distinct;
26593 ASM_MESON_TAC[polar_euclid;euclid_add_closure];
26595 TYPE_THEN `!a q. (euclid 2 q) /\ (&0 <= a) /\ (a <= &1) ==> (d_euclid p (a*#p + (&1 - a)*#(p + q)) = (&1 - a)*(d_euclid p (p + q)))` SUBGOAL_TAC;
26597 IMATCH_MP_TAC d_euclid_mk_segment;
26598 TYPE_THEN `2` EXISTS_TAC;
26600 ASM_MESON_TAC[euclid_add_closure];
26603 TYPE_THEN `!a i. (&0 <= a) /\ (a <= &1) ==> (d_euclid p (a*#p + (&1 - a)*#(p + r *# (cis (&i * pi/(&2))))) = (&1 - a)*r)` SUBGOAL_TAC;
26605 TYPE_THEN `d_euclid p (p + r *# (cis (&i * pi/(&2)))) = norm2 ( r *# (cis (&i * pi/(&2))))` SUBGOAL_TAC;
26606 REWRITE_TAC[norm2];
26607 IMATCH_MP_TAC d_euclidpq;
26608 TYPE_THEN `2` EXISTS_TAC;
26609 ASM_REWRITE_TAC[polar_euclid];
26610 REWRITE_TAC[norm2_scale_cis];
26611 TYPE_THEN `abs r = r` SUBGOAL_TAC;
26614 DISCH_THEN_REWRITE;
26615 TYPEL_THEN [`2`;`a`;`p`;`p + (r *# cis (&i * pi / &2))`] (fun t-> ANT_TAC (ISPECL t d_euclid_mk_segment));
26617 ASM_SIMP_TAC[euclid_add_closure;polar_euclid];
26618 DISCH_THEN_REWRITE;
26619 DISCH_THEN_REWRITE;
26624 IMATCH_MP_TAC EQ_EXT;
26626 REWRITE_TAC[mk_segment;INTER;INR IN_SING];
26630 DISCH_THEN (fun t->(REWRITE_TAC[t]) THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
26631 TYPEL_THEN [`a`;`i`] (USE 5 o ISPECL);
26635 TYPE_THEN `&1 * r <= (&1 - a) * r` SUBGOAL_TAC;
26638 ASM_SIMP_TAC[REAL_LE_RMUL_EQ];
26640 TYPE_THEN `a = &0` SUBGOAL_TAC;
26644 DISCH_THEN (fun t->(REWRITE_TAC[t]) THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
26646 REWRITE_TAC[euclid_scale0;euclid_scale_one;euclid_lzero];
26647 DISCH_THEN_REWRITE;
26649 TYPE_THEN `&0` EXISTS_TAC;
26650 REWRITE_TAC [REAL_ARITH `&0 <= &0 /\ &0 <= &1`];
26652 REWRITE_TAC[euclid_scale0;euclid_scale_one;euclid_lzero];
26653 TYPE_THEN `d_euclid p (euclid_plus p (r *# cis (&i * pi / &2))) = d_euclid (r *# cis (&i * pi/(&2))) euclid0` SUBGOAL_TAC;
26654 IMATCH_MP_TAC d_euclidpq;
26655 TYPE_THEN `2` EXISTS_TAC;
26656 ASM_REWRITE_TAC[polar_euclid];
26657 DISCH_THEN_REWRITE;
26658 REWRITE_TAC[GSYM norm2;norm2_scale_cis];
26664 REWRITE_TAC[SUBSET];
26666 REWRITE_TAC[mk_segment;closed_ball];
26669 DISCH_THEN (fun t->(REWRITE_TAC[t]) THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
26670 TYPEL_THEN [`a`;`i`] (USE 5 o ISPECL);
26673 ASM_SIMP_TAC[euclid_add_closure;polar_euclid;euclid_scale_closure];
26674 ONCE_REWRITE_TAC[REAL_ARITH `x <= y <=> x <= &1*y`];
26675 IMATCH_MP_TAC REAL_PROP_LE_RMUL;
26681 IMATCH_MP_TAC mk_segment_hyperplane;
26683 (* Tue Aug 17 17:02:28 EDT 2004 *)
26688 let diff_pow1 = prove_by_refinement(
26689 `!t x. (( \ x. (t*x)) diffl t) x`,
26693 TYPE_THEN `(\ x. (t * x)) = (\x. (t * (\u. (u pow 1)) x))` SUBGOAL_TAC;
26694 IMATCH_MP_TAC EQ_EXT;
26697 REWRITE_TAC[POW_1];
26698 DISCH_THEN_REWRITE;
26699 TYPE_THEN `((\x. (t * (\u. (u pow 1)) x)) diffl (t* &1)) x ` SUBGOAL_TAC;
26700 IMATCH_MP_TAC DIFF_CMUL;
26701 TYPEL_THEN[`1`;`x`] (fun t-> ASSUME_TAC (ISPECL t DIFF_POW));
26703 REWRITE_TAC[ARITH_RULE `1-1 = 0`;pow];
26710 let pi_bounds = prove_by_refinement(
26711 `&3 < pi /\ pi < &22/ (&7)`,
26713 let tpi = recompute_pi 12 in
26714 let t3 = INTERVAL_OF_TERM 12 `&3` in
26715 let t227 = INTERVAL_OF_TERM 12 `&22/(&7)` in
26716 let th1 = INTERVAL_TO_LESS_CONV t3 tpi in
26717 let th2 = INTERVAL_TO_LESS_CONV tpi t227 in
26727 let sinx_le_x = prove_by_refinement(
26728 `!x. (&0 <=x) ==> (sin x <= x)`,
26732 TYPE_THEN `x = &0` ASM_CASES_TAC;
26734 REWRITE_TAC[SIN_0;];
26736 TYPE_THEN `&0 < x` SUBGOAL_TAC;
26740 POP_ASSUM_LIST (fun t-> ALL_TAC);
26743 TYPE_THEN `f = ( \ t x. t * x - sin(x))` ABBREV_TAC ;
26744 TYPE_THEN `!t. (&1 < t) ==> (!x. (&0 < x) ==> (&0 < f t x))` SUBGOAL_TAC;
26746 PROOF_BY_CONTR_TAC;
26748 TYPE_THEN `!x. (f t diffl (t - cos x)) x` SUBGOAL_TAC;
26751 IMATCH_MP_TAC DIFF_SUB;
26752 REWRITE_TAC[DIFF_SIN;diff_pow1;];
26754 TYPEL_THEN [`f t`;`&0`;`x'`] (fun t-> ANT_TAC (ISPECL t MVT));
26758 ASM_MESON_TAC[DIFF_CONT];
26759 REWRITE_TAC[differentiable];
26764 TYPE_THEN `f t (&0) = &0` SUBGOAL_TAC;
26766 REWRITE_TAC[SIN_0];
26768 DISCH_THEN_REWRITE;
26774 IMATCH_MP_TAC REAL_LT_MUL;
26777 TYPE_THEN `l = t - cos z` SUBGOAL_TAC;
26778 IMATCH_MP_TAC DIFF_UNIQ;
26780 DISCH_THEN_REWRITE;
26791 IMATCH_MP_TAC (REAL_ARITH `~(x < sin x) ==> (sin x <= x)`) ;
26793 TYPE_THEN `&1 < sin x/x` SUBGOAL_TAC;
26794 ASM_SIMP_TAC[REAL_LT_RDIV_EQ];
26798 TSPEC `(sin x)/x` 2;
26805 ASM_SIMP_TAC[REAL_DIV_RMUL;REAL_ARITH `&0 < x ==> ~(x = &0)`];
26807 (* Tue Aug 17 19:35:13 EDT 2004 *)
26812 let abssinx_lemma = prove_by_refinement(
26813 `!x. (&0 <= x) ==> ((abs (sin x)) <= abs x)`,
26818 TYPE_THEN `abs x = x` SUBGOAL_TAC;
26821 DISCH_THEN_REWRITE;
26822 TYPE_THEN `x <= pi` ASM_CASES_TAC;
26823 TYPE_THEN `&0 <= sin x` SUBGOAL_TAC;
26824 IMATCH_MP_TAC SIN_POS_PI_LE;
26827 TYPE_THEN `abs (sin x) = sin x` SUBGOAL_TAC;
26830 DISCH_THEN_REWRITE;
26831 ASM_MESON_TAC[sinx_le_x];
26832 IMATCH_MP_TAC REAL_LE_TRANS;
26833 TYPE_THEN `&1` EXISTS_TAC;
26835 ASSUME_TAC SIN_BOUNDS;
26840 TYPE_THEN `&3 < pi` SUBGOAL_TAC;
26841 REWRITE_TAC[pi_bounds];
26843 (* Tue Aug 17 22:54:49 EDT 2004 *)
26848 let abssinx_le = prove_by_refinement(
26849 `!x. abs (sin x) <= abs x`,
26853 TYPE_THEN `(&0 <= x) \/ (&0 <= -- x)` SUBGOAL_TAC;
26855 DISCH_THEN DISJ_CASES_TAC;
26856 ASM_MESON_TAC[abssinx_lemma];
26857 TYPE_THEN `y = --x` ABBREV_TAC ;
26858 TYPE_THEN `x = --y` SUBGOAL_TAC;
26861 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
26862 REWRITE_TAC[SIN_NEG;REAL_ABS_NEG];
26863 ASM_MESON_TAC[abssinx_lemma];
26864 (* Tue Aug 17 22:59:20 EDT 2004 *)
26869 let cos_double2 = prove_by_refinement(
26870 `!x. cos (&2 * x) = &1 - &2 * (sin x pow 2)`,
26874 REWRITE_TAC[COS_DOUBLE;GSYM SIN_CIRCLE ];
26879 let sin_half = prove_by_refinement(
26880 `!x. &2 * (sin (x/(&2)) pow 2) = &1 - cos (x)`,
26884 ASSUME_TAC cos_double2;
26886 TYPE_THEN `&2 *(x/(&2)) = x` SUBGOAL_TAC;
26887 REWRITE_TAC[REAL_MUL_2;];
26889 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
26895 let x_diff_y2 = prove_by_refinement(
26896 `!x y. (x - y) pow 2 = x*x - &2*x*y + y*y`,
26899 REWRITE_TAC[REAL_POW_2];
26904 let cosdiff2 = prove_by_refinement(
26905 `!x y. (cos x - cos y) pow 2 + (sin x - sin y) pow 2 =
26906 (&2 * sin ((x - y)/(&2))) pow 2`,
26910 REWRITE_TAC[POW_MUL];
26911 TYPE_THEN `!z. &2 pow 2 * z = &2 *(&2 *z)` SUBGOAL_TAC ;
26912 REWRITE_TAC[POW_2];
26914 DISCH_THEN_REWRITE;
26915 REWRITE_TAC[sin_half];
26917 TYPE_THEN `cos (x - y) = cos (x + (--y))` SUBGOAL_TAC;
26920 DISCH_THEN_REWRITE;
26921 REWRITE_TAC[COS_ADD ];
26922 REWRITE_TAC[SIN_NEG;COS_NEG;REAL_ARITH `x - u*(-- v) = x + u*v`];
26923 REWRITE_TAC[x_diff_y2];
26924 REWRITE_TAC[POW_2];
26925 TYPE_THEN `a = cos x` ABBREV_TAC ;
26926 TYPE_THEN `b = sin x` ABBREV_TAC ;
26927 TYPE_THEN `a' = cos y` ABBREV_TAC ;
26928 TYPE_THEN `b' = sin y` ABBREV_TAC ;
26929 REWRITE_TAC[REAL_ARITH `x*(y-z) = x*y - x*z`];
26930 TYPE_THEN `&2 * &1 = ((b pow 2) + (a pow 2)) + ((b' pow 2) + (a' pow 2))` SUBGOAL_TAC;
26935 REWRITE_TAC[SIN_CIRCLE];
26937 DISCH_THEN_REWRITE;
26938 REWRITE_TAC[POW_2];
26940 (* Tue Aug 17 23:38:27 EDT 2004 *)
26945 let d_euclid_cis = prove_by_refinement(
26946 `!x y. d_euclid (cis x) (cis y) = &2 * (abs (sin ((x-y)/(&2))))`,
26950 REWRITE_TAC[cis;d_euclid_point;cosdiff2;POW_2_SQRT_ABS;ABS_MUL;];
26951 REWRITE_TAC[REAL_ARITH `abs (&2) = &2`];
26952 (* Tue Aug 17 23:41:30 EDT 2004 *)
26956 let d_euclid_cis_ineq = prove_by_refinement(
26957 `!x y. d_euclid (cis x) (cis y) <= abs (x - y)`,
26960 REWRITE_TAC[d_euclid_cis];
26962 IMATCH_MP_TAC REAL_LE_TRANS;
26963 TYPE_THEN `&2 * (abs ((x-y)/(&2)))` EXISTS_TAC;
26965 IMATCH_MP_TAC REAL_PROP_LE_LMUL;
26966 ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`;abssinx_le];
26967 REWRITE_TAC[REAL_ARITH `!z. &2*(abs z) = abs (&2 *z)`];
26968 TYPE_THEN `&2 * ((x - y)/(&2)) = (x - y)` SUBGOAL_TAC;
26969 IMATCH_MP_TAC REAL_DIV_LMUL;
26971 DISCH_THEN_REWRITE;
26973 (* Wed Aug 18 06:42:28 EDT 2004 *)
26978 let polar_fg_inj = prove_by_refinement(
26979 `!f g p. (INJ f {x | &0 <= x /\ x <= &1} UNIV) /\
26980 (!x. (&0 <= x /\ x <= &1) ==> (&0 <= f x)) /\ (euclid 2 p) ==>
26981 INJ (\t. p + (f t)*# (cis (g t))) {x | &0 <= x /\ x <= &1} (euclid 2)`,
26985 REWRITE_TAC[INJ;polar_euclid];
26986 ASM_SIMP_TAC[euclid_add_closure;polar_euclid];
26989 TYPE_THEN `(f x *# cis (g x)) = (f y *# cis (g y))` SUBGOAL_TAC;
26990 IMATCH_MP_TAC EQ_EXT;
26992 USE 3 (REWRITE_RULE[FUN_EQ_THM]);
26994 USE 3(REWRITE_RULE[euclid_plus]);
27000 USE 3 (AP_TERM `norm2`);
27001 USE 3 (REWRITE_RULE[norm2_scale_cis]);
27002 TYPE_THEN `&0 <= f x /\ &0 <= f y` SUBGOAL_TAC;
27005 RULE_ASSUM_TAC (REWRITE_RULE[GSYM REAL_ABS_REFL]);
27007 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
27008 FIRST_ASSUM IMATCH_MP_TAC ;
27014 let polar_distinct = prove_by_refinement(
27015 `!f g g'. (INJ f {x | &0 <= x /\ x <= &1} UNIV) /\
27016 (!x. (&0 <= x /\ x <= &1) ==> (&0 < f x)) /\
27017 (!x. (&0 <= x /\ x <= &1) ==> (&0 <= g x /\ g x < &2 * pi)) /\
27018 (!x. (&0 <= x /\ x <= &1) ==> (&0 <= g' x /\ g' x < &2 * pi))
27020 (!x y. (&0 <= x /\ x <= &1 /\ &0 <= y /\ y <= &1 /\
27021 ((f x)*# (cis (g x)) = (f y)*# (cis (g' y)))) ==>
27022 (x = y) /\ (g x = g' y)) `,
27027 USE 0 (AP_TERM `norm2`);
27028 USE 0 (REWRITE_RULE[norm2_scale_cis]);
27029 TYPE_THEN `&0 < f x /\ &0 < f y` SUBGOAL_TAC;
27032 TYPE_THEN `f x = f y` SUBGOAL_TAC;
27040 RULE_ASSUM_TAC (REWRITE_RULE [INJ]);
27042 FIRST_ASSUM IMATCH_MP_TAC ;
27044 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
27045 TYPEL_THEN [`g y`;`g' y`;`f y`;`f y`] (fun t-> ANT_TAC (ISPECL t polar_inj));
27047 ASM_MESON_TAC[REAL_ARITH `&0 < t ==> &0 <= t`];
27048 DISCH_THEN DISJ_CASES_TAC;
27049 PROOF_BY_CONTR_TAC;
27055 (* Wed Aug 18 07:42:54 EDT 2004 *)
27060 let d_euclid_eq_arg = prove_by_refinement(
27061 `!r r' x. (d_euclid (r *# (cis x)) (r' *# (cis x)) = abs (r - r'))`,
27065 REWRITE_TAC[cis;point_scale;d_euclid_point];
27066 REWRITE_TAC[GSYM REAL_SUB_RDISTRIB;POW_MUL;GSYM REAL_ADD_LDISTRIB];
27067 ONCE_REWRITE_TAC [REAL_ARITH `x + y = y + x`];
27068 REWRITE_TAC[SIN_CIRCLE];
27070 REWRITE_TAC[POW_2_SQRT_ABS];
27071 (* Wed Aug 18 08:15:39 EDT 2004 *)
27076 let one_over_plus1 = prove_by_refinement(
27077 `!t. (&0 <= t) ==> (t / (&1 + t) <= &1)`,
27081 IMATCH_MP_TAC REAL_LE_LDIV;
27084 (* Wed Aug 18 08:17:46 EDT 2004 *)
27089 let polar_cont = prove_by_refinement(
27090 `!p f g. continuous f (top_of_metric(UNIV,d_real))
27091 (top_of_metric(UNIV,d_real)) /\
27092 continuous g (top_of_metric(UNIV,d_real))
27093 (top_of_metric(UNIV,d_real)) /\ (euclid 2 p) ==>
27094 continuous (\t. p + (f t) *# cis(g t)) (top_of_metric(UNIV,d_real))
27100 TYPE_THEN `IMAGE (\t. p + (f t) *# cis(g t)) UNIV SUBSET (euclid 2)` SUBGOAL_TAC;
27101 REWRITE_TAC[SUBSET;IMAGE ];
27102 ASM_MESON_TAC[euclid_add_closure;polar_euclid];
27105 ASM_SIMP_TAC[SUBSET_UNIV;metric_continuous_continuous;metric_euclid;metric_real];
27106 REWRITE_TAC[metric_continuous;metric_continuous_pt];
27110 TYPEL_THEN [`x`;`epsilon/(&2)`] (USE 3 o ISPECL);
27111 TYPEL_THEN [`x`;`(&1/(&1 + abs (f x)))*(epsilon/(&2))`] (USE 2 o ISPECL);
27113 TYPE_THEN `&0 < epsilon/(&2)` SUBGOAL_TAC;
27114 ASM_REWRITE_TAC[REAL_LT_HALF1];
27116 TYPE_THEN `&0 < &1 / (&1 + abs (f x)) * epsilon / &2` SUBGOAL_TAC;
27117 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
27119 IMATCH_MP_TAC REAL_LT_DIV;
27125 TYPE_THEN `min_real delta delta'` EXISTS_TAC;
27127 REWRITE_TAC[min_real];
27134 TYPE_THEN `d_real x y < delta /\ d_real x y < delta'` SUBGOAL_TAC ;
27136 REWRITE_TAC[min_real];
27148 IMATCH_MP_TAC REAL_LET_TRANS;
27149 TYPE_THEN `d_euclid (p + f x *# cis(g x)) (p + f x *# cis(g y)) + d_euclid (p + f x *# cis(g y)) (p + f y *# cis(g y))` EXISTS_TAC;
27150 TYPE_THEN `!z r x r' x'. d_euclid (p + r *# (cis x)) (p + r' *# (cis x')) = d_euclid (r*# (cis x)) (r' *# (cis x'))` SUBGOAL_TAC;
27152 IMATCH_MP_TAC metric_translate_LEFT;
27153 TYPE_THEN `2` EXISTS_TAC;
27154 ASM_REWRITE_TAC[polar_euclid];
27155 DISCH_THEN_REWRITE;
27156 (* end of add-on *)
27158 IMATCH_MP_TAC metric_space_triangle;
27159 TYPE_THEN `euclid 2` EXISTS_TAC;
27160 ASM_SIMP_TAC[polar_euclid;metric_euclid];
27161 REWRITE_TAC[d_euclid_eq_arg];
27162 TYPEL_THEN[`2`;`f x`;`cis (g x)`;`cis (g y)`] (fun t-> ANT_TAC (ISPECL t norm_scale_vec));
27163 REWRITE_TAC[cis;euclid_point];
27164 DISCH_THEN_REWRITE;
27165 TYPE_THEN `!x y z. (x <= z/ &2 /\ y < z/ &2 ==> x + y < z/ &2 + z/ &2)` SUBGOAL_TAC;
27167 REWRITE_TAC[REAL_HALF_DOUBLE];
27168 DISCH_THEN IMATCH_MP_TAC ;
27169 USE 2 (REWRITE_RULE[d_real]);
27171 IMATCH_MP_TAC REAL_LE_TRANS;
27172 TYPE_THEN `abs (f x) * (&1 / (&1 + abs (f x)) * epsilon / &2)` EXISTS_TAC;
27175 IMATCH_MP_TAC REAL_PROP_LE_LMUL;
27176 REWRITE_TAC[REAL_MK_NN_ABS];
27177 IMATCH_MP_TAC (REAL_ARITH `!y. (x <= y /\ y < z) ==> (x <= z)`);
27178 TYPE_THEN `abs (g x - g y)` EXISTS_TAC;
27180 REWRITE_TAC[d_euclid_cis_ineq];
27181 USE 7 (REWRITE_RULE[d_real]);
27183 REWRITE_TAC[REAL_ARITH `(x*y*z <= z) <=> ((x*y)*(z) <= &1 * (z))`];
27184 IMATCH_MP_TAC REAL_PROP_LE_RMUL;
27186 REWRITE_TAC[real_div];
27188 REWRITE_TAC[GSYM real_div];
27189 IMATCH_MP_TAC REAL_LE_LDIV;
27197 let lc_bounds = prove_by_refinement(
27198 `!a b x. (&0 <= x /\ x <= &1) ==> (min_real a b <= x*a + (&1- x)*b) /\
27199 (x*a + (&1 - x)*b <= max_real a b)`,
27204 REWRITE_TAC[min_real];
27206 ineq_le_tac `a + (&1 - x)*(b - a) = (x*a + (&1- x)*b)`;
27207 ineq_le_tac `b + x*(a - b) = x*a + (&1- x)*b`;
27208 REWRITE_TAC[max_real];
27210 ineq_le_tac `(x*a + (&1 - x)*b) + (&1 - x)*(a - b) = a`;
27211 ineq_le_tac `(x*a + (&1 - x)*b) + (x*(b - a)) = b`;
27212 (* Wed Aug 18 11:52:54 EDT 2004 *)
27217 let min_real_symm = prove_by_refinement(
27218 `!a b. min_real a b = min_real b a`,
27222 REWRITE_TAC[min_real];
27224 USE 0 (MATCH_MP (REAL_ARITH `a < b ==> ~(b < a)`));
27234 let max_real_symm = prove_by_refinement(
27235 `!a b. max_real a b = max_real b a`,
27239 REWRITE_TAC[max_real];
27241 USE 0 (MATCH_MP (REAL_ARITH `a < b ==> ~(b < a)`));
27251 let curve_annulus_lemma = prove_by_refinement(
27252 `!r g p. (&0 < r) /\ (euclid 2 p) ==>
27253 (IMAGE (\t. p + (t*r + (&1 - t)*(r/(&2)))*# (cis (g t)))
27254 {x | &0 <= x /\ x <= &1})
27255 SUBSET ({ x | (r/(&2) <= d_euclid p x /\
27256 d_euclid p x <= r)} )`,
27261 REWRITE_TAC[IMAGE;SUBSET];
27264 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
27265 TYPE_THEN `d_euclid p (euclid_plus p ((x' * r + (&1 - x') * r / &2) *# cis (g x'))) = d_euclid ((x' * r + (&1 - x') * r / &2) *# cis (g x')) euclid0` SUBGOAL_TAC;
27266 IMATCH_MP_TAC d_euclidpq;
27267 TYPE_THEN `2` EXISTS_TAC;
27268 ASM_REWRITE_TAC[polar_euclid];
27269 DISCH_THEN_REWRITE;
27270 REWRITE_TAC[GSYM norm2;norm2_scale_cis];
27271 TYPE_THEN `r/(&2) < r` SUBGOAL_TAC;
27272 ASM_MESON_TAC[half_pos];
27274 TYPE_THEN `(min_real (r/(&2)) r = (r/(&2))) /\ (max_real (r/(&2)) r = r)` SUBGOAL_TAC;
27275 REWRITE_TAC[min_real;max_real];
27283 TYPE_THEN `&0 <= (x' *r + (&1 - x')*(r/(&2)))` SUBGOAL_TAC;
27284 IMATCH_MP_TAC REAL_LE_TRANS;
27285 TYPE_THEN `min_real (r/ &2) r` EXISTS_TAC ;
27288 IMATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`);
27289 ASM_REWRITE_TAC[REAL_LT_HALF1];
27290 ONCE_REWRITE_TAC [min_real_symm];
27291 ASM_MESON_TAC[lc_bounds];
27292 REWRITE_TAC[GSYM ABS_REFL];
27293 DISCH_THEN_REWRITE;
27294 ASM_MESON_TAC[lc_bounds;min_real_symm;max_real_symm];
27295 (* Wed Aug 18 12:13:50 EDT 2004 *)
27301 let curve_circle_lemma = prove_by_refinement(
27302 `!r g p. (&0 < r) /\ (euclid 2 p) ==>
27303 (((IMAGE (\t. p + (t*r + (&1 - t)*(r/(&2)))*# (cis (g t)))
27304 {x | &0 <= x /\ x <= &1})
27305 INTER ({ x | d_euclid p x <= (r/(&2))})) =
27306 { ( p + (r/(&2)) *# (cis (g (&0) ))) })
27311 REWRITE_TAC[IMAGE;SUBSET;INTER;];
27312 IMATCH_MP_TAC EQ_EXT;
27313 REWRITE_TAC[INR IN_SING];
27314 ONCE_REWRITE_TAC [EQ_SYM_EQ];
27318 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
27321 TYPE_THEN `&0` EXISTS_TAC;
27323 TYPEL_THEN [`2`;`p`;`(r / &2 *# cis (g (&0)))`] (fun t-> ANT_TAC (ISPECL t d_euclidpq));
27324 ASM_REWRITE_TAC[polar_euclid];
27325 DISCH_THEN_REWRITE;
27326 REWRITE_TAC[GSYM norm2;norm2_scale_cis;];
27327 IMATCH_MP_TAC (REAL_ARITH `(x = y) ==> (x <= y)`);
27328 REWRITE_TAC[ABS_REFL];
27329 IMATCH_MP_TAC (REAL_ARITH `(&0 < x) ==> (&0 <= x)`);
27330 ASM_REWRITE_TAC[REAL_LT_HALF1];
27332 (* B other direction *)
27334 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
27335 PROOF_BY_CONTR_TAC;
27337 TYPE_THEN `d_euclid p (euclid_plus p ((x' * r + (&1 - x') * r / &2) *# cis (g x'))) = d_euclid ((x' * r + (&1 - x') * r / &2) *# cis (g x')) euclid0` SUBGOAL_TAC;
27338 IMATCH_MP_TAC d_euclidpq;
27339 TYPE_THEN `2` EXISTS_TAC;
27340 ASM_REWRITE_TAC[polar_euclid];
27341 DISCH_THEN_REWRITE;
27342 REWRITE_TAC[GSYM norm2;norm2_scale_cis];
27343 TYPE_THEN `r/(&2) < r` SUBGOAL_TAC;
27344 ASM_MESON_TAC[half_pos];
27346 TYPE_THEN `(min_real (r/(&2)) r = (r/(&2))) /\ (max_real (r/(&2)) r = r)` SUBGOAL_TAC;
27347 REWRITE_TAC[min_real;max_real];
27355 TYPE_THEN `&0 <= (x' *r + (&1 - x')*(r/(&2)))` SUBGOAL_TAC;
27356 IMATCH_MP_TAC REAL_LE_TRANS;
27357 TYPE_THEN `min_real (r/ &2) r` EXISTS_TAC ;
27360 IMATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`);
27361 ASM_REWRITE_TAC[REAL_LT_HALF1];
27362 ONCE_REWRITE_TAC [min_real_symm];
27363 ASM_MESON_TAC[lc_bounds];
27364 REWRITE_TAC[GSYM ABS_REFL];
27365 DISCH_THEN_REWRITE;
27366 TYPE_THEN `~(x' = &0)` SUBGOAL_TAC;
27369 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
27373 TYPE_THEN `&0 < x'` SUBGOAL_TAC;
27378 IMATCH_MP_TAC (REAL_ARITH `a < b ==> ~(b <= a)`);
27379 ineq_lt_tac `(r/ &2) + x'* (r - (r/(&2))) = (x' * r + (&1 - x') * r / &2)`;
27380 (* Wed Aug 18 12:41:16 EDT 2004 *)
27385 let curve_simple_lemma = prove_by_refinement(
27386 `!r g p. (&0 < r) /\ (euclid 2 p) /\
27387 (continuous g (top_of_metric(UNIV,d_real))
27388 (top_of_metric(UNIV,d_real))) ==>
27390 (IMAGE (\t. p + (t*r + (&1 - t)*(r/(&2)))*# (cis (g t)))
27391 {x | &0 <= x /\ x <= &1}) (p + (r/(&2))*# (cis (g (&0))))
27392 (p + (r)*# (cis (g (&1)))))`,
27395 REWRITE_TAC[simple_arc_end];
27397 TYPE_THEN `(\t. p + (t*r + (&1 - t)*(r/(&2)))*# (cis (g t)))` EXISTS_TAC;
27401 IMATCH_MP_TAC polar_cont;
27403 ASM_SIMP_TAC[metric_continuous_continuous;metric_real;SUBSET_UNIV];
27404 REWRITE_TAC[linear_cont];
27405 IMATCH_MP_TAC polar_fg_inj;
27406 ASM_REWRITE_TAC[INJ;SUBSET_UNIV ];
27410 USE 3 (ONCE_REWRITE_RULE[REAL_ARITH `( x = y) <=> (x - y = &0)`]);
27411 TYPE_THEN `(x * r + (&1 - x) * r / &2) - (y * r + (&1 - y) * r / &2) = (x - y)*(r - r/(&2)) ` SUBGOAL_TAC;
27415 USE 3(REWRITE_RULE[REAL_ENTIRE]);
27417 DISCH_THEN DISJ_CASES_TAC;
27420 PROOF_BY_CONTR_TAC;
27422 TYPE_THEN `r - r/(&2) = (r/ &2 + r/ &2) - r/ &2` SUBGOAL_TAC;
27423 REWRITE_TAC[REAL_HALF_DOUBLE];
27424 DISCH_THEN_REWRITE;
27425 REWRITE_TAC[REAL_ARITH `(x + x) - x = x`];
27426 USE 2 (ONCE_REWRITE_RULE [GSYM REAL_HALF_DOUBLE]);
27427 USE 2 (REWRITE_RULE[REAL_DIV_LZERO]);
27433 WITH 3 (MATCH_MP lc_bounds);
27434 TYPEL_THEN [`r`;`r/ &2`] (USE 4 o ISPECL);
27435 IMATCH_MP_TAC REAL_LE_TRANS;
27436 TYPE_THEN `min_real r (r/ &2)` EXISTS_TAC;
27438 TYPE_THEN `r / &2 < r` SUBGOAL_TAC;
27440 MESON_TAC [half_pos];
27441 TYPE_THEN `&0 < r/ (&2)` SUBGOAL_TAC;
27442 ASM_MESON_TAC[half_pos];
27443 TYPE_THEN `a = r/ &2` ABBREV_TAC ;
27444 REWRITE_TAC[min_real];
27448 (* Wed Aug 18 14:02:54 EDT 2004 *)
27453 let segpath = jordan_def
27454 `segpath x y t = t* x + (&1 - t)*y` ;;
27456 let segpathxy = prove_by_refinement(
27457 `!x y. segpath x y = (\ t. t*x + (&1 - t)*y)`,
27461 IMATCH_MP_TAC EQ_EXT;
27462 REWRITE_TAC[segpath];
27466 let segpath_lemma = prove_by_refinement(
27467 `(!x y . (continuous (segpath x y) (top_of_metric(UNIV,d_real))
27468 (top_of_metric(UNIV,d_real)))) /\
27469 (!x y b. (&0 <= x /\ x < b /\ &0 <= y /\ y < b ==>
27470 (!t. &0 <= t /\ t <= &1 ==> &0 <= segpath x y t /\
27471 segpath x y t < b))) /\
27472 (!x y x' y' t. (x < x' /\ y < y' /\ &0 <= t /\ t <= &1)
27473 ==> ~(segpath x y t = segpath x' y' t))`,
27480 ASM_SIMP_TAC[SUBSET_UNIV;metric_continuous_continuous;metric_real];
27481 REWRITE_TAC[segpathxy;linear_cont];
27485 REWRITE_TAC[segpath];
27487 IMATCH_MP_TAC REAL_LE_TRANS;
27488 TYPE_THEN `min_real x y` EXISTS_TAC;
27490 REWRITE_TAC[min_real];
27494 ASM_MESON_TAC[lc_bounds];
27495 IMATCH_MP_TAC REAL_LET_TRANS;
27496 TYPE_THEN `max_real x y` EXISTS_TAC;
27498 ASM_MESON_TAC[lc_bounds];
27499 REWRITE_TAC[max_real];
27504 REWRITE_TAC[segpath];
27507 REWRITE_TAC[REAL_ARITH `(u + v = u' + v') <=> ((u' - u) + (v' - v) = &0)`];
27508 REWRITE_TAC[GSYM REAL_SUB_LDISTRIB];
27509 TYPE_THEN `t = &0` ASM_CASES_TAC;
27514 TYPE_THEN `t = &1` ASM_CASES_TAC;
27520 TYPE_THEN `&0 < t * (x' - x) + (&1 - t)*(y' - y)` SUBGOAL_TAC;
27521 ineq_lt_tac `&0 + t * (x' - x) + (&1 - t)*(y' - y) = (t*(x' - x) + (&1- t)*(y' - y))` ;
27526 (* Wed Aug 18 14:48:37 EDT 2004 *)
27532 let segpath_end = prove_by_refinement(
27533 `!x y. ( segpath x y (&0) = y) /\ (segpath x y (&1) = x)`,
27536 REWRITE_TAC[segpath];
27541 let segpath_inj = prove_by_refinement(
27542 `!x y. ~(x = y) ==> INJ (segpath x y) {t | &0 <= t /\ t <= &1} UNIV`,
27546 REWRITE_TAC[segpath;INJ;SUBSET_UNIV];
27548 USE 0 (ONCE_REWRITE_RULE[REAL_ARITH `( x = y) <=> (x - y = &0)`]);
27549 TYPE_THEN `(x' * x + (&1 - x') * y) - (y' * x + (&1 - y') * y) = (x' - y')*(x - y) ` SUBGOAL_TAC;
27553 USE 0(REWRITE_RULE[REAL_ENTIRE]);
27555 DISCH_THEN DISJ_CASES_TAC;
27558 PROOF_BY_CONTR_TAC;
27562 (* Wed Aug 18 15:15:11 EDT 2004 *)
27568 let degree_vertex_annulus = prove_by_refinement(
27569 `!n r p xx zz. (&0 < r) /\ (euclid 2 p) /\
27570 (!j. j < n ==> (&0 <= xx j /\ xx j < &2 * pi)) /\
27571 (!j. j < n ==> (&0 <= zz j /\ zz j < &2 * pi)) /\
27572 (!i j. (i < j) /\ (j <| n) ==> (xx i < xx j)) /\
27573 (!i j. (i < j) /\ (j < n) ==> (zz i < zz j)) ==>
27576 simple_arc_end (C i ) (p + (r/ &2)*# (cis(zz i)))
27577 (p + r*# (cis(xx i)))) /\
27578 (!i j. (i < n) /\ (j < n) /\ (~(i=j)) ==>
27579 (C i INTER C j = EMPTY )) /\
27581 C i SUBSET ({ x | (r/(&2) <= d_euclid p x /\
27582 d_euclid p x <= r)} )) /\
27584 (C i INTER ({ x | d_euclid p x <= (r/(&2))}) =
27585 { ( p + (r/(&2)) *# (cis (zz i ))) }))
27591 TYPE_THEN `C = ( \ i. IMAGE ( \ t. p + (t*r + (&1 - t)*(r/(&2)))*# (cis (segpath (xx i) (zz i) t))) {t | &0 <= t /\ t <= &1})` ABBREV_TAC ;
27592 TYPE_THEN `C` EXISTS_TAC;
27597 TYPEL_THEN [`r`;`segpath (xx i) (zz i)`;`p`] (fun t-> (ANT_TAC(ISPECL t curve_simple_lemma)));
27598 ASM_REWRITE_TAC[segpath_lemma];
27599 REWRITE_TAC[segpath_end];
27601 TYPE_THEN `&0 < r/ &2 /\ r / &2 < r` SUBGOAL_TAC;
27602 IMATCH_MP_TAC half_pos;
27607 TYPEL_THEN [`( \ t. t * r + (&1 - t) * r / &2)`;`segpath (xx i) (zz i)`;`segpath (xx j) (zz j)`] (fun t-> ANT_TAC (ISPECL t polar_distinct));
27611 TYPEL_THEN [`r`;`r / &2`] (fun t-> ANT_TAC(ISPECL t segpath_inj));
27614 REWRITE_TAC[segpathxy];
27618 ineq_lt_tac `&0 + (x* (r - r/(&2))) + (r/ &2) = x*r + (&1 - x)*(r/ &2)`;
27620 ASM_MESON_TAC[segpath_lemma];
27624 REWRITE_TAC[EQ_EMPTY];
27626 REWRITE_TAC[IMAGE;INTER];
27629 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]) THEN (REWRITE_TAC [t]));
27630 TYPEL_THEN[`x'`;`x''`] (USE 12 o ISPECL);
27632 TYPE_THEN `((x'' * r + (&1 - x'') * r / &2) *# cis (segpath (xx j) (zz j) x'')) = ((x' * r + (&1 - x') * r / &2) *# cis (segpath (xx i) (zz i) x'))` SUBGOAL_TAC;
27633 IMATCH_MP_TAC EQ_EXT;
27635 USE 16 ( (REWRITE_RULE[FUN_EQ_THM]));
27638 REWRITE_TAC[euclid_plus];
27642 USE 13 (ONCE_REWRITE_RULE [EQ_SYM_EQ]);
27647 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]) THEN (REWRITE_TAC [t]));
27648 TYPE_THEN `(i <| j) \/ (j < i)` SUBGOAL_TAC;
27652 DISCH_THEN DISJ_CASES_TAC;
27653 TYPEL_THEN [`i`;`j`] (USE 0 o ISPECL);
27654 TYPEL_THEN [`i`;`j`] (USE 1 o ISPECL);
27659 ASM_MESON_TAC[CONJUNCT2 (CONJUNCT2 segpath_lemma)];
27660 TYPEL_THEN [`j`;`i`] (USE 0 o ISPECL);
27661 TYPEL_THEN [`j`;`i`] (USE 1 o ISPECL);
27666 ASM_MESON_TAC[CONJUNCT2 (CONJUNCT2 segpath_lemma)];
27671 IMATCH_MP_TAC curve_annulus_lemma;
27676 TYPEL_THEN[`r`;`segpath (xx i) (zz i)`;`p`] (fun t-> ANT_TAC(ISPECL t curve_circle_lemma));
27678 REWRITE_TAC[segpath_end];
27679 (* Wed Aug 18 15:57:53 EDT 2004 *)
27683 let closed_ball2_center = prove_by_refinement(
27684 `!p r. closed_ball (euclid 2,d_euclid) p r p <=> (euclid 2 p) /\ (&0 <= r)`,
27687 REWRITE_TAC[closed_ball];
27688 TYPE_THEN `!p. (euclid 2 p) ==> (d_euclid p p = &0)` SUBGOAL_TAC;
27690 IMATCH_MP_TAC metric_space_zero;
27691 TYPE_THEN `euclid 2` EXISTS_TAC;
27692 ASM_REWRITE_TAC[metric_euclid];
27697 let degree_vertex_disk = prove_by_refinement(
27698 `!r p xx . (&0 < r) /\ (euclid 2 p) /\
27699 (!j. j < 4 ==> (&0 <= xx j /\ xx j < &2 * pi)) /\
27700 (!i j. (i < j) /\ (j < 4) ==> (xx i < xx j))
27703 (!i. (i< 4) ==> (?C' C'' v.
27704 simple_arc_end C' p v /\
27705 simple_arc_end C'' v (p + r*# (cis(xx i ))) /\
27706 C' SUBSET closed_ball(euclid 2,d_euclid) p (r/ &2) /\
27707 (C' INTER C'' = {v}) /\
27708 (C' UNION C'' = C i )) /\
27709 simple_arc_end (C i ) p (p + r*# (cis(xx i))) /\
27710 C i SUBSET (closed_ball(euclid 2,d_euclid) p r) /\
27711 C i INTER (closed_ball(euclid 2,d_euclid) p (r / &2))
27712 SUBSET (hyperplane 2 e2 (p 1) UNION
27713 hyperplane 2 e1 (p 0))) /\
27714 (!i j. (i < 4) /\ (j < 4) /\ (~(i=j)) ==>
27715 (C i INTER C j = {p} )))
27720 TYPE_THEN `(&0 < (r /(&2))) /\ (euclid 2 p)` SUBGOAL_TAC;
27721 ASM_REWRITE_TAC[REAL_LT_HALF1];
27722 DISCH_THEN (fun t-> MP_TAC (MATCH_MP degree4_vertex_hv t));
27724 TYPE_THEN `C' = C` ABBREV_TAC ;
27726 TYPE_THEN `zz = (\j. (&j) * pi/(&2))` ABBREV_TAC ;
27727 TYPE_THEN `(&0 < r) /\ (euclid 2 p) /\ (!j. j < 4 ==> (&0 <= xx j /\ xx j < &2 * pi)) /\ (!j. j < 4 ==> (&0 <= zz j /\ zz j < &2 * pi)) /\ (!i j. (i < j) /\ (j < 4) ==> (xx i < xx j)) /\ (!i j. (i < j) /\ (j < 4) ==> (zz i < zz j))` SUBGOAL_TAC;
27733 IMATCH_MP_TAC REAL_LE_MUL;
27736 IMATCH_MP_TAC REAL_LE_DIV;
27739 REWRITE_TAC[real_div;REAL_ARITH `pi*x = x*pi`];
27740 REWRITE_TAC[REAL_ARITH `x*y*z = (x*y)*z`];
27741 IMATCH_MP_TAC REAL_PROP_LT_RMUL;
27742 ASM_REWRITE_TAC[PI_POS;GSYM real_div;];
27743 ASM_SIMP_TAC[REAL_LT_LDIV_EQ;REAL_ARITH `&0 < &2`];
27749 ONCE_REWRITE_TAC [REAL_ARITH `x < y <=> (&0 < y - x)`];
27750 REWRITE_TAC[REAL_ARITH `x*y - z*y = (x - z)*y`];
27751 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
27752 REWRITE_TAC[PI2_BOUNDS];
27755 REWRITE_TAC[REAL_ARITH `&0 < &j - &i <=> &i < &j`];
27757 DISCH_THEN (fun t-> MP_TAC (MATCH_MP degree_vertex_annulus t));
27760 TYPE_THEN `(\j. C' j UNION C'' j)` EXISTS_TAC;
27762 (* B 1st conjunct *)
27763 TYPE_THEN `!i. (i<| 4) ==> (simple_arc_end (C' i ) p (p + ((r/ &2) *# (cis (&i * pi/(&2))))) /\ simple_arc_end (C'' i) (p + ((r/ &2) *# (cis (&i * pi/(&2))))) (euclid_plus p (r *# cis (xx i))) /\ (C' i) SUBSET closed_ball (euclid 2,d_euclid) p (r / &2) /\ ((C' i) INTER (C'' i) = {(p + ((r/ &2) *# (cis (&i * pi/(&2)))))})) ` SUBGOAL_TAC;
27775 IMATCH_MP_TAC EQ_EXT;
27777 REWRITE_TAC[INR IN_SING;INTER ];
27780 TYPE_THEN `closed_ball (euclid 2,d_euclid) p (r / &2) x` SUBGOAL_TAC;
27782 REWRITE_TAC[SUBSET];
27787 REWRITE_TAC[closed_ball];
27788 FIRST_ASSUM (fun t-> MP_TAC (AP_THM t `x:num->real`));
27790 REWRITE_TAC[INTER;INR IN_SING;];
27791 DISCH_THEN_REWRITE;
27792 DISCH_THEN_REWRITE;
27794 DISCH_THEN_REWRITE;
27795 DISCH_THEN_REWRITE;
27798 MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
27801 (* [C] 1nd conjunct. simple-arc-end; *)
27802 TYPE_THEN `D = closed_ball (euclid 2,d_euclid) p (r /(&2))` ABBREV_TAC ;
27803 TYPE_THEN `!i x. (i <| 4) /\ (D x) ==> ((C' i UNION C'' i) x = C' i x)` SUBGOAL_TAC;
27805 REWRITE_TAC[UNION];
27806 IMATCH_MP_TAC (TAUT `(b ==> a) ==> (a \/ b <=> a)`);
27809 FIRST_ASSUM (fun t-> MP_TAC (AP_THM t `x:num->real`));
27812 REWRITE_TAC[closed_ball];
27813 REWRITE_TAC[INTER;INR IN_SING];
27814 DISCH_THEN_REWRITE;
27815 DISCH_THEN_REWRITE;
27816 DISCH_THEN_REWRITE;
27817 ASM_MESON_TAC[simple_arc_end_end2];
27820 TYPE_THEN `!i x. (i <| 4) /\ ~(D x) ==> ((C' i UNION C'' i) x = C'' i x)` SUBGOAL_TAC;
27822 REWRITE_TAC[UNION];
27823 IMATCH_MP_TAC (TAUT `(a ==> b) ==> (a \/ b <=> b)`);
27826 USE 5 (REWRITE_RULE[SUBSET]);
27832 ONCE_REWRITE_TAC [TAUT `(x /\ y) <=> (y /\ x)`];
27836 IMATCH_MP_TAC EQ_EXT;
27838 REWRITE_TAC[INTER;INR IN_SING];
27839 TYPE_THEN `D x` ASM_CASES_TAC;
27840 TYPEL_THEN [`i`;`x`] (WITH 17 o ISPECL);
27841 TYPEL_THEN [`j`;`x`] (WITH 17 o ISPECL);
27846 DISCH_THEN_REWRITE;
27847 DISCH_THEN_REWRITE;
27848 TYPEL_THEN [`i`;`j`;] (USE 7 o ISPECL);
27850 FIRST_ASSUM (fun t-> MP_TAC (AP_THM t `x:num->real`));
27851 REWRITE_TAC[INTER;INR IN_SING];
27853 TYPEL_THEN [`i`;`x`] (WITH 18 o ISPECL);
27854 TYPEL_THEN [`j`;`x`] (WITH 18 o ISPECL);
27859 DISCH_THEN_REWRITE;
27860 DISCH_THEN_REWRITE;
27861 TYPEL_THEN [`i`;`j`;] (USE 13 o ISPECL);
27863 USE 13 (REWRITE_RULE[EQ_EMPTY;INTER ]);
27865 PROOF_BY_CONTR_TAC;
27866 USE 18(REWRITE_RULE[]);
27868 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[t]));
27872 REWRITE_TAC[closed_ball2_center];
27874 IMATCH_MP_TAC (REAL_ARITH `&0 <x ==> &0 <= x`);
27875 ASM_REWRITE_TAC[REAL_LT_HALF1];
27879 TYPE_THEN `C' i` EXISTS_TAC;
27880 TYPE_THEN `C'' i` EXISTS_TAC;
27881 TYPE_THEN `p + (r / &2 *# cis (&i * pi / &2))` EXISTS_TAC;
27885 IMATCH_MP_TAC simple_arc_end_trans;
27889 REWRITE_TAC[union_subset];
27895 REWRITE_TAC[SUBSET;closed_ball;];
27896 TYPE_THEN `r / &2 < r` SUBGOAL_TAC;
27898 MESON_TAC[half_pos];
27899 MESON_TAC[REAL_ARITH `(x <= y) /\ (y < z) ==> (x <= z)`];
27903 REWRITE_TAC[SUBSET;closed_ball];
27907 TYPE_THEN `C'' i SUBSET (euclid 2)` SUBGOAL_TAC;
27908 IMATCH_MP_TAC simple_arc_euclid;
27909 IMATCH_MP_TAC simple_arc_end_simple;
27912 REWRITE_TAC[SUBSET];
27920 TYPE_THEN `(C' i UNION C'' i) INTER D = (C' i INTER D)` SUBGOAL_TAC;
27921 REWRITE_TAC[INTER];
27922 IMATCH_MP_TAC EQ_EXT;
27926 DISCH_THEN_REWRITE;
27929 IMATCH_MP_TAC SUBSET_TRANS;
27930 TYPE_THEN `C' i` EXISTS_TAC;
27932 REWRITE_TAC[INTER;SUBSET];
27934 (* Thu Aug 19 07:36:47 EDT 2004 *)
27939 let euclid_cancel1 = prove_by_refinement(
27940 `!x y z. (x = euclid_plus y z) <=> (x - y = z)`,
27945 DISCH_THEN_REWRITE;
27946 IMATCH_MP_TAC EQ_EXT;
27947 REWRITE_TAC[euclid_plus;euclid_minus];
27952 IMATCH_MP_TAC EQ_EXT;
27953 REWRITE_TAC[euclid_plus;euclid_minus];
27958 let infinite_subset = prove_by_refinement(
27959 `!(X:A->bool) Y. INFINITE X /\ X SUBSET Y ==> INFINITE Y`,
27962 REWRITE_TAC[INFINITE];
27963 MESON_TAC[FINITE_SUBSET];
27967 let EXPinj = prove_by_refinement(
27968 `!x y n. (1 < n) /\ (n **| x = n **| y) ==> (x = y)`,
27971 TYPE_THEN `! x y n. (x <| y) /\ (n **| x = n **| y) ==> ~(1 <| n)` SUBGOAL_TAC;
27973 TYPE_THEN `n **| y <= n **| x` SUBGOAL_TAC;
27976 REWRITE_TAC[LE_EXP];
27977 TYPE_THEN `~(n = 0)` SUBGOAL_TAC;
27980 DISCH_THEN_REWRITE;
27981 REWRITE_TAC[DE_MORGAN_THM];
27989 PROOF_BY_CONTR_TAC;
27990 TYPE_THEN `x < y \/ y <| x` SUBGOAL_TAC;
27993 DISCH_THEN DISJ_CASES_TAC;
27994 TYPEL_THEN[`x`;`y`;`n`] (USE 0 o ISPECL);
27996 TYPEL_THEN[`y`;`x`;`n`] (USE 0 o ISPECL);
28001 let infinite_interval = prove_by_refinement(
28002 `!a b. a < b ==> (INFINITE {x | a < x /\ x < b})`,
28006 IMATCH_MP_TAC infinite_subset;
28007 TYPE_THEN `f = (\ n. a + (b-a)/((&2) pow (SUC n)))` ABBREV_TAC ;
28008 TYPE_THEN `IMAGE f UNIV` EXISTS_TAC ;
28010 TYPE_THEN `(! x y. (f x = f y) ==> (x = y))` SUBGOAL_TAC;
28013 USE 2 (REWRITE_RULE[REAL_ARITH `(a + d = a + d') <=> (d = d')`;real_div;REAL_PROP_EQ_RMUL_';]);
28014 TYPE_THEN `~(b - a = &0)` SUBGOAL_TAC;
28019 USE 2 (REWRITE_RULE[GSYM REAL_EQ_INV]);
28023 ONCE_REWRITE_TAC[GSYM SUC_INJ];
28024 IMATCH_MP_TAC EXPinj;
28025 TYPE_THEN `2` EXISTS_TAC;
28029 TYPE_THEN `INFINITE (UNIV:num->bool) ==> INFINITE (IMAGE f UNIV)` SUBGOAL_TAC;
28030 ASM_MESON_TAC[INFINITE_IMAGE_INJ];
28031 REWRITE_TAC[num_INFINITE];
28033 REWRITE_TAC[IMAGE;SUBSET];
28037 DISCH_THEN_REWRITE;
28040 ONCE_REWRITE_TAC[REAL_ARITH `a < a + x <=> &0 < x`];
28041 REWRITE_TAC[real_div];
28042 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
28046 IMATCH_MP_TAC REAL_PROP_POS_INV;
28049 ONCE_REWRITE_TAC [REAL_ARITH `a + x < b <=> x < (b - a)*(&1)`];
28050 REWRITE_TAC[real_div];
28051 IMATCH_MP_TAC REAL_PROP_LT_LMUL;
28055 ONCE_REWRITE_TAC[GSYM REAL_INV_1];
28056 IMATCH_MP_TAC REAL_LT_INV2;
28058 IMATCH_MP_TAC exp_gt1;
28060 (* Thu Aug 19 14:59:58 EDT 2004 *)
28064 let finite_augment1 = prove_by_refinement(
28065 `!n (X:A->bool) . (INFINITE X) ==> (?Z. Z SUBSET X /\ Z HAS_SIZE n)`,
28070 TYPE_THEN `EMPTY:A->bool` EXISTS_TAC ;
28071 REWRITE_TAC[HAS_SIZE_0];
28076 TYPE_THEN `INFINITE (X DIFF Z)` SUBGOAL_TAC;
28077 IMATCH_MP_TAC INFINITE_DIFF_FINITE;
28079 ASM_MESON_TAC[HAS_SIZE];
28081 USE 3 (MATCH_MP INFINITE_NONEMPTY);
28082 USE 3 (REWRITE_RULE[EMPTY_EXISTS]);
28084 TYPE_THEN `u INSERT Z` EXISTS_TAC;
28088 REWRITE_TAC[DIFF;SUBSET;INSERT];
28091 USE 0 (REWRITE_RULE[HAS_SIZE]);
28092 ASM_SIMP_TAC [HAS_SIZE;FINITE_INSERT;CARD_CLAUSES;];
28095 DISCH_THEN_REWRITE;
28099 let finite_augment = prove_by_refinement(
28100 `!(X:A->bool) Y n m . (n <= m) /\ (X HAS_SIZE n) /\ (INFINITE Y) /\
28101 (X SUBSET Y) ==> (?Z. (X SUBSET Z /\ Z SUBSET Y /\ Z HAS_SIZE m))`,
28105 TYPE_THEN `INFINITE (Y DIFF X)` SUBGOAL_TAC;
28106 IMATCH_MP_TAC INFINITE_DIFF_FINITE;
28107 ASM_MESON_TAC[HAS_SIZE];
28109 USE 4(MATCH_MP finite_augment1);
28110 USE 3(REWRITE_RULE[LE_EXISTS]);
28114 TYPE_THEN `X UNION Z` EXISTS_TAC;
28116 REWRITE_TAC[SUBSET;UNION];
28118 REWRITE_TAC[union_subset];
28122 SET_TAC[SUBSET;DIFF];
28123 REWRITE_TAC[HAS_SIZE];
28125 ASM_REWRITE_TAC[FINITE_UNION];
28126 ASM_MESON_TAC[HAS_SIZE];
28127 RULE_ASSUM_TAC (REWRITE_RULE[HAS_SIZE]);
28131 IMATCH_MP_TAC CARD_UNION;
28134 REWRITE_TAC[SUBSET;DIFF;INTER;EQ_EMPTY ];
28136 (* Thu Aug 19 15:29:05 EDT 2004 *)
28141 let euclid_add_cancel = prove_by_refinement(
28142 `!p q q'. (euclid_plus p q = euclid_plus p q') <=> (q = q')`,
28146 REWRITE_TAC[FUN_EQ_THM];
28147 REWRITE_TAC [euclid_plus;];
28148 REWRITE_TAC[REAL_ARITH `(x + a = x + b) <=> (a = b)`];
28153 let degree_vertex_disk_ver2 = prove_by_refinement(
28154 `!r p X. (&0 < r) /\ (euclid 2 p) /\ (FINITE X) /\ (CARD X <= 4) /\
28155 (X SUBSET {x | (euclid 2 x) /\ (d_euclid p x = r)}) ==>
28156 (?C. (!i. (X i) ==> (?C' C'' v.
28157 simple_arc_end C' p v /\
28158 simple_arc_end C'' v i /\
28159 C' SUBSET closed_ball(euclid 2,d_euclid) p (r/ &2) /\
28160 (C' INTER C'' = {v}) /\
28161 (C' UNION C'' = C i )) /\
28162 simple_arc_end (C i ) p i /\
28163 C i SUBSET (closed_ball(euclid 2,d_euclid) p r) /\
28164 C i INTER (closed_ball(euclid 2,d_euclid) p (r / &2))
28165 SUBSET (hyperplane 2 e2 (p 1) UNION
28166 hyperplane 2 e1 (p 0))) /\
28167 (!i j. (X i ) /\ (X j) /\ (~(i=j)) ==>
28168 (C i INTER C j = {p} )))`,
28172 TYPE_THEN `!x. (X x) ==> (?r t. &0 <= t /\ t < &2 * pi /\ &0 <= r /\ (x = p + r *# cis t))` SUBGOAL_TAC;
28174 REWRITE_TAC[euclid_cancel1];
28175 IMATCH_MP_TAC polar_exist;
28176 USE 0(REWRITE_RULE[SUBSET]);
28177 ASM_MESON_TAC[euclid_sub_closure];
28180 TYPE_THEN `!x. (X x) ==> (?t. &0 <= t /\ t < &2 * pi /\ &0 <= r /\ (x = p + r *# cis t))` SUBGOAL_TAC;
28186 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])));
28187 TYPE_THEN `t` EXISTS_TAC;
28192 USE 0 (REWRITE_RULE[SUBSET]);
28193 TSPEC `euclid_plus p (r' *# cis t)` 0;
28197 TYPEL_THEN[`2`;`p`;`r' *# cis t`] (fun t-> ANT_TAC (ISPECL t d_euclidpq));
28198 ASM_REWRITE_TAC[polar_euclid];
28199 DISCH_THEN_REWRITE;
28200 REWRITE_TAC[GSYM norm2;norm2_scale_cis];
28202 TYPE_THEN `abs r' = r'` SUBGOAL_TAC;
28211 TYPE_THEN `TX = {t | (&0 <= t /\ t < &2 *pi /\ (X( p + (r *# (cis t))))) }` ABBREV_TAC ;
28212 TYPE_THEN `BIJ ( \ t. p + r *# cis t) TX X` SUBGOAL_TAC;
28213 REWRITE_TAC[BIJ;INJ;SURJ];
28222 USE 7 (REWRITE_RULE[euclid_add_cancel]);
28223 PROOF_BY_CONTR_TAC;
28224 TYPEL_THEN[`x`;`y`;`r`;`r`] (fun t-> ANT_TAC(ISPECL t polar_inj));
28231 DISCH_THEN_REWRITE;
28238 TYPE_THEN `INFINITE {x | &0 <= x /\ x < &2* pi}` SUBGOAL_TAC;
28239 IMATCH_MP_TAC infinite_subset;
28240 TYPE_THEN `{x | &0 < x /\ x < &2 * pi}` EXISTS_TAC;
28242 IMATCH_MP_TAC infinite_interval;
28243 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
28244 REWRITE_TAC[PI_POS];
28246 REWRITE_TAC[SUBSET];
28247 MESON_TAC[REAL_ARITH `&0 < x ==> &0 <= x`];
28250 TYPE_THEN `TX HAS_SIZE CARD X` SUBGOAL_TAC;
28251 REWRITE_TAC[HAS_SIZE];
28255 USE 2 (MATCH_MP FINITE_BIJ2);
28258 IMATCH_MP_TAC BIJ_CARD;
28259 ASM_REWRITE_TAC [];
28263 TYPE_THEN `(?Z. (TX SUBSET Z /\ Z SUBSET {x | &0 <= x /\ x < &2 *pi} /\ Z HAS_SIZE 4))` SUBGOAL_TAC;
28264 IMATCH_MP_TAC finite_augment;
28265 TYPE_THEN `CARD X` EXISTS_TAC;
28268 REWRITE_TAC[SUBSET];
28271 (* B -- order points *)
28272 TYPE_THEN `FINITE Z` SUBGOAL_TAC;
28273 ASM_MESON_TAC[HAS_SIZE];
28275 USE 13 (MATCH_MP real_finite_increase);
28277 USE 10(REWRITE_RULE[HAS_SIZE]);
28282 TYPEL_THEN [`r`;`p`;`u`] (fun t-> ANT_TAC (ISPECL t degree_vertex_disk));
28286 REWRITE_TAC[BIJ;SURJ];
28288 USE 11(REWRITE_RULE[SUBSET]);
28291 FIRST_ASSUM IMATCH_MP_TAC ;
28297 (* [C] -- create C *)
28298 TYPE_THEN `f = (\t. euclid_plus p (r *# cis t))` ABBREV_TAC ;
28299 TYPE_THEN `g = INV f TX X` ABBREV_TAC ;
28300 TYPE_THEN `u' = INV u {x | x <| 4} Z` ABBREV_TAC ;
28301 TYPE_THEN `BIJ g X TX` SUBGOAL_TAC;
28303 IMATCH_MP_TAC INVERSE_BIJ;
28307 TYPE_THEN `BIJ u' Z {x | x <| 4}` SUBGOAL_TAC;
28309 IMATCH_MP_TAC INVERSE_BIJ;
28313 TYPE_THEN `INJ (compose u' g) X { x | x <| 4}` SUBGOAL_TAC;
28314 IMATCH_MP_TAC COMP_INJ;
28315 TYPE_THEN `TX` EXISTS_TAC;
28320 IMATCH_MP_TAC inj_subset_domain;
28321 TYPE_THEN `Z` EXISTS_TAC;
28325 DISCH_THEN_REWRITE;
28327 TYPE_THEN `(\ j. C ((compose u' g) j))` EXISTS_TAC;
28329 (* D -- check properties *)
28332 TYPE_THEN `j = compose u' g i` ABBREV_TAC ;
28334 TYPE_THEN `j <| 4` SUBGOAL_TAC;
28335 USE 23 (REWRITE_RULE[INJ]);
28338 FIRST_ASSUM IMATCH_MP_TAC ;
28344 TYPE_THEN `i = f (u j)` SUBGOAL_TAC;
28348 REWRITE_TAC[compose];
28349 ONCE_REWRITE_TAC [EQ_SYM_EQ];
28350 TYPE_THEN `u (INV u {x | x <| 4} Z (g i)) = (g i)` SUBGOAL_TAC;
28351 IMATCH_MP_TAC inv_comp_right;
28355 REWRITE_TAC[SUBSET;BIJ;SURJ;];
28358 DISCH_THEN_REWRITE;
28359 TYPE_THEN `f (g i) = i` SUBGOAL_TAC;
28361 IMATCH_MP_TAC inv_comp_right;
28364 DISCH_THEN_REWRITE;
28366 DISCH_THEN (fun t-> RULE_ASSUM_TAC (REWRITE_RULE[GSYM t]));
28370 TYPE_THEN `i' = compose u' g i` ABBREV_TAC ;
28371 TYPE_THEN `j' = compose u' g j` ABBREV_TAC ;
28373 TYPE_THEN `~(i' = j')` SUBGOAL_TAC;
28377 USE 23 (REWRITE_RULE[INJ]);
28379 FIRST_ASSUM IMATCH_MP_TAC ;
28382 TYPE_THEN `(i' <| 4) /\ (j' <| 4) ` SUBGOAL_TAC;
28385 USE 23 (REWRITE_RULE[INJ]);
28389 TYPEL_THEN [`i'`;`j'`] (USE 16 o ISPECL);
28390 FIRST_ASSUM IMATCH_MP_TAC ;
28392 (* Thu Aug 19 18:06:33 EDT 2004 *)
28397 (* ------------------------------------------------------------------ *)
28399 (* ------------------------------------------------------------------ *)
28402 let simple_arc_connected = prove_by_refinement(
28403 `!C. simple_arc top2 C ==> connected top2 C`,
28407 REWRITE_TAC[simple_arc;];
28410 IMATCH_MP_TAC connect_image;
28411 TYPE_THEN `(top_of_metric(UNIV,d_real))` EXISTS_TAC;
28412 ASM_REWRITE_TAC[connect_real];
28413 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
28414 REWRITE_TAC[IMAGE;SUBSET];
28417 (* Fri Aug 20 08:32:31 EDT 2004 *)
28422 let disk_endpoint = prove_by_refinement(
28423 `!C r p v v'. simple_arc_end C v v' /\ (&0 < r) /\ (euclid 2 p) /\
28424 (C INTER (closed_ball(euclid 2,d_euclid) p r) = {v}) ==>
28425 (d_euclid p v = r)`,
28429 PROOF_BY_CONTR_TAC;
28430 TYPE_THEN `connected top2 C` SUBGOAL_TAC;
28431 IMATCH_MP_TAC simple_arc_connected;
28432 IMATCH_MP_TAC simple_arc_end_simple;
28436 TYPE_THEN `A = euclid 2 DIFF (closed_ball (euclid 2, d_euclid) p r)` ABBREV_TAC ;
28437 TYPE_THEN `B = closed_ball(euclid 2, d_euclid) p r` ABBREV_TAC ;
28438 TYPE_THEN `closed_ top2 B` SUBGOAL_TAC;
28441 IMATCH_MP_TAC closed_ball_closed;
28442 REWRITE_TAC[metric_euclid];
28445 TYPE_THEN `top2 A` SUBGOAL_TAC;
28449 REWRITE_TAC[closed;top2_unions;open_DEF ;];
28450 DISCH_THEN_REWRITE;
28453 TYPE_THEN `C SUBSET euclid 2` SUBGOAL_TAC;
28454 IMATCH_MP_TAC simple_arc_euclid;
28455 IMATCH_MP_TAC simple_arc_end_simple;
28459 TYPE_THEN `B' = open_ball(euclid 2,d_euclid) p r` ABBREV_TAC ;
28460 TYPE_THEN `C SUBSET B' UNION A` SUBGOAL_TAC;
28464 REWRITE_TAC[open_ball;SUBSET;DIFF;closed_ball;UNION];
28465 USE 10 (REWRITE_RULE[SUBSET]);
28471 PROOF_BY_CONTR_TAC;
28472 USE 13 (REWRITE_RULE[DE_MORGAN_THM]);
28474 TYPE_THEN `B x` SUBGOAL_TAC;
28476 REWRITE_TAC[closed_ball];
28478 USE 0 (REWRITE_RULE[FUN_EQ_THM]);
28479 USE 0 (REWRITE_RULE[INTER;INR IN_SING]);
28480 ASM_MESON_TAC[REAL_ARITH `u <= v /\ ~(u = v) ==> (u < v)`];
28482 USE 5 (REWRITE_RULE[connected;top2_unions]);
28484 TYPEL_THEN[`B'`;`A`] (USE 12 o ISPECL);
28486 TYPE_THEN `top2 B'` SUBGOAL_TAC;
28489 IMATCH_MP_TAC open_ball_open;
28490 REWRITE_TAC[metric_euclid];
28491 DISCH_THEN_FULL_REWRITE;
28493 TYPE_THEN `B' INTER A = EMPTY` SUBGOAL_TAC;
28497 REWRITE_TAC[open_ball;closed_ball;DIFF;EQ_EMPTY;INTER;];
28503 DISCH_THEN_FULL_REWRITE;
28505 FIRST_ASSUM DISJ_CASES_TAC;
28506 TYPE_THEN `C SUBSET B` SUBGOAL_TAC;
28507 IMATCH_MP_TAC SUBSET_TRANS;
28508 TYPE_THEN `B'` EXISTS_TAC;
28512 REWRITE_TAC[SUBSET;open_ball;closed_ball];
28513 MESON_TAC[REAL_ARITH `x < y ==> x <= y`];
28516 TYPE_THEN `~(v = v')` SUBGOAL_TAC;
28517 IMATCH_MP_TAC simple_arc_end_distinct;
28520 TYPE_THEN `C v'` SUBGOAL_TAC;
28521 ASM_MESON_TAC[simple_arc_end_end2];
28523 TYPE_THEN `B v'` SUBGOAL_TAC;
28526 MESON_TAC[ISUBSET];
28529 REWRITE_TAC[INTER;eq_sing];
28532 TYPE_THEN `C v` SUBGOAL_TAC;
28533 ASM_MESON_TAC[simple_arc_end_end];
28535 TYPE_THEN `A v` SUBGOAL_TAC;
28536 ASM_MESON_TAC[ISUBSET];
28537 TYPE_THEN `B v` SUBGOAL_TAC;
28539 REWRITE_TAC[INTER;eq_sing];
28540 DISCH_THEN_REWRITE;
28543 DISCH_THEN_REWRITE;
28544 (* Fri Aug 20 09:12:44 EDT 2004 *)
28549 let disk_endpoint_gen = prove_by_refinement(
28550 `!C B' B v v'. simple_arc_end C v v' /\
28551 (top2 B') /\ (closed_ top2 B) /\ (B' SUBSET B) /\
28552 (C INTER B = {v}) ==>
28557 TYPE_THEN `connected top2 C` SUBGOAL_TAC;
28558 IMATCH_MP_TAC simple_arc_connected;
28559 IMATCH_MP_TAC simple_arc_end_simple;
28563 TYPE_THEN `A = euclid 2 DIFF B` ABBREV_TAC ;
28565 TYPE_THEN `top2 A` SUBGOAL_TAC;
28568 REWRITE_TAC[closed;top2_unions;open_DEF ;];
28569 DISCH_THEN_REWRITE;
28572 TYPE_THEN `C SUBSET euclid 2` SUBGOAL_TAC;
28573 IMATCH_MP_TAC simple_arc_euclid;
28574 IMATCH_MP_TAC simple_arc_end_simple;
28578 TYPE_THEN `C SUBSET B' UNION A` SUBGOAL_TAC;
28580 REWRITE_TAC[open_ball;SUBSET;DIFF;closed_ball;UNION];
28581 USE 9 (REWRITE_RULE[SUBSET]);
28584 TYPE_THEN `B x` ASM_CASES_TAC;
28586 USE 1(REWRITE_RULE[INTER;eq_sing]);
28588 TYPE_THEN `(x = v)` SUBGOAL_TAC;
28589 FIRST_ASSUM IMATCH_MP_TAC ;
28591 DISCH_THEN_FULL_REWRITE;
28595 FIRST_ASSUM IMATCH_MP_TAC ;
28599 USE 6 (REWRITE_RULE[connected;top2_unions]);
28601 TYPEL_THEN[`B'`;`A`] (USE 6 o ISPECL);
28604 TYPE_THEN `B' INTER A = EMPTY` SUBGOAL_TAC;
28606 REWRITE_TAC[open_ball;closed_ball;DIFF;EQ_EMPTY;INTER;];
28608 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET]);
28610 DISCH_THEN_FULL_REWRITE;
28612 FIRST_ASSUM DISJ_CASES_TAC;
28613 TYPE_THEN `C SUBSET B` SUBGOAL_TAC;
28614 IMATCH_MP_TAC SUBSET_TRANS;
28615 TYPE_THEN `B'` EXISTS_TAC;
28619 TYPE_THEN `~(v = v')` SUBGOAL_TAC;
28620 IMATCH_MP_TAC simple_arc_end_distinct;
28623 TYPE_THEN `C v'` SUBGOAL_TAC;
28624 ASM_MESON_TAC[simple_arc_end_end2];
28626 TYPE_THEN `B v'` SUBGOAL_TAC;
28629 MESON_TAC[ISUBSET];
28632 REWRITE_TAC[INTER;eq_sing];
28635 TYPE_THEN `C v` SUBGOAL_TAC;
28636 ASM_MESON_TAC[simple_arc_end_end];
28638 TYPE_THEN `A v` SUBGOAL_TAC;
28639 ASM_MESON_TAC[ISUBSET];
28640 TYPE_THEN `B v` SUBGOAL_TAC;
28642 REWRITE_TAC[INTER;eq_sing];
28643 DISCH_THEN_REWRITE;
28646 DISCH_THEN_REWRITE;
28650 let disk_endpoint_outer = prove_by_refinement(
28651 `!C r p v v'. simple_arc_end C v v' /\ (&0 < r) /\ (euclid 2 p) /\
28652 (C INTER (euclid 2 DIFF (open_ball(euclid 2,d_euclid) p r)) = {v})
28654 (d_euclid p v = r)`,
28658 TYPE_THEN `B = (euclid 2 DIFF (open_ball(euclid 2,d_euclid) p r))` ABBREV_TAC ;
28659 TYPE_THEN `B' = (euclid 2 DIFF (closed_ball(euclid 2,d_euclid) p r))` ABBREV_TAC ;
28661 TYPE_THEN `B' SUBSET B` SUBGOAL_TAC;
28664 REWRITE_TAC[closed_ball;open_ball;SUBSET;DIFF];
28665 MESON_TAC[REAL_ARITH `x < u ==> x <= u`];
28668 TYPE_THEN `closed_ top2 B` SUBGOAL_TAC;
28670 REWRITE_TAC[closed;top2_unions;open_DEF ;SUBSET_DIFF];
28671 TYPE_THEN `open_ball (euclid 2,d_euclid) p r SUBSET (euclid 2)` SUBGOAL_TAC;
28672 REWRITE_TAC[open_ball;SUBSET];
28674 ASM_SIMP_TAC[DIFF_DIFF2];
28675 ASM_SIMP_TAC [open_ball_open;top2;metric_euclid];
28678 TYPE_THEN `top2 B'` SUBGOAL_TAC;
28680 TH_INTRO_TAC [`top2`;`closed_ball (euclid 2,d_euclid) p r`] closed_open;
28681 REWRITE_TAC[metric_euclid;top2];
28682 IMATCH_MP_TAC closed_ball_closed;
28683 REWRITE_TAC[metric_euclid];
28684 REWRITE_TAC[open_DEF;top2_unions;];
28687 TH_INTRO_TAC [`C`;`B'`;`B`;`v`;`v'`] disk_endpoint_gen;
28691 TYPE_THEN `B v` SUBGOAL_TAC;
28693 REWRITE_TAC[INTER;eq_sing];
28694 DISCH_THEN_REWRITE;
28697 TYPE_THEN `B v /\ ~B' v ==> (d_euclid p v = r)` SUBGOAL_TAC;
28700 REWRITE_TAC[DIFF;open_ball;closed_ball;];
28701 MESON_TAC[REAL_ARITH `x <= y /\ ~(x < y) ==> (x = y)`];
28702 DISCH_THEN IMATCH_MP_TAC ;
28707 let graph_edge_around = jordan_def
28708 `graph_edge_around (G:(A,B)graph_t) v =
28709 { e | graph_edge G e /\ graph_inc G e v}`;;
28711 let graph_edge_around_empty = prove_by_refinement(
28712 `!(G:(A,B)graph_t) v. (graph G) /\ ~(graph_vertex G v) ==>
28713 (graph_edge_around G v = EMPTY)`,
28717 REWRITE_TAC[graph_edge_around;EQ_EMPTY;];
28719 TH_INTRO_TAC [`G`;`x`] graph_inc_subset;
28721 REWRITE_TAC[SUBSET];
28723 (* Fri Aug 20 09:25:57 EDT 2004 *)
28729 let graph_disk_hv_preliminaries = prove_by_refinement(
28730 `!G. plane_graph G /\
28731 FINITE (graph_edge G) /\ FINITE (graph_vertex G) /\
28732 ~(graph_edge G = EMPTY) /\
28733 (!v. (CARD (graph_edge_around G v) <=| 4))
28735 (?NC D short_end hyper r d f. ((!e p. graph_edge G e /\ (!v. ~D v p) ==> (f e p = d e p)) /\
28737 graph_edge G e /\ graph_vertex G v /\ ~graph_inc G e v /\ D v p
28740 (graph_edge G e /\ graph_inc G e v) /\ D v p
28741 ==> (f e p = NC e v p)) /\
28742 (!e. f e = {x | d e x \/ (?v. graph_inc G e v /\ NC e v x)}) /\
28747 graph_inc G e' v /\
28749 ==> (NC e v INTER NC e' v = {v})) /\
28750 (!e v. graph_edge G e /\ graph_inc G e v ==> d e (short_end e v)) /\
28752 graph_edge G e /\ graph_edge G e' /\ ~(e = e')
28753 ==> (d e INTER d e' = {})) /\
28755 graph_edge G e /\ graph_inc G e v
28756 ==> ~graph_vertex G (short_end e v)) /\
28758 graph_vertex G v /\ graph_vertex G v' /\ ~(v = v')
28759 ==> (D v INTER D v' = {})) /\
28761 graph_edge G e /\ graph_inc G e v
28762 ==> simple_arc_end (NC e v) v (short_end e v) /\
28763 NC e v SUBSET D v /\
28764 hyper (NC e v) v) /\
28766 B INTER closed_ball (euclid 2,d_euclid) v (r / &2) SUBSET
28767 hyperplane 2 e2 (v 1) UNION hyperplane 2 e1 (v 0)) =
28769 (!e v. graph_edge G e /\ graph_inc G e v ==> graph_vertex G v) /\
28771 graph_edge G e /\ graph_vertex G v /\ ~graph_inc G e v
28772 ==> (d e INTER D v = {})) /\
28773 (!e. graph_edge G e ==> d e SUBSET e) /\
28775 graph_edge G e /\ graph_inc G e v
28776 ==> (d e INTER D v = {(short_end e v)}) /\
28777 (d_euclid v (short_end e v) = r) /\
28778 (!v'. graph_inc G e v' /\ ~(v = v')
28779 ==> simple_arc_end (d e) (short_end e v)
28780 (short_end e v'))) /\
28781 (!v. euclid 2 v ==> D v v) /\
28782 (!u. closed_ top2 (D u)) /\
28783 (( \ u. closed_ball (euclid 2,d_euclid) u r) = D) /\
28791 TH_INTRO_TAC [`G`] graph_disk;
28794 (* TYPE_THEN `r /(&2)` EXISTS_TAC; *)
28796 TYPE_THEN `D = (\u. (closed_ball (euclid 2,d_euclid ) u r))` ABBREV_TAC ;
28797 TYPE_THEN `!u. closed_ top2 (D u)` SUBGOAL_TAC;
28801 IMATCH_MP_TAC closed_ball_closed;
28802 REWRITE_TAC[metric_euclid];
28805 TYPE_THEN `!v. (euclid 2 v) ==> D v v` SUBGOAL_TAC;
28807 REWRITE_TAC[closed_ball2_center];
28809 DISCH_THEN_REWRITE;
28814 (* [A]- Pick middle arcs *)
28817 TYPE_THEN `!e. ?d. (graph_edge G e) ==> (?u u' v v'. simple_arc_end d u u' /\ graph_inc G e v /\ graph_inc G e v' /\ ~(v = v') /\ (d INTER (D v) = {u}) /\ (d INTER (D v') = {u'}) /\ (d SUBSET e) /\ (d_euclid v u = r) /\ (d_euclid v' u' = r))` SUBGOAL_TAC ;
28821 TH_INTRO_TAC [`G`;`e`] graph_edge_end_select;
28822 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]); (* -xx- *)
28825 TH_INTRO_TAC [`e`;`D v`;`D v'`] simple_arc_end_restriction;
28826 ASM_REWRITE_TAC[GSYM top2];
28828 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
28830 USE 16 (REWRITE_RULE[SUBSET ]);
28833 DISCH_THEN (TH_INTRO_TAC [`v`;`v'`] );
28835 RULE_ASSUM_TAC (REWRITE_RULE [plane_graph;]);
28836 ASM_MESON_TAC[REWRITE_RULE[SUBSET] graph_inc_subset];
28841 REWRITE_TAC[INTER;EQ_EMPTY];
28843 REWRITE_TAC[EMPTY_EXISTS ];
28844 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
28851 REWRITE_TAC[SUBSET];
28854 REWRITE_TAC[INTER];
28858 TYPE_THEN `C'` EXISTS_TAC;
28859 TYPE_THEN `v''` EXISTS_TAC;
28860 TYPE_THEN `v'''` EXISTS_TAC;
28861 TYPE_THEN `v` EXISTS_TAC;
28862 TYPE_THEN `v'` EXISTS_TAC;
28866 IMATCH_MP_TAC disk_endpoint;
28867 TYPE_THEN `C'` EXISTS_TAC;
28868 TYPE_THEN `v'''` EXISTS_TAC;
28872 DISCH_THEN_REWRITE;
28873 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
28875 USE 21 (REWRITE_RULE[SUBSET]);
28876 FIRST_ASSUM IMATCH_MP_TAC ;
28877 ASM_MESON_TAC[REWRITE_RULE[ISUBSET] graph_inc_subset];
28879 IMATCH_MP_TAC disk_endpoint;
28880 TYPE_THEN `C'` EXISTS_TAC;
28881 TYPE_THEN `v''` EXISTS_TAC;
28885 DISCH_THEN_REWRITE;
28887 IMATCH_MP_TAC simple_arc_end_symm;
28889 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
28891 USE 21 (REWRITE_RULE[SUBSET]);
28892 FIRST_ASSUM IMATCH_MP_TAC ;
28893 ASM_MESON_TAC[REWRITE_RULE[ISUBSET] graph_inc_subset];
28898 TYPE_THEN `short_end = ( \ e v. @s. (d e INTER (D v)) s)` ABBREV_TAC ;
28899 TYPE_THEN `!e v. (graph_edge G e /\ graph_inc G e v) ==> (d e INTER (D v) = {(short_end e v)}) /\ (d_euclid v (short_end e v) = r) /\ (!v'. (graph_inc G e v' /\ ~(v = v') ==> (simple_arc_end (d e) (short_end e v) (short_end e v'))))` SUBGOAL_TAC;
28904 TYPE_THEN `graph_inc G e HAS_SIZE 2` SUBGOAL_TAC;
28905 IMATCH_MP_TAC graph_edge2;
28907 REWRITE_TAC[plane_graph];
28908 DISCH_THEN_REWRITE;
28911 TYPE_THEN `!u. graph_inc G e u ==> (u = v') \/ (u = v'')` SUBGOAL_TAC;
28912 ASM_MESON_TAC[two_exclusion];
28914 TYPE_THEN `?s. (d e INTER D v) s` SUBGOAL_TAC;
28917 FIRST_ASSUM DISJ_CASES_TAC;
28918 ASM_REWRITE_TAC[INR IN_SING ];
28920 ASM_REWRITE_TAC[INR IN_SING ];
28924 TYPE_THEN `(d e INTER D v) (short_end e v)` SUBGOAL_TAC;
28925 EXPAND_TAC "short_end";
28927 DISCH_THEN_REWRITE ;
28933 TYPE_THEN `(v = v') \/ (v = v'')` SUBGOAL_TAC;
28934 FIRST_ASSUM IMATCH_MP_TAC ;
28936 TYPE_THEN `(graph_inc G e v''') ==> (v''' = v') \/ (v''' = v'')` SUBGOAL_TAC;
28938 FIRST_ASSUM IMATCH_MP_TAC ;
28942 DISCH_THEN DISJ_CASES_TAC;
28943 FIRST_ASSUM MP_TAC;
28944 DISCH_THEN_FULL_REWRITE;
28946 TYPE_THEN `short_end e v' = u` SUBGOAL_TAC;
28948 USE 26 (REWRITE_RULE[INR IN_SING]);
28950 DISCH_THEN_FULL_REWRITE;
28956 DISCH_THEN_FULL_REWRITE;
28957 TYPE_THEN `short_end e v'' = u'` SUBGOAL_TAC;
28958 TYPE_THEN `?s. (d e INTER D v'') s` SUBGOAL_TAC;
28959 ASM_REWRITE_TAC[INR IN_SING ];
28961 EXPAND_TAC "short_end";
28963 ASM_REWRITE_TAC[INR IN_SING ];
28964 DISCH_THEN_REWRITE;
28967 DISCH_THEN_REWRITE;
28970 FIRST_ASSUM MP_TAC;
28971 DISCH_THEN_FULL_REWRITE;
28973 TYPE_THEN `short_end e v'' = u'` SUBGOAL_TAC;
28975 USE 26 (REWRITE_RULE[INR IN_SING]);
28977 DISCH_THEN_FULL_REWRITE;
28983 DISCH_THEN_FULL_REWRITE;
28984 TYPE_THEN `short_end e v' = u` SUBGOAL_TAC;
28985 TYPE_THEN `?s. (d e INTER D v') s` SUBGOAL_TAC;
28986 ASM_REWRITE_TAC[INR IN_SING ];
28988 EXPAND_TAC "short_end";
28990 ASM_REWRITE_TAC[INR IN_SING ];
28991 DISCH_THEN_REWRITE;
28994 DISCH_THEN_REWRITE;
28995 IMATCH_MP_TAC simple_arc_end_symm;
29001 TYPE_THEN `X = (\ v. (IMAGE (\ e. short_end e v) (graph_edge_around G v)))` ABBREV_TAC ;
29002 TYPE_THEN `!v. FINITE (graph_edge_around G v)` SUBGOAL_TAC;
29004 REWRITE_TAC[graph_edge_around];
29005 IMATCH_MP_TAC FINITE_SUBSET;
29006 TYPE_THEN `graph_edge G ` EXISTS_TAC;
29007 ASM_REWRITE_TAC[SUBSET];
29011 TYPE_THEN `!v. graph_vertex G v ==> (FINITE (X v) /\ (CARD (X v) <=| 4) /\ ((X v) SUBSET {x | euclid 2 x /\ (d_euclid v x = r)}))` SUBGOAL_TAC;
29015 IMATCH_MP_TAC FINITE_IMAGE;
29019 IMATCH_MP_TAC LE_TRANS;
29020 TYPE_THEN `CARD (graph_edge_around G v)` EXISTS_TAC;
29022 IMATCH_MP_TAC CARD_IMAGE_LE;
29024 REWRITE_TAC[SUBSET;IMAGE];
29027 DISCH_THEN_FULL_REWRITE;
29028 USE 19 (REWRITE_RULE[graph_edge_around]);
29036 REWRITE_TAC[INTER;eq_sing;closed_ball];
29037 DISCH_THEN_REWRITE;
29039 (* -D now generate curves C in disk. *)
29040 TYPE_THEN `!v. (graph_vertex G v) ==> (?C. (!i. X v i ==> (?C' C'' v'. simple_arc_end C' v v' /\ simple_arc_end C'' v' i /\ C' SUBSET closed_ball (euclid 2,d_euclid) v (r / &2) /\ (C' INTER C'' = {v'}) /\ (C' UNION C'' = C i)) /\ simple_arc_end (C i) v i /\ C i SUBSET closed_ball (euclid 2,d_euclid) v r /\ C i INTER closed_ball (euclid 2,d_euclid) v (r / &2) SUBSET hyperplane 2 e2 (v 1) UNION hyperplane 2 e1 (v 0)) /\ (!i j. X v i /\ X v j /\ ~(i = j) ==> (C i INTER C j = {v})))` SUBGOAL_TAC;
29042 IMATCH_MP_TAC degree_vertex_disk_ver2;
29044 TYPE_THEN `(\j. X v j) = X v` SUBGOAL_TAC;
29045 IMATCH_MP_TAC EQ_EXT;
29048 DISCH_THEN_REWRITE;
29053 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29055 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET]);
29056 FIRST_ASSUM IMATCH_MP_TAC ;
29062 TYPE_THEN `f = (\ e. { x | d e x \/ (?v. graph_inc G e v /\ C v (short_end e v) x)})` ABBREV_TAC ;
29063 (* -[E] lets try to flatten some hypotheses *)
29064 TYPE_THEN `NC = (\ e v. (C v (short_end e v)))` ABBREV_TAC ;
29070 TYPE_THEN `!e . graph_edge G e ==> (d e SUBSET e)` SUBGOAL_TAC;
29074 TYPE_THEN `!e v. graph_edge G e /\ graph_vertex G v /\ ~graph_inc G e v ==> (d e INTER (D v) = EMPTY)` SUBGOAL_TAC;
29076 TYPEL_THEN [`e`;`v`] (USE 5 o ISPECL);
29080 REWRITE_TAC[SUBSET;EQ_EMPTY];
29083 REWRITE_TAC[INTER];
29090 TYPE_THEN `!e v. graph_edge G e /\ graph_inc G e v ==> graph_vertex G v` SUBGOAL_TAC;
29091 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29093 TH_INTRO_TAC [`G`;`e`] graph_inc_subset;
29095 REWRITE_TAC[SUBSET];
29096 DISCH_THEN IMATCH_MP_TAC ;
29100 TYPE_THEN `!e v. (graph_edge G e /\ graph_inc G e v ==> X v (short_end e v))` SUBGOAL_TAC;
29103 REWRITE_TAC[IMAGE];
29104 TYPE_THEN `e` EXISTS_TAC;
29105 ASM_REWRITE_TAC[graph_edge_around];
29110 TYPE_THEN `hyper = (\ B v. (B INTER closed_ball (euclid 2,d_euclid) v (r / &2) SUBSET hyperplane 2 e2 (v 1) UNION hyperplane 2 e1 (v 0)))` ABBREV_TAC ;
29111 TYPE_THEN `!e v. graph_edge G e /\ graph_inc G e v ==> (simple_arc_end (NC e v) v (short_end e v)) /\ (NC e v SUBSET D v) /\ (hyper (NC e v) v)` SUBGOAL_TAC;
29112 EXPAND_TAC "hyper";
29116 TYPE_THEN `graph_vertex G v` SUBGOAL_TAC;
29117 FIRST_ASSUM IMATCH_MP_TAC ;
29118 TYPE_THEN `e` EXISTS_TAC;
29120 DISCH_THEN_FULL_REWRITE;
29122 TSPEC `short_end e v` 16;
29123 TYPE_THEN `X v (short_end e v)` SUBGOAL_TAC;
29124 FIRST_ASSUM IMATCH_MP_TAC ;
29126 DISCH_THEN_FULL_REWRITE;
29131 (* F- continue simplification *)
29132 TYPE_THEN `!v v'. graph_vertex G v /\ graph_vertex G v' /\ ~(v = v') ==> (D v INTER D v' = EMPTY)` SUBGOAL_TAC;
29138 TYPE_THEN `!e v. (graph_edge G e /\ graph_inc G e v ==> ~(graph_vertex G (short_end e v)))` SUBGOAL_TAC;
29140 TYPEL_THEN [`e`;`v`] (USE 13 o ISPECL);
29143 USE 21 (REWRITE_RULE[eq_sing;INTER]);
29145 TYPE_THEN `D (short_end e v) (short_end e v)` SUBGOAL_TAC;
29146 FIRST_ASSUM IMATCH_MP_TAC ;
29147 RULE_ASSUM_TAC (REWRITE_RULE [plane_graph]);
29149 USE 27 (REWRITE_RULE[SUBSET]);
29150 FIRST_ASSUM IMATCH_MP_TAC ;
29153 TYPE_THEN `~(D (short_end e v) INTER D v = EMPTY)` SUBGOAL_TAC;
29154 REWRITE_TAC[EMPTY_EXISTS];
29155 TYPE_THEN `short_end e v` EXISTS_TAC;
29156 ASM_REWRITE_TAC[INTER];
29158 FIRST_ASSUM IMATCH_MP_TAC ;
29161 FIRST_ASSUM IMATCH_MP_TAC ;
29162 TYPE_THEN `e` EXISTS_TAC;
29164 PROOF_BY_CONTR_TAC;
29165 USE 25 (REWRITE_RULE[]);
29167 DISCH_THEN_FULL_REWRITE;
29168 TYPE_THEN `d_euclid v v = &0` SUBGOAL_TAC;
29169 IMATCH_MP_TAC metric_space_zero;
29170 TYPE_THEN `euclid 2` EXISTS_TAC;
29171 ASM_REWRITE_TAC[metric_euclid];
29172 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29174 USE 28 (REWRITE_RULE[SUBSET]);
29175 FIRST_ASSUM IMATCH_MP_TAC ;
29177 DISCH_THEN_FULL_REWRITE;
29183 TYPE_THEN `!e e'. graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==> (d e INTER d e' = EMPTY)` SUBGOAL_TAC;
29185 PROOF_BY_CONTR_TAC;
29186 USE 21 (REWRITE_RULE[EMPTY_EXISTS]);
29188 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29190 TYPEL_THEN [`e`;`e'`] (USE 4 o ISPECL);
29192 TYPE_THEN `d e INTER d e' SUBSET graph_vertex G` SUBGOAL_TAC;
29193 IMATCH_MP_TAC SUBSET_TRANS;
29194 TYPE_THEN `e INTER e'` EXISTS_TAC;
29196 IMATCH_MP_TAC subset_inter_pair;
29202 TYPE_THEN `graph_vertex G u` SUBGOAL_TAC;
29203 USE 26 (REWRITE_RULE[SUBSET]);
29204 FIRST_ASSUM IMATCH_MP_TAC ;
29206 USE 21(REWRITE_RULE[INTER]);
29207 TYPE_THEN `graph_inc G e u` ASM_CASES_TAC;
29208 TYPEL_THEN [`e`;`u`] (USE 13 o ISPECL);
29210 TYPE_THEN `(d e INTER D u) u` SUBGOAL_TAC;
29213 ASM_REWRITE_TAC[INTER];
29214 FIRST_ASSUM IMATCH_MP_TAC ;
29215 USE 25 (REWRITE_RULE[SUBSET]);
29216 FIRST_ASSUM IMATCH_MP_TAC ;
29218 FIRST_ASSUM IMATCH_MP_TAC ;
29219 TYPE_THEN `e` EXISTS_TAC;
29224 USE 28 (REWRITE_RULE[INR IN_SING]);
29226 DISCH_THEN (fun t-> ONCE_REWRITE_TAC [t]);
29227 FIRST_ASSUM IMATCH_MP_TAC ;
29229 TYPE_THEN `d e INTER D u = EMPTY ` SUBGOAL_TAC;
29230 FIRST_ASSUM IMATCH_MP_TAC ;
29231 ASM_REWRITE_TAC [];
29232 USE 26 (REWRITE_RULE[SUBSET]);
29233 FIRST_ASSUM IMATCH_MP_TAC ;
29234 ASM_REWRITE_TAC[INTER];
29236 USE 28(REWRITE_RULE[EQ_EMPTY]);
29239 USE 28(REWRITE_RULE[INTER]);
29242 FIRST_ASSUM IMATCH_MP_TAC ;
29243 USE 25 (REWRITE_RULE[SUBSET]);
29244 FIRST_ASSUM IMATCH_MP_TAC ;
29247 (* -G continue to simplify *)
29248 TYPE_THEN `!e v. graph_edge G e /\ graph_inc G e v ==> d e (short_end e v)` SUBGOAL_TAC;
29250 TYPEL_THEN [`e`;`v`] (USE 13 o ISPECL);
29253 USE 22(REWRITE_RULE[eq_sing;INTER]);
29257 TYPE_THEN `! v e e'. graph_edge G e /\ graph_edge G e' /\ graph_inc G e v /\ graph_inc G e' v /\ ~(e = e') ==> (NC e v INTER NC e' v = {v})` SUBGOAL_TAC;
29261 TYPE_THEN `graph_vertex G v` SUBGOAL_TAC;
29262 FIRST_ASSUM IMATCH_MP_TAC ;
29263 TYPE_THEN `e` EXISTS_TAC;
29265 DISCH_THEN_FULL_REWRITE;
29267 TYPEL_THEN [`short_end e v`;`short_end e' v`](USE 17 o ISPECL);
29269 FIRST_ASSUM IMATCH_MP_TAC ;
29271 FIRST_ASSUM IMATCH_MP_TAC ;
29274 FIRST_ASSUM IMATCH_MP_TAC ;
29278 TYPE_THEN `d e (short_end e v)` SUBGOAL_TAC;
29279 FIRST_ASSUM IMATCH_MP_TAC ;
29281 TYPE_THEN `d e' (short_end e' v)` SUBGOAL_TAC;
29282 FIRST_ASSUM IMATCH_MP_TAC ;
29284 TYPE_THEN `d e INTER d e' = EMPTY ` SUBGOAL_TAC;
29285 FIRST_ASSUM IMATCH_MP_TAC ;
29287 REWRITE_TAC[EQ_EMPTY;INTER];
29295 TYPE_THEN `!e. f e = {x | d e x \/ (?v. graph_inc G e v /\ NC e v x)}` SUBGOAL_TAC;
29303 TYPE_THEN `!e v p. (graph_edge G e /\ graph_inc G e v) /\ (D v p) ==> (f e p = NC e v p)` SUBGOAL_TAC ;
29306 ONCE_REWRITE_TAC [EQ_SYM_EQ];
29310 DISCH_THEN DISJ_CASES_TAC;
29311 TYPEL_THEN [`e`;`v`] (USE 13 o ISPECL);
29314 USE 22 (REWRITE_RULE[eq_sing;INTER ]);
29319 DISCH_THEN_FULL_REWRITE;
29320 TYPEL_THEN [`e`;`v`] (USE 11 o ISPECL);
29324 MESON_TAC[simple_arc_end_end2];
29326 TYPE_THEN `v' = v` ASM_CASES_TAC;
29329 PROOF_BY_CONTR_TAC;
29330 TYPE_THEN `D v INTER D v' = {}` SUBGOAL_TAC;
29331 FIRST_ASSUM IMATCH_MP_TAC ;
29334 FIRST_ASSUM IMATCH_MP_TAC ;
29335 TYPE_THEN `e` EXISTS_TAC;
29337 FIRST_ASSUM IMATCH_MP_TAC ;
29338 TYPE_THEN `e` EXISTS_TAC;
29340 REWRITE_TAC[EMPTY_EXISTS];
29341 TYPE_THEN `p` EXISTS_TAC;
29342 REWRITE_TAC[INTER];
29344 TYPEL_THEN[`e`;`v'`] (USE 11 o ISPECL);
29347 USE 24 (REWRITE_RULE[SUBSET]);
29348 FIRST_ASSUM IMATCH_MP_TAC ;
29352 TYPE_THEN `!e v p. (graph_edge G e /\ (graph_vertex G v) /\ ~(graph_inc G e v) /\ (D v p) ==> ~(f e p))` SUBGOAL_TAC;
29353 ASM_REWRITE_TAC[DE_MORGAN_THM ];
29357 TYPE_THEN `d e INTER D v = EMPTY` SUBGOAL_TAC;
29358 FIRST_ASSUM IMATCH_MP_TAC ;
29360 REWRITE_TAC[EMPTY_EXISTS;INTER ];
29361 TYPE_THEN `p` EXISTS_TAC;
29367 TYPE_THEN `~(v = v')` SUBGOAL_TAC;
29373 TYPE_THEN `D v INTER D v' = {}` SUBGOAL_TAC;
29374 FIRST_ASSUM IMATCH_MP_TAC ;
29376 FIRST_ASSUM IMATCH_MP_TAC ;
29377 TYPE_THEN `e` EXISTS_TAC;
29379 REWRITE_TAC[EMPTY_EXISTS;INTER];
29380 TYPE_THEN `p` EXISTS_TAC;
29382 TYPEL_THEN [`e`;`v'`] (USE 11 o ISPECL);
29386 USE 25 (REWRITE_RULE[SUBSET]);
29387 FIRST_ASSUM IMATCH_MP_TAC ;
29391 TYPE_THEN `!e p. graph_edge G e /\ (!v. ~(D v p)) ==> (f e p = d e p)` SUBGOAL_TAC ;
29394 IMATCH_MP_TAC (TAUT `~B ==> (A \/ B <=> A)`);
29400 TYPEL_THEN [`e`;`v`] (USE 11 o ISPECL);
29403 USE 18(REWRITE_RULE[SUBSET]);
29404 FIRST_ASSUM IMATCH_MP_TAC ;
29408 TYPE_THEN `NC` EXISTS_TAC;
29409 TYPE_THEN `D` EXISTS_TAC;
29410 TYPE_THEN `short_end` EXISTS_TAC;
29411 TYPE_THEN `hyper` EXISTS_TAC;
29412 TYPE_THEN `r` EXISTS_TAC;
29413 TYPE_THEN `d` EXISTS_TAC;
29414 TYPE_THEN `f` EXISTS_TAC;
29416 (* Sat Aug 21 08:06:22 EDT 2004 *)
29423 let graph_vertex_exhaust = prove_by_refinement(
29424 `!(G:(A,B)graph_t) e v v'.
29425 (graph G /\ (graph_edge G e) /\ (graph_inc G e v) /\
29426 (graph_inc G e v') /\ ~(v = v') ==> (graph_inc G e = {v,v'}))`,
29430 TYPE_THEN `graph_inc G e HAS_SIZE 2` SUBGOAL_TAC;
29431 IMATCH_MP_TAC graph_edge2;
29433 REWRITE_TAC[has_size2];
29436 DISCH_THEN_FULL_REWRITE;
29437 IMATCH_MP_TAC EQ_EXT;
29438 REWRITE_TAC[in_pair];
29441 RULE_ASSUM_TAC (REWRITE_RULE[in_pair]);
29447 let graph_disk_hv = prove_by_refinement(
29448 `!G. plane_graph G /\
29449 FINITE (graph_edge G) /\ FINITE (graph_vertex G) /\
29450 ~(graph_edge G = EMPTY) /\
29451 (!v. (CARD (graph_edge_around G v) <=| 4))
29453 (?r H . graph_isomorphic G H /\ good_plane_graph H /\
29456 graph_vertex H v /\ graph_vertex H v' /\ ~(v = v')
29457 ==> (closed_ball (euclid 2,d_euclid) v r INTER
29458 closed_ball (euclid 2,d_euclid) v' r =
29461 graph_edge H e /\ graph_vertex H v /\ ~graph_inc H e v
29462 ==> (e INTER closed_ball (euclid 2,d_euclid) v r = {})) /\
29464 graph_edge H e /\ graph_inc H e v
29465 ==> (e INTER closed_ball (euclid 2, d_euclid) v r SUBSET
29466 (hyperplane 2 e2 (v 1) UNION hyperplane 2 e1 (v 0))))
29472 TH_INTRO_TAC [`G`] graph_disk_hv_preliminaries;
29474 POP_ASSUM_LIST (fun t-> ALL_TAC);
29476 (* - *) (* redo 19 *)
29477 TYPE_THEN `!e p. graph_edge G e /\ (!v. graph_inc G e v ==> ~(D v p)) ==> (f e p = d e p)` SUBGOAL_TAC;
29480 IMATCH_MP_TAC (TAUT `~B ==> (A \/ B <=> A)`);
29486 TYPEL_THEN[`e`;`v`] (USE 10 o ISPECL);
29489 USE 20 (REWRITE_RULE[SUBSET]);
29490 FIRST_ASSUM IMATCH_MP_TAC ;
29495 TYPE_THEN `!e e'. graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==> (f e INTER f e' SUBSET e INTER e')` SUBGOAL_TAC;
29497 REWRITE_TAC[SUBSET;INTER ];
29499 TYPE_THEN `?v. (graph_inc G e v /\ D v x)` ASM_CASES_TAC;
29501 TYPE_THEN `f e x = NC e v x` SUBGOAL_TAC;
29502 FIRST_ASSUM IMATCH_MP_TAC ;
29504 DISCH_THEN_FULL_REWRITE;
29505 TYPE_THEN `graph_inc G e' v` ASM_CASES_TAC;
29506 TYPE_THEN `f e' x = NC e' v x` SUBGOAL_TAC;
29507 FIRST_ASSUM IMATCH_MP_TAC ;
29509 DISCH_THEN_FULL_REWRITE;
29510 TYPE_THEN `(NC e v INTER NC e' v = {v})` SUBGOAL_TAC;
29511 FIRST_ASSUM IMATCH_MP_TAC ;
29513 REWRITE_TAC[FUN_EQ_THM];
29514 REWRITE_TAC[INR IN_SING;INTER];
29519 DISCH_THEN_FULL_REWRITE;
29520 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29522 TYPE_THEN `e` (WITH 28 o ISPEC);
29527 DISCH_THEN_FULL_REWRITE;
29528 DISCH_THEN_FULL_REWRITE;
29531 REWRITE_TAC[INTER];
29532 DISCH_THEN_REWRITE;
29533 PROOF_BY_CONTR_TAC;
29536 FIRST_ASSUM IMATCH_MP_TAC ;
29537 TYPE_THEN `v` EXISTS_TAC;
29539 FIRST_ASSUM IMATCH_MP_TAC ;
29540 TYPE_THEN `e` EXISTS_TAC;
29543 TYPE_THEN `(f e x = d e x)` SUBGOAL_TAC;
29544 FIRST_ASSUM IMATCH_MP_TAC ;
29549 DISCH_THEN_FULL_REWRITE;
29550 TYPE_THEN `(?v. graph_inc G e' v /\ D v x)` ASM_CASES_TAC;
29552 PROOF_BY_CONTR_TAC;
29553 TYPE_THEN `d e INTER D v = {}` SUBGOAL_TAC;
29554 FIRST_ASSUM IMATCH_MP_TAC ;
29560 DISCH_THEN_REWRITE;
29561 FIRST_ASSUM IMATCH_MP_TAC ;
29562 TYPE_THEN `e'` EXISTS_TAC;
29564 REWRITE_TAC[EMPTY_EXISTS;INTER ];
29565 TYPE_THEN `x` EXISTS_TAC;
29567 TYPE_THEN `f e' x = d e' x` SUBGOAL_TAC;
29568 FIRST_ASSUM IMATCH_MP_TAC ;
29573 DISCH_THEN_FULL_REWRITE;
29574 PROOF_BY_CONTR_TAC;
29575 TYPE_THEN `d e INTER d e' = EMPTY` SUBGOAL_TAC;
29576 FIRST_ASSUM IMATCH_MP_TAC ;
29578 REWRITE_TAC[EMPTY_EXISTS ;INTER];
29579 TYPE_THEN `x` EXISTS_TAC;
29583 TYPE_THEN `INJ f (graph_edge G) UNIV` SUBGOAL_TAC;
29586 TYPE_THEN ` (graph_inc G x ) HAS_SIZE 2` SUBGOAL_TAC;
29587 IMATCH_MP_TAC graph_edge2;
29588 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29590 REWRITE_TAC[has_size2];
29592 TYPE_THEN `graph_inc G x a` SUBGOAL_TAC;
29593 ASM_REWRITE_TAC[in_pair];
29595 TYPE_THEN `d x SUBSET f x` SUBGOAL_TAC;
29598 REWRITE_TAC[SUBSET];
29601 TYPE_THEN `d x (short_end x a)` SUBGOAL_TAC;
29602 FIRST_ASSUM IMATCH_MP_TAC ;
29605 TYPE_THEN `f x (short_end x a)` SUBGOAL_TAC;
29608 REWRITE_TAC[SUBSET];
29611 PROOF_BY_CONTR_TAC;
29612 TYPE_THEN `f x INTER f y SUBSET x INTER y` SUBGOAL_TAC;
29613 FIRST_ASSUM IMATCH_MP_TAC ;
29616 TYPE_THEN `(x INTER y) (short_end x a)` SUBGOAL_TAC;
29617 USE 31 (REWRITE_RULE[SUBSET]);
29618 FIRST_ASSUM IMATCH_MP_TAC ;
29621 ASM_REWRITE_TAC[INTER_IDEMPOT];
29622 TYPE_THEN `(x INTER y) SUBSET (graph_vertex G)` SUBGOAL_TAC;
29623 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29625 FIRST_ASSUM IMATCH_MP_TAC ;
29628 TYPE_THEN `(graph_vertex G (short_end x a))` SUBGOAL_TAC;
29629 USE 33(REWRITE_RULE[SUBSET]);
29630 FIRST_ASSUM IMATCH_MP_TAC ;
29633 FIRST_ASSUM IMATCH_MP_TAC ;
29636 (* B now simple arc -- ugh *)
29637 TYPE_THEN `(!e v v'. (graph_edge G e /\ graph_inc G e v /\ graph_inc G e v' /\ ~(v = v') ==> (simple_arc_end (f e) v v')))` SUBGOAL_TAC;
29639 TYPE_THEN `f e = (NC e v UNION d e) UNION NC e v'` SUBGOAL_TAC;
29641 IMATCH_MP_TAC EQ_EXT;
29643 REWRITE_TAC[UNION];
29644 ONCE_REWRITE_TAC [EQ_SYM_EQ;];
29645 REWRITE_TAC[GSYM DISJ_ASSOC];
29649 TYPE_THEN `v` EXISTS_TAC;
29653 TYPE_THEN `v'` EXISTS_TAC;
29658 TYPE_THEN `graph_inc G e = {v , v'}` SUBGOAL_TAC;
29659 IMATCH_MP_TAC graph_vertex_exhaust;
29661 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29665 USE 27 (REWRITE_RULE[in_pair]);
29669 DISCH_THEN_FULL_REWRITE;
29672 DISCH_THEN_FULL_REWRITE;
29674 DISCH_THEN (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])) THEN ASSUME_TAC t);
29676 TYPE_THEN `simple_arc_end (NC e v UNION d e) v (short_end e v')` SUBGOAL_TAC;
29677 IMATCH_MP_TAC simple_arc_end_trans;
29678 TYPE_THEN `short_end e v` EXISTS_TAC;
29680 TYPEL_THEN [`e`;`v`] (USE 10 o ISPECL);
29685 TYPEL_THEN [`e`;`v`] (USE 5 o ISPECL);
29691 IMATCH_MP_TAC EQ_EXT;
29692 REWRITE_TAC[INR IN_SING;INTER ];
29693 ONCE_REWRITE_TAC [EQ_SYM_EQ];
29696 DISCH_THEN_FULL_REWRITE;
29698 TYPE_THEN `simple_arc_end (NC e v) v (short_end e v)` SUBGOAL_TAC;
29699 TYPEL_THEN [`e`;`v`] (USE 10 o ISPECL);
29703 MESON_TAC[simple_arc_end_end2];
29704 FIRST_ASSUM IMATCH_MP_TAC ;
29709 TYPE_THEN `D v x` SUBGOAL_TAC;
29710 TYPEL_THEN [`e`;`v`] (USE 10 o ISPECL);
29713 USE 29 (REWRITE_RULE[SUBSET]);
29714 FIRST_ASSUM IMATCH_MP_TAC ;
29717 TYPE_THEN `d e INTER D v = {(short_end e v)}` SUBGOAL_TAC;
29718 TYPEL_THEN [`e`;`v`] (USE 5 o ISPECL);
29722 REWRITE_TAC[eq_sing];
29724 FIRST_ASSUM IMATCH_MP_TAC ;
29725 REWRITE_TAC[INTER];
29729 IMATCH_MP_TAC simple_arc_end_trans;
29730 TYPE_THEN `(short_end e v')` EXISTS_TAC;
29733 IMATCH_MP_TAC simple_arc_end_symm;
29734 TYPEL_THEN [`e`;`v'`] (USE 10 o ISPECL);
29738 REWRITE_TAC[INTER];
29739 IMATCH_MP_TAC EQ_EXT;
29740 REWRITE_TAC[INR IN_SING];
29742 ONCE_REWRITE_TAC [EQ_SYM_EQ];
29744 DISCH_THEN_FULL_REWRITE;
29747 MESON_TAC[simple_arc_end_end2];
29748 TYPEL_THEN[`e`;`v'`] (USE 10 o ISPECL);
29752 MESON_TAC[simple_arc_end_end2];
29755 REWRITE_TAC[UNION];
29757 PROOF_BY_CONTR_TAC;
29758 TYPE_THEN `D v INTER D v' = {}` SUBGOAL_TAC;
29759 FIRST_ASSUM IMATCH_MP_TAC ;
29762 FIRST_ASSUM IMATCH_MP_TAC ;
29763 TYPE_THEN `e` EXISTS_TAC;
29765 FIRST_ASSUM IMATCH_MP_TAC ;
29766 TYPE_THEN `e` EXISTS_TAC;
29768 REWRITE_TAC[EMPTY_EXISTS;INTER];
29769 TYPE_THEN `x` EXISTS_TAC;
29771 TYPEL_THEN [`e`;`v`] (USE 10 o ISPECL);
29774 USE 31 (REWRITE_RULE[SUBSET]);
29775 FIRST_ASSUM IMATCH_MP_TAC ;
29777 TYPEL_THEN [`e`;`v'`] (USE 10 o ISPECL);
29780 USE 31 (REWRITE_RULE[SUBSET]);
29781 FIRST_ASSUM IMATCH_MP_TAC ;
29783 TYPE_THEN `D v' x` SUBGOAL_TAC;
29784 TYPEL_THEN [`e`;`v'`] (USE 10 o ISPECL);
29787 USE 30 (REWRITE_RULE[SUBSET]);
29788 FIRST_ASSUM IMATCH_MP_TAC ;
29791 TYPE_THEN `d e INTER D v' = {(short_end e v')}` SUBGOAL_TAC;
29792 TYPEL_THEN [`e`;`v'`] (USE 5 o ISPECL);
29796 REWRITE_TAC[INTER;eq_sing];
29798 FIRST_ASSUM IMATCH_MP_TAC ;
29802 TYPE_THEN `!e v. (graph_edge G e) ==> ( e INTER graph_vertex G = (f e) INTER (graph_vertex G))` SUBGOAL_TAC;
29804 IMATCH_MP_TAC EQ_EXT;
29805 REWRITE_TAC[INTER];
29807 IMATCH_MP_TAC (TAUT `(A ==> (B <=> C)) ==> (B /\ A <=> C /\ A)`);
29809 TYPE_THEN `D x x` SUBGOAL_TAC;
29810 FIRST_ASSUM IMATCH_MP_TAC ;
29811 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph;SUBSET ]);
29813 FIRST_ASSUM IMATCH_MP_TAC ;
29816 TYPE_THEN `graph_inc G e x` ASM_CASES_TAC;
29817 TYPE_THEN `f e x = NC e x x` SUBGOAL_TAC;
29818 FIRST_ASSUM IMATCH_MP_TAC ;
29820 DISCH_THEN_REWRITE;
29821 TYPE_THEN `NC e x x` SUBGOAL_TAC;
29822 TYPEL_THEN[`e`;`x`] (USE 10 o ISPECL);
29826 MESON_TAC[simple_arc_end_end];
29827 DISCH_THEN_REWRITE;
29828 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29834 REWRITE_TAC[INTER];
29835 DISCH_THEN_REWRITE;
29836 TYPE_THEN `~f e x` SUBGOAL_TAC;
29837 FIRST_ASSUM IMATCH_MP_TAC ;
29838 TYPE_THEN `x` EXISTS_TAC;
29840 DISCH_THEN_REWRITE;
29844 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
29848 ASM_REWRITE_TAC[INTER];
29850 (* D start on graph and goal *)
29851 TYPE_THEN `r /(&2)` EXISTS_TAC;
29852 TYPE_THEN `graph_edge_mod G f` EXISTS_TAC;
29853 REWRITE_TAC[good_plane_graph];
29854 ASM_REWRITE_TAC[REAL_LT_HALF1];
29856 IMATCH_MP_TAC graph_edge_iso;
29858 REWRITE_TAC[TAUT `(A /\ B) /\ C <=> (A /\ (B /\ C))`];
29861 IMATCH_MP_TAC plane_graph_mod;
29865 IMATCH_MP_TAC simple_arc_end_simple;
29866 TH_INTRO_TAC [`G`;`e`] graph_edge_end_select;
29867 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]); (* --x-- *)
29870 TYPE_THEN `v` EXISTS_TAC;
29871 TYPE_THEN `v'` EXISTS_TAC;
29872 FIRST_ASSUM IMATCH_MP_TAC ;
29877 RULE_ASSUM_TAC (REWRITE_RULE[graph_edge_mod_e;graph_edge_mod_i]);
29881 DISCH_THEN_FULL_REWRITE;
29882 TYPE_THEN `e'' =e'` SUBGOAL_TAC;
29883 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
29885 FIRST_ASSUM IMATCH_MP_TAC ;
29887 DISCH_THEN_FULL_REWRITE;
29888 FIRST_ASSUM IMATCH_MP_TAC ;
29891 TYPE_THEN `!v. closed_ball (euclid 2, d_euclid) v (r/(&2)) SUBSET D v` SUBGOAL_TAC;
29894 REWRITE_TAC[closed_ball;SUBSET];
29895 TYPE_THEN `r /(&2) < r` SUBGOAL_TAC;
29897 MESON_TAC[ half_pos];
29898 MESON_TAC[REAL_ARITH `x <= u /\ u < v ==> x <= v`];
29903 IMATCH_MP_TAC SUBSET_ANTISYM;
29905 IMATCH_MP_TAC SUBSET_TRANS;
29906 TYPE_THEN `D v INTER D v'` EXISTS_TAC;
29908 IMATCH_MP_TAC subset_inter_pair;
29910 RULE_ASSUM_TAC (REWRITE_RULE[graph_edge_mod_v]);
29911 TYPE_THEN `(D v INTER D v' = EMPTY)` SUBGOAL_TAC;
29912 FIRST_ASSUM IMATCH_MP_TAC ;
29914 DISCH_THEN_REWRITE;
29916 (* E - down to 2 *)
29919 RULE_ASSUM_TAC (REWRITE_RULE[graph_edge_mod_v;graph_edge_mod_i;graph_edge_mod_e]);
29920 USE 27 (REWRITE_RULE[IMAGE]);
29923 DISCH_THEN_FULL_REWRITE;
29926 PROOF_BY_CONTR_TAC;
29927 USE 27(REWRITE_RULE[EMPTY_EXISTS;INTER]);
29929 TYPE_THEN `D v u` SUBGOAL_TAC;
29930 USE 24 (REWRITE_RULE[SUBSET]);
29931 FIRST_ASSUM IMATCH_MP_TAC ;
29934 TYPE_THEN `~f x u` SUBGOAL_TAC;
29935 FIRST_ASSUM IMATCH_MP_TAC ;
29936 TYPE_THEN `v` EXISTS_TAC;
29943 RULE_ASSUM_TAC (REWRITE_RULE[graph_edge_mod_i;graph_edge_mod_e]);
29944 USE 26 (REWRITE_RULE[IMAGE]);
29947 DISCH_THEN_FULL_REWRITE;
29948 TYPE_THEN `e' = x` SUBGOAL_TAC;
29949 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
29951 FIRST_ASSUM IMATCH_MP_TAC ;
29953 DISCH_THEN_FULL_REWRITE;
29955 TYPE_THEN `f x INTER D v = NC x v INTER D v` SUBGOAL_TAC;
29956 IMATCH_MP_TAC EQ_EXT;
29958 REWRITE_TAC[INTER];
29959 IMATCH_MP_TAC (TAUT `(A ==> (B <=> C)) ==> (B /\ A <=> C /\ A)`);
29961 FIRST_ASSUM IMATCH_MP_TAC ;
29964 TYPE_THEN `f x INTER (closed_ball (euclid 2,d_euclid) v (r/(&2))) = NC x v INTER (closed_ball(euclid 2, d_euclid) v (r/(&2)))` SUBGOAL_TAC;
29965 IMATCH_MP_TAC EQ_EXT;
29967 REWRITE_TAC[INTER];
29968 USE 28 (REWRITE_RULE[FUN_EQ_THM]);
29972 REWRITE_TAC[SUBSET;INTER];
29974 DISCH_THEN_REWRITE;
29975 TYPEL_THEN[`x`;`v`] (USE 10 o ISPECL);
29979 EXPAND_TAC "hyper";
29980 DISCH_THEN_REWRITE;
29981 (* Sat Aug 21 14:12:41 EDT 2004 *)
29987 let hv_finite = jordan_def `hv_finite C <=>
29988 (?E. C SUBSET UNIONS E /\ FINITE E /\ hv_line E)`;;
29990 let hv_finite_subset = prove_by_refinement(
29991 `!A B. hv_finite B /\ A SUBSET B ==> hv_finite A`,
29994 REWRITE_TAC[hv_finite];
29996 TYPE_THEN `E` EXISTS_TAC;
29998 IMATCH_MP_TAC SUBSET_TRANS;
29999 TYPE_THEN `B` EXISTS_TAC;
30004 let mk_line_hyper2_e1 = prove_by_refinement(
30005 `!z. mk_line (point (z, &0)) (point(z, &1)) = hyperplane 2 e1 z`,
30008 REWRITE_TAC[GSYM line2D_F;e1;mk_line;];
30010 IMATCH_MP_TAC EQ_EXT;
30011 REWRITE_TAC[point_scale;point_add];
30014 TYPE_THEN `!t. t * z + (&1 - t) * z = z` SUBGOAL_TAC;
30017 DISCH_THEN_REWRITE;
30020 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT];
30021 TYPE_THEN `(z, &1 - t)` EXISTS_TAC;
30024 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT];
30025 TYPE_THEN `&1 - (SND p)` EXISTS_TAC;
30030 let mk_line_hyper2_e2 = prove_by_refinement(
30031 `!z. mk_line (point (&0, z)) (point(&1, z)) = hyperplane 2 e2 z`,
30034 REWRITE_TAC[GSYM line2D_S;e2;mk_line;];
30036 IMATCH_MP_TAC EQ_EXT;
30037 REWRITE_TAC[point_scale;point_add];
30040 TYPE_THEN `!t. t * z + (&1 - t) * z = z` SUBGOAL_TAC;
30043 DISCH_THEN_REWRITE;
30046 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT];
30047 TYPE_THEN `( &1 - t, z)` EXISTS_TAC;
30050 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT];
30051 TYPE_THEN `&1 - (FST p)` EXISTS_TAC;
30056 let hv_finite_hyper = prove_by_refinement(
30058 (?v. C SUBSET (hyperplane 2 e2 (v 1) UNION hyperplane 2 e1 (v 0))) ==>
30063 REWRITE_TAC[hv_finite];
30064 TYPE_THEN `{(hyperplane 2 e2 (v 1)), (hyperplane 2 e1 (v 0))}` EXISTS_TAC ;
30065 ASM_REWRITE_TAC[UNIONS_2;FINITE_INSERT;FINITE_SING;FINITE_RULES; ];
30066 REWRITE_TAC[hv_line;in_pair;GSYM mk_line_hyper2_e2;GSYM mk_line_hyper2_e1];
30070 TYPE_THEN `(v 0, &0)` EXISTS_TAC;
30071 TYPE_THEN `(v 0, &1)` EXISTS_TAC;
30074 TYPE_THEN `(&0, v 1)` EXISTS_TAC;
30075 TYPE_THEN `(&1, v 1)` EXISTS_TAC;
30081 let graph_hv_finite_radius = jordan_def
30082 `graph_hv_finite_radius G r <=> (good_plane_graph G /\
30085 graph_vertex G v /\ graph_vertex G v' /\ ~(v = v')
30086 ==> (closed_ball (euclid 2,d_euclid) v r INTER
30087 closed_ball (euclid 2,d_euclid) v' r =
30090 graph_edge G e /\ graph_vertex G v /\ ~graph_inc G e v
30091 ==> (e INTER closed_ball (euclid 2,d_euclid) v r = {})) /\
30093 graph_edge G e /\ graph_inc G e v
30094 ==> (hv_finite (e INTER closed_ball (euclid 2, d_euclid) v r))))
30097 let p_conn_hv_finite = prove_by_refinement(
30098 `!A x y. ~(x = y) ==>
30099 (p_conn A x y <=> (?C. (hv_finite C) /\ (C SUBSET A) /\
30100 (simple_arc_end C x y)))`,
30105 REWRITE_TAC[p_conn;simple_polygonal_arc];
30109 TH_INTRO_TAC [`C`;`x`;`y`] simple_arc_end_select;
30110 ASM_REWRITE_TAC[top2];
30112 TYPE_THEN `C'` EXISTS_TAC;
30113 REWRITE_TAC[hv_finite];
30115 TYPE_THEN `E` EXISTS_TAC;
30117 IMATCH_MP_TAC SUBSET_TRANS;
30118 TYPE_THEN `C` EXISTS_TAC;
30121 IMATCH_MP_TAC SUBSET_TRANS;
30122 TYPE_THEN `C` EXISTS_TAC;
30126 RULE_ASSUM_TAC (REWRITE_RULE[hv_finite]);
30128 TYPE_THEN `C` EXISTS_TAC;
30131 REWRITE_TAC[GSYM top2];
30132 IMATCH_MP_TAC simple_arc_end_simple;
30135 ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
30141 let graph_iso_around = prove_by_refinement(
30142 `!(G:(A,B)graph_t) (H:(A',B')graph_t) f v. (graph G) /\
30143 graph_iso f G H /\ (graph_vertex G v) ==>
30144 (graph_edge_around H (FST f v) =
30145 (IMAGE (SND f) (graph_edge_around G v)))`,
30148 REWRITE_TAC[graph_iso;graph_edge_around];
30150 IMATCH_MP_TAC EQ_EXT;
30155 TYPE_THEN `(?y. graph_edge G y /\ (v' y = x))` SUBGOAL_TAC;
30156 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
30158 FIRST_ASSUM IMATCH_MP_TAC ;
30163 DISCH_THEN_FULL_REWRITE;
30166 REWRITE_TAC[IMAGE];
30167 TYPE_THEN `y` EXISTS_TAC;
30170 USE 6 (REWRITE_RULE[IMAGE]);
30172 TYPE_THEN `v = x'` SUBGOAL_TAC;
30173 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
30175 FIRST_ASSUM IMATCH_MP_TAC ;
30177 TH_INTRO_TAC [`G`;`y`] graph_inc_subset;
30179 REWRITE_TAC[SUBSET];
30180 DISCH_THEN IMATCH_MP_TAC ;
30182 DISCH_THEN_FULL_REWRITE;
30184 REWRITE_TAC[IMAGE];
30188 DISCH_THEN_FULL_REWRITE;
30190 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
30194 REWRITE_TAC[IMAGE];
30196 TYPE_THEN `v` EXISTS_TAC;
30198 (* Sat Aug 21 16:49:58 EDT 2004 *)
30203 let graph_radius_exists = prove_by_refinement(
30204 `!G. planar_graph (G:(A,B) graph_t) /\
30205 FINITE (graph_edge G) /\ FINITE (graph_vertex G) /\
30206 ~(graph_edge G = EMPTY) /\
30207 (!v. (CARD (graph_edge_around G v) <=| 4)) ==>
30209 (graph_isomorphic G H /\ graph_hv_finite_radius H r))`,
30213 RULE_ASSUM_TAC (REWRITE_RULE[planar_graph]);
30215 TYPE_THEN `FINITE (graph_edge H) /\ FINITE (graph_vertex H) /\ ~(graph_edge H = EMPTY) /\ (!v. (CARD (graph_edge_around H v) <=| 4))` SUBGOAL_TAC;
30216 WITH 4 (REWRITE_RULE[graph_isomorphic]);
30219 RULE_ASSUM_TAC (REWRITE_RULE[graph_iso]);
30221 TH_INTRO_TAC [`graph_edge H`;`graph_edge G`;`v`] FINITE_BIJ2;
30223 DISCH_THEN_REWRITE;
30227 RULE_ASSUM_TAC (REWRITE_RULE[graph_iso]);
30229 TH_INTRO_TAC [`graph_vertex H`;`graph_vertex G`;`u`] FINITE_BIJ2;
30231 DISCH_THEN_REWRITE;
30233 REWRITE_TAC[EMPTY_EXISTS];
30234 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
30236 RULE_ASSUM_TAC (REWRITE_RULE[graph_iso;BIJ;SURJ]);
30241 TYPE_THEN `graph_vertex H v` ASM_CASES_TAC;
30242 TH_INTRO_TAC [`H`;`G`;`f`;`v`] graph_iso_around;
30244 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
30247 RULE_ASSUM_TAC (REWRITE_RULE[graph_iso]);
30250 DISCH_THEN_FULL_REWRITE;
30253 TH_INTRO_TAC [`v'`;`graph_edge_around H v`] CARD_IMAGE_INJ;
30257 RULE_ASSUM_TAC (REWRITE_RULE[INJ;BIJ]);
30259 FIRST_ASSUM IMATCH_MP_TAC ;
30261 RULE_ASSUM_TAC (REWRITE_RULE[graph_edge_around]);
30263 IMATCH_MP_TAC FINITE_SUBSET;
30264 TYPE_THEN `graph_edge H` EXISTS_TAC ;
30265 ASM_REWRITE_TAC[SUBSET;graph_edge_around];
30267 DISCH_THEN_FULL_REWRITE;
30269 TH_INTRO_TAC [`H`;`v`] graph_edge_around_empty;
30271 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
30273 DISCH_THEN_REWRITE;
30274 REWRITE_TAC[CARD_CLAUSES];
30278 TH_INTRO_TAC [`H`] graph_disk_hv;
30282 TYPE_THEN `r` EXISTS_TAC;
30283 TYPE_THEN `H'` EXISTS_TAC;
30284 REWRITE_TAC[graph_hv_finite_radius];
30287 TH_INTRO_TAC [`G`;`H`;`H'`] graph_isomorphic_trans;
30289 IMATCH_MP_TAC graph_isomorphic_symm;
30290 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
30292 DISCH_THEN_REWRITE;
30295 TYPEL_THEN [`e`;`v`] (USE 10 o ISPECL);
30297 IMATCH_MP_TAC hv_finite_hyper;
30298 TYPE_THEN `v` EXISTS_TAC;
30300 (* Sat Aug 21 17:28:09 EDT 2004 *)
30305 let replace = jordan_def `replace (x:A) y =
30306 (\ z. (if (z = x) then y else z))`;;
30308 let replace_x = prove_by_refinement(
30309 `!(x:A) y. replace x y x = y`,
30312 REWRITE_TAC[replace];
30313 (* Sun Aug 22 09:01:27 EDT 2004 *)
30318 let graph_replace = jordan_def
30319 `graph_replace (G:(A,B)graph_t) e e' =
30320 graph_edge_mod G (replace e e')`;;
30322 let replace_inj = prove_by_refinement(
30323 `!(x:A) y Z. ~(Z y) ==> INJ (replace x y) Z UNIV`,
30326 REWRITE_TAC[INJ;replace];
30328 MP_TAC (TAUT `((x' = (x:A)) \/ ~(x' = x)) /\ ((y' = x) \/ ~(y' = x))`);
30329 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
30330 REP_CASES_TAC THEN (REWR 0);
30336 let graph_replace_iso = prove_by_refinement(
30337 `!(G:(A,B)graph_t) e e'.
30338 ~(graph_edge G e') ==> graph_isomorphic G (graph_replace G e e')`,
30341 REWRITE_TAC[graph_replace];
30343 IMATCH_MP_TAC graph_edge_iso;
30344 IMATCH_MP_TAC replace_inj;
30346 (* Sun Aug 22 09:30:14 EDT 2004 *)
30351 let graph_replace_plane = prove_by_refinement(
30352 `!G e e'. plane_graph G /\ ~(graph_edge G e') /\
30353 (graph_edge G e) /\
30354 (!e''. graph_edge G e'' /\ ~(e'' = e) ==>
30355 (e' INTER e'' SUBSET e INTER e'')) /\
30356 (simple_arc top2 e') /\
30357 (e INTER graph_vertex G = e' INTER graph_vertex G) ==>
30358 plane_graph (graph_replace G e e')`,
30362 REWRITE_TAC[graph_replace];
30363 IMATCH_MP_TAC plane_graph_mod;
30367 IMATCH_MP_TAC replace_inj;
30372 REWRITE_TAC[replace];
30373 TYPE_THEN `((e'' = e) \/ ~(e'' = e)) /\ ((e''' = e) \/ ~(e''' = e))` (fun t-> MP_TAC (TAUT t));
30374 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
30375 REP_CASES_TAC THEN (FIRST_ASSUM (fun t-> REWRITE_TAC[t] THEN (RULE_ASSUM_TAC (REWRITE_RULE[t])) THEN (ASSUME_TAC t)));
30377 FIRST_ASSUM IMATCH_MP_TAC ;
30379 ONCE_REWRITE_TAC [INTER_COMM];
30380 FIRST_ASSUM IMATCH_MP_TAC ;
30382 REWRITE_TAC[SUBSET_REFL];
30386 REWRITE_TAC[replace];
30389 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph;SUBSET ]);
30391 FIRST_ASSUM IMATCH_MP_TAC ;
30395 REWRITE_TAC[replace];
30399 (* Sun Aug 22 10:28:15 EDT 2004 *)
30404 let good_replace = prove_by_refinement(
30405 `!G e e'. (good_plane_graph G) /\ plane_graph (graph_replace G e e') /\
30406 ~(graph_edge G e') /\
30407 ( e INTER (graph_vertex G) = e' INTER (graph_vertex G)) /\
30408 (!v v'. (graph_vertex G v) /\ (graph_vertex G v') /\
30409 ~(v = v') /\ e' v /\ e' v' ==> simple_arc_end e' v v')
30410 ==> (good_plane_graph (graph_replace G e e'))`,
30413 REWRITE_TAC[good_plane_graph;graph_replace];
30417 RULE_ASSUM_TAC (REWRITE_RULE[graph_edge_mod_e;graph_edge_mod_i ;IMAGE ]);
30420 DISCH_THEN_FULL_REWRITE;
30421 TH_INTRO_TAC [`e`;`e'`;`graph_edge G`] replace_inj;
30425 TYPE_THEN `e'''' = x` SUBGOAL_TAC;
30426 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
30428 FIRST_ASSUM IMATCH_MP_TAC ;
30430 DISCH_THEN_FULL_REWRITE;
30431 TYPE_THEN `e''' = x` SUBGOAL_TAC;
30432 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
30434 FIRST_ASSUM IMATCH_MP_TAC ;
30436 DISCH_THEN_FULL_REWRITE;
30438 REWRITE_TAC[replace];
30440 FIRST_ASSUM IMATCH_MP_TAC ;
30443 DISCH_THEN_FULL_REWRITE;
30444 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
30446 TYPE_THEN `graph_inc G e = e INTER graph_vertex G` SUBGOAL_TAC;
30447 FIRST_ASSUM IMATCH_MP_TAC ;
30449 DISCH_THEN_FULL_REWRITE;
30450 UNDF `e INTER u = e' INTER u`;
30451 DISCH_THEN_FULL_REWRITE;
30452 RULE_ASSUM_TAC (REWRITE_RULE[INTER;]);
30456 FIRST_ASSUM IMATCH_MP_TAC ;
30458 (* Sun Aug 22 10:59:34 EDT 2004 *)
30463 let graph_replace_hv_finite_radius = prove_by_refinement(
30464 `!G r e e'. graph_hv_finite_radius G r /\ ~(graph_edge G e') /\
30465 good_plane_graph (graph_replace G e e') /\
30466 (e INTER (graph_vertex G) = e' INTER (graph_vertex G)) /\
30467 (!v. graph_vertex G v /\ ~(e' v) ==>
30468 ((e' INTER closed_ball (euclid 2,d_euclid) v r = {}))) /\
30470 ==> graph_hv_finite_radius (graph_replace G e e') r`,
30473 REWRITE_TAC[graph_hv_finite_radius];
30480 DISCH_THEN IMATCH_MP_TAC ;
30482 RULE_ASSUM_TAC (REWRITE_RULE[graph_replace ;graph_edge_mod_v]);
30487 RULE_ASSUM_TAC (REWRITE_RULE[graph_replace;graph_edge_mod_v;IMAGE;graph_edge_mod_i;graph_edge_mod_e]);
30490 DISCH_THEN_FULL_REWRITE;
30491 REWRITE_TAC[replace];
30493 FIRST_ASSUM IMATCH_MP_TAC ;
30501 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph]);
30503 TYPE_THEN `graph_inc G e = e INTER graph_vertex G` SUBGOAL_TAC;
30504 FIRST_ASSUM IMATCH_MP_TAC ;
30506 DISCH_THEN_FULL_REWRITE;
30507 ASM_REWRITE_TAC[INTER];
30509 FIRST_ASSUM IMATCH_MP_TAC ;
30516 RULE_ASSUM_TAC (REWRITE_RULE[graph_replace;graph_edge_mod_v;IMAGE;graph_edge_mod_i;graph_edge_mod_e]);
30519 DISCH_THEN_FULL_REWRITE;
30520 TYPE_THEN `e''' = x` SUBGOAL_TAC;
30521 TH_INTRO_TAC [`e`;`e'`;`graph_edge G`] replace_inj;
30525 FIRST_ASSUM IMATCH_MP_TAC ;
30527 DISCH_THEN_FULL_REWRITE;
30529 REWRITE_TAC[replace];
30532 DISCH_THEN_FULL_REWRITE;
30533 IMATCH_MP_TAC hv_finite_subset;
30534 TYPE_THEN `e'` EXISTS_TAC;
30535 ASM_REWRITE_TAC[INTER;SUBSET;];
30537 FIRST_ASSUM IMATCH_MP_TAC ;
30539 (* Sun Aug 22 12:09:03 EDT 2004 *)
30544 let card_suc_insert = prove_by_refinement(
30545 `!(x:A) s. FINITE s /\ (~(s x)) ==> (SUC (CARD s) = CARD(x INSERT s))`,
30549 ASM_SIMP_TAC [CARD_CLAUSES];
30553 let graph_replace_card = prove_by_refinement(
30555 (FINITE (graph_edge (G:(A,(num->real)->bool)graph_t))) /\
30556 (graph_edge G e) /\ ~(graph_edge G e') /\
30557 ~(hv_finite e) /\ (hv_finite e') ==>
30558 (CARD {x | graph_edge (graph_replace G e e') x /\ ~(hv_finite x)} <
30559 CARD{ x | graph_edge G x /\ ~hv_finite x})
30564 IMATCH_MP_TAC (ARITH_RULE `(SUC x = y) ==> (x <| y)`);
30566 TYPE_THEN `FINITE (graph_edge (graph_replace G e e'))` SUBGOAL_TAC;
30567 REWRITE_TAC[graph_edge_mod_e;graph_replace];
30568 IMATCH_MP_TAC FINITE_IMAGE;
30572 TYPE_THEN `A = {x | graph_edge (graph_replace G e e') x /\ ~hv_finite x}` ABBREV_TAC ;
30573 TYPE_THEN `FINITE A` SUBGOAL_TAC;
30575 IMATCH_MP_TAC FINITE_SUBSET;
30576 TYPE_THEN `graph_edge (graph_replace G e e')` EXISTS_TAC;
30579 REWRITE_TAC[SUBSET];
30583 TYPE_THEN `~A e` SUBGOAL_TAC;
30586 ASM_REWRITE_TAC[graph_replace;graph_edge_mod_e;IMAGE];
30589 RULE_ASSUM_TAC (REWRITE_RULE[replace]);
30598 TYPE_THEN `SUC (CARD A) = CARD(e INSERT A)` SUBGOAL_TAC;
30599 IMATCH_MP_TAC card_suc_insert;
30601 DISCH_THEN_REWRITE;
30605 IMATCH_MP_TAC EQ_EXT;
30607 REWRITE_TAC[INSERT;graph_replace;graph_edge_mod_e;IMAGE;replace; ];
30610 FIRST_ASSUM DISJ_CASES_TAC;
30613 DISCH_THEN_FULL_REWRITE;
30616 DISCH_THEN_FULL_REWRITE;
30620 DISCH_THEN_FULL_REWRITE;
30624 TYPE_THEN `x = e` ASM_CASES_TAC;
30627 TYPE_THEN `x` EXISTS_TAC;
30632 let graph_edge_end_select_other = prove_by_refinement(
30633 `!(G:(A,B)graph_t) e v. (graph G /\ graph_edge G e /\
30634 (graph_inc G e v) ==>
30635 (?v'. (graph_inc G e v' /\ ~(v = v'))))`,
30639 TH_INTRO_TAC [`G`;`e`] graph_edge_end_select;
30643 TYPE_THEN `graph_inc G e HAS_SIZE 2` SUBGOAL_TAC;
30644 IMATCH_MP_TAC graph_edge2;
30646 REWRITE_TAC[has_size2];
30649 DISCH_THEN_FULL_REWRITE;
30650 RULE_ASSUM_TAC (REWRITE_RULE[in_pair]);
30651 REWRITE_TAC[in_pair];
30652 TYPE_THEN `(v'' = b)` ASM_CASES_TAC;
30654 DISCH_THEN_FULL_REWRITE;
30657 DISCH_THEN_FULL_REWRITE;
30661 DISCH_THEN_FULL_REWRITE;
30667 let graph_rad_pt_select = prove_by_refinement(
30668 `!G r e v. graph_hv_finite_radius G r /\ graph_inc G e v /\
30670 (?C u. (hv_finite C) /\ (simple_arc_end C v u) /\ (euclid 2 u) /\
30671 (d_euclid v u = r) /\ (C SUBSET e) /\ (C SUBSET (closed_ball(euclid 2,d_euclid) v r))) `,
30674 REWRITE_TAC[graph_hv_finite_radius];
30677 TH_INTRO_TAC [`e`;`{v}`;`(euclid 2 DIFF (open_ball(euclid 2,d_euclid) v r))`] simple_arc_end_restriction;
30680 RULE_ASSUM_TAC (REWRITE_RULE [good_plane_graph;plane_graph;SUBSET ]);
30682 FIRST_ASSUM IMATCH_MP_TAC ;
30685 TH_INTRO_TAC[`G`;`e`;`v`] graph_edge_end_select_other;
30686 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph]);
30691 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph]);
30693 IMATCH_MP_TAC simple_arc_end_end_closed;
30694 TYPE_THEN `e` EXISTS_TAC;
30695 TYPE_THEN `v'` EXISTS_TAC;
30696 FIRST_ASSUM IMATCH_MP_TAC ;
30700 TH_INTRO_TAC [`top2`;`open_ball(euclid 2,d_euclid) v r`] open_closed;
30701 REWRITE_TAC[top2_top];
30702 ASM_SIMP_TAC [top2;open_ball_open;metric_euclid;open_DEF ];
30703 REWRITE_TAC[top2_unions];
30706 REWRITE_TAC[INTER;DIFF;EQ_EMPTY;open_ball;INR IN_SING ];
30709 DISCH_THEN_FULL_REWRITE;
30712 TYPE_THEN `d_euclid v v = &0` SUBGOAL_TAC;
30713 IMATCH_MP_TAC metric_space_zero;
30714 TYPE_THEN `euclid 2` EXISTS_TAC;
30715 ASM_REWRITE_TAC[metric_euclid];
30716 DISCH_THEN_REWRITE;
30720 REWRITE_TAC[EMPTY_EXISTS];
30721 TYPE_THEN `v` EXISTS_TAC;
30722 REWRITE_TAC[INTER;INR IN_SING];
30723 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph]);
30725 UNDF `graph_inc G e = y`;
30726 DISCH_THEN (TH_INTRO_TAC [`e`]);
30728 DISCH_THEN_FULL_REWRITE;
30729 RULE_ASSUM_TAC (REWRITE_RULE[INTER]);
30732 REWRITE_TAC[EMPTY_EXISTS];
30733 TYPE_THEN `v'` EXISTS_TAC;
30734 REWRITE_TAC[INTER];
30736 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph]);
30738 UNDF `graph_inc G e = y`;
30739 DISCH_THEN (TH_INTRO_TAC [`e`]);
30741 DISCH_THEN_FULL_REWRITE;
30742 RULE_ASSUM_TAC (REWRITE_RULE[INTER]);
30747 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph;SUBSET]);
30749 FIRST_ASSUM IMATCH_MP_TAC ;
30750 TH_INTRO_TAC [`G`;`e`] graph_inc_subset;
30752 REWRITE_TAC[SUBSET];
30753 DISCH_THEN IMATCH_MP_TAC ;
30755 REWRITE_TAC[open_ball;DE_MORGAN_THM ];
30760 TYPE_THEN `!v. graph_inc G e v ==> graph_vertex G v` SUBGOAL_TAC;
30761 TH_INTRO_TAC [`G`;`e`] graph_inc_subset;
30762 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph;SUBSET]);
30764 REWRITE_TAC[SUBSET];
30767 TYPE_THEN `!v. graph_inc G e v ==> euclid 2 v` SUBGOAL_TAC;
30768 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph;SUBSET]);
30770 FIRST_ASSUM IMATCH_MP_TAC ;
30771 FIRST_ASSUM IMATCH_MP_TAC ;
30776 DISCH_THEN ( TH_INTRO_TAC [`v`;`v'`] );
30778 REWRITE_TAC[INTER;EMPTY_EXISTS];
30779 TYPE_THEN `v` EXISTS_TAC;
30780 REWRITE_TAC[closed_ball];
30781 TYPE_THEN `euclid 2 v` SUBGOAL_TAC;
30783 DISCH_THEN_REWRITE;
30784 TYPE_THEN `euclid 2 v'` SUBGOAL_TAC;
30786 DISCH_THEN_REWRITE;
30787 TYPE_THEN `d_euclid v v = &0` SUBGOAL_TAC;
30788 IMATCH_MP_TAC metric_space_zero;
30789 TYPE_THEN `euclid 2` EXISTS_TAC;
30790 ASM_MESON_TAC[metric_euclid];
30791 DISCH_THEN_REWRITE;
30794 TYPE_THEN `d_euclid v v' = d_euclid v' v` SUBGOAL_TAC;
30795 IMATCH_MP_TAC metric_space_symm;
30796 TYPE_THEN `euclid 2` EXISTS_TAC;
30797 ASM_MESON_TAC[metric_euclid];
30798 DISCH_THEN_REWRITE;
30802 TYPE_THEN `C'` EXISTS_TAC;
30803 TYPE_THEN `v''` EXISTS_TAC;
30805 TYPE_THEN `v' = v` SUBGOAL_TAC;
30807 REWRITE_TAC[INTER;eq_sing;INR IN_SING ];
30809 DISCH_THEN_FULL_REWRITE;
30812 TYPE_THEN `euclid 2 v''` SUBGOAL_TAC;
30813 FIRST_ASSUM MP_TAC;
30814 REWRITE_TAC[INTER;DIFF;eq_sing;];
30815 DISCH_THEN_REWRITE;
30819 TYPE_THEN `d_euclid v v'' = r` SUBGOAL_TAC;
30820 IMATCH_MP_TAC disk_endpoint_outer;
30821 TYPE_THEN `C'` EXISTS_TAC;
30822 TYPE_THEN `v` EXISTS_TAC;
30825 IMATCH_MP_TAC simple_arc_end_symm;
30827 TH_INTRO_TAC [`C'`] simple_arc_euclid;
30828 IMATCH_MP_TAC simple_arc_end_simple;
30830 REWRITE_TAC[SUBSET];
30831 DISCH_THEN IMATCH_MP_TAC ;
30833 MESON_TAC[simple_arc_end_end];
30837 TYPE_THEN `C' SUBSET closed_ball(euclid 2,d_euclid) v r` SUBGOAL_TAC;
30839 REWRITE_TAC[SUBSET;closed_ball;INTER;open_ball;DIFF;eq_sing;INR IN_SING];
30841 TYPE_THEN `!x. C' x ==> euclid 2 x` SUBGOAL_TAC;
30843 TH_INTRO_TAC[`C'`] simple_arc_euclid;
30844 IMATCH_MP_TAC simple_arc_end_simple;
30846 REWRITE_TAC[SUBSET];
30847 DISCH_THEN IMATCH_MP_TAC ;
30850 TYPE_THEN `C' v` SUBGOAL_TAC;
30852 REWRITE_TAC[INTER;INR IN_SING;eq_sing;];
30853 DISCH_THEN_REWRITE;
30856 FIRST_ASSUM IMATCH_MP_TAC ;
30859 FIRST_ASSUM IMATCH_MP_TAC ;
30861 TYPE_THEN `x = v''` ASM_CASES_TAC;
30863 DISCH_THEN_FULL_REWRITE;
30867 PROOF_BY_CONTR_TAC;
30870 FIRST_ASSUM IMATCH_MP_TAC ;
30873 FIRST_ASSUM IMATCH_MP_TAC ;
30875 DISCH_THEN_REWRITE;
30876 REWRITE_TAC[DE_MORGAN_THM];
30882 IMATCH_MP_TAC hv_finite_subset;
30883 TYPE_THEN `e INTER (closed_ball(euclid 2,d_euclid) v r)` EXISTS_TAC;
30885 FIRST_ASSUM IMATCH_MP_TAC ;
30887 REWRITE_TAC[SUBSET_INTER];
30889 (* Sun Aug 22 15:50:58 EDT 2004 *)
30895 (* not needed here *)
30896 let top_union = prove_by_refinement(
30897 `!A B U. topology_ U /\ U A /\ U (B:A->bool) ==> U(A UNION B)`,
30901 REWRITE_TAC[GSYM UNIONS_2];
30902 IMATCH_MP_TAC top_unions;
30903 ASM_REWRITE_TAC[in_pair; SUBSET;];
30908 let top_closed_unions = prove_by_refinement(
30909 `!(B:(A->bool)->bool) U.
30910 topology_ U /\ FINITE B /\ B SUBSET (closed_ U) ==>
30911 closed_ U(UNIONS B)`,
30914 TYPE_THEN `!n (B:(A->bool)->bool) U. (CARD B = n) /\ topology_ U /\ FINITE B /\ B SUBSET (closed_ U) ==> closed_ U(UNIONS B)` SUBGOAL_TAC;
30917 TYPE_THEN `B HAS_SIZE 0` SUBGOAL_TAC;
30918 ASM_REWRITE_TAC[HAS_SIZE];
30919 REWRITE_TAC[HAS_SIZE_0];
30920 DISCH_THEN_REWRITE;
30921 IMATCH_MP_TAC empty_closed;
30925 TYPE_THEN `~(B = EMPTY)` SUBGOAL_TAC;
30928 DISCH_THEN_FULL_REWRITE;
30930 REWRITE_TAC[CARD_CLAUSES];
30934 TH_INTRO_TAC [`B`] CARD_DELETE_CHOICE;
30939 RULE_ASSUM_TAC (REWRITE_RULE[SUC_INJ]);
30940 TYPEL_THEN [`(B DELETE CHOICE B)`;`U`] (USE 0 o ISPECL);
30942 DISCH_THEN (TH_INTRO_TAC []);
30943 ASM_REWRITE_TAC[FINITE_DELETE];
30945 REWRITE_TAC[SUBSET;DELETE];
30949 TYPE_THEN `closed_ U( UNIONS (B DELETE CHOICE B) UNION (CHOICE B))` SUBGOAL_TAC;
30950 IMATCH_MP_TAC closed_union;
30953 REWRITE_TAC[SUBSET];
30954 USEF `(~)` (MATCH_MP CHOICE_DEF);
30958 ASM_MESON_TAC[unions_delete_choice];
30963 let euclid2_d0 = prove_by_refinement(
30964 `!x. (euclid 2 x) ==> (d_euclid x x = &0)`,
30968 IMATCH_MP_TAC metric_space_zero;
30969 TYPE_THEN `euclid 2` EXISTS_TAC;
30970 ASM_REWRITE_TAC[metric_euclid];
30974 let union_imp_subset = prove_by_refinement(
30975 `!(Z1:A->bool) Z2 A. (Z1 UNION Z2 = A) ==>
30976 (Z1 SUBSET A /\ Z2 SUBSET A)`,
30979 SET_TAC[UNION;SUBSET];
30983 let loc_path_conn_top2 = prove_by_refinement(
30984 `loc_path_conn top2`,
30988 IMATCH_MP_TAC loc_path_conn_euclid;
30989 TYPE_THEN `2` EXISTS_TAC;
30990 MESON_TAC[metric_euclid;top_of_metric_top;top_of_metric_unions;top_univ];
30994 let connected_empty = prove_by_refinement(
30995 `!U. connected (U:(A->bool)->bool) EMPTY `,
30998 REWRITE_TAC[connected];
31002 let component_imp_connected = prove_by_refinement(
31003 `!U (x:A). (topology_ U) ==> (connected U (component U x))`,
31007 TYPE_THEN `~(UNIONS U x)` ASM_CASES_TAC;
31009 ASM_SIMP_TAC[GSYM component_empty];
31010 REWRITE_TAC[connected_empty];
31013 REWRITE_TAC[connected];
31015 REWRITE_TAC[SUBSET;connected;component];
31019 TYPE_THEN `component U x x` SUBGOAL_TAC;
31020 ASM_MESON_TAC[component_refl];
31023 TYPE_THEN `A x \/ B x` SUBGOAL_TAC;
31024 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET;UNION]);
31025 FIRST_ASSUM IMATCH_MP_TAC ;
31028 TYPE_THEN `!A B. component U x SUBSET A UNION B /\ (A INTER B = EMPTY) /\ U B /\ U A /\ A x ==> component U x SUBSET A` SUBGOAL_TAC;
31030 REWRITE_TAC[SUBSET];
31032 PROOF_BY_CONTR_TAC;
31033 TYPE_THEN `B' x'` SUBGOAL_TAC;
31034 USE 11 (REWRITE_RULE[SUBSET;UNION]);
31038 USE 12 (REWRITE_RULE[component]);
31040 TYPE_THEN `Z SUBSET (component U x)` SUBGOAL_TAC;
31041 IMATCH_MP_TAC connected_component;
31044 USE 16 (REWRITE_RULE[connected]);
31046 TYPEL_THEN[`A'`;`B'`] (USE 16 o ISPECL);
31049 TYPE_THEN `Z SUBSET A' UNION B'` SUBGOAL_TAC;
31050 IMATCH_MP_TAC SUBSET_TRANS;
31051 TYPE_THEN `component U x` EXISTS_TAC ;
31053 DISCH_THEN_REWRITE;
31054 REWRITE_TAC[DE_MORGAN_THM];
31055 REWRITE_TAC[SUBSET];
31059 USE 10 (REWRITE_RULE[INTER;EQ_EMPTY]);
31063 DISCH_THEN DISJ_CASES_TAC;
31064 TYPEL_THEN[`A`;`B`] (USE 7 o ISPECL);
31066 TYPEL_THEN [`B`;`A`] (USE 7 o ISPECL);
31069 FIRST_ASSUM IMATCH_MP_TAC ;
31070 ONCE_REWRITE_TAC[INTER_COMM];
31072 ONCE_REWRITE_TAC[UNION_COMM];
31077 let open_induced = prove_by_refinement(
31078 `!U (A:A->bool). (topology_ U) /\ U A ==>
31079 (induced_top U A = { B | U B /\ B SUBSET A })`,
31083 REWRITE_TAC[induced_top;IMAGE;];
31084 IMATCH_MP_TAC EQ_EXT;
31089 FIRST_ASSUM MP_TAC ;
31090 DISCH_THEN_FULL_REWRITE;
31092 IMATCH_MP_TAC top_inter;
31094 REWRITE_TAC[INTER;SUBSET];
31097 TYPE_THEN `x` EXISTS_TAC;
31100 SET_TAC [INTER;SUBSET];
31104 let connected_induced = prove_by_refinement(
31105 `!U (C:A->bool) . (topology_ U /\ U C ) ==>
31106 (connected U C = connected (induced_top U C) C)`,
31110 REWRITE_TAC[connected];
31111 ASM_SIMP_TAC[open_induced];
31115 IMATCH_MP_TAC sub_union;
31116 ASM_REWRITE_TAC[SUBSET_REFL ];
31118 TYPEL_THEN [`A`;`B`] (USE 2 o ISPECL);
31119 FIRST_ASSUM IMATCH_MP_TAC ;
31124 IMATCH_MP_TAC SUBSET_TRANS;
31125 TYPE_THEN `UNIONS {B | U B /\ B SUBSET C}` EXISTS_TAC;
31127 IMATCH_MP_TAC UNIONS_UNIONS;
31128 ONCE_REWRITE_TAC[SUBSET];
31133 TYPEL_THEN[`A INTER C`;`B INTER C`] (USE 2 o ISPECL);
31136 DISCH_THEN (TH_INTRO_TAC []);
31137 TYPE_THEN `!A'. (U A' ==> U (A' INTER C))` SUBGOAL_TAC;
31139 IMATCH_MP_TAC top_inter;
31142 REWRITE_TAC[GSYM CONJ_ASSOC];
31145 REWRITE_TAC[INTER_SUBSET];
31152 SET_TAC[SUBSET;UNION;INTER];
31153 SET_TAC[INTER;SUBSET];
31157 let connected_induced2 = prove_by_refinement(
31158 `!U (C:A->bool) Z. (topology_ U /\ U C /\ Z SUBSET (UNIONS U)) ==>
31159 (connected (induced_top U C) Z <=> (Z SUBSET C) /\ (connected U Z))`,
31163 REWRITE_TAC[connected];
31164 ASM_SIMP_TAC[open_induced];
31168 REWRITE_TAC[SUBSET];
31170 USE 4(REWRITE_RULE[SUBSET;UNIONS]);
31174 FIRST_ASSUM IMATCH_MP_TAC ;
31178 TYPEL_THEN [`A INTER C`;`B INTER C`] (USE 3 o ISPECL);
31181 DISCH_THEN (TH_INTRO_TAC []);
31182 TYPE_THEN `!A'. (U A' ==> U (A' INTER C))` SUBGOAL_TAC;
31184 IMATCH_MP_TAC top_inter;
31187 REWRITE_TAC[GSYM CONJ_ASSOC];
31190 REWRITE_TAC[INTER_SUBSET];
31198 SET_TAC[INTER;SUBSET;UNION];
31200 SET_TAC[INTER;SUBSET;UNION];
31205 REWRITE_TAC[SUBSET;UNIONS];
31210 TYPE_THEN `u INTER C` EXISTS_TAC;
31211 REWRITE_TAC[GSYM CONJ_ASSOC];
31213 IMATCH_MP_TAC top_inter;
31215 REWRITE_TAC[INTER];
31216 ASM_MESON_TAC[ISUBSET ];
31219 FIRST_ASSUM IMATCH_MP_TAC ;
31224 let connected_metric = prove_by_refinement(
31225 `!X d (C:A->bool). metric_space (X,d) /\ C SUBSET X /\
31226 (top_of_metric(X,d)C) ==>
31227 (connected(top_of_metric(X,d))C <=> connected(top_of_metric(C,d))C)`,
31231 TYPE_THEN `top_of_metric(C,d) = induced_top(top_of_metric(X,d))C` SUBGOAL_TAC;
31232 ASM_MESON_TAC[top_of_metric_induced];
31233 DISCH_THEN_REWRITE;
31234 IMATCH_MP_TAC connected_induced;
31235 ASM_MESON_TAC[top_of_metric_top];
31239 let connected_metric_pair = prove_by_refinement(
31240 `!(X:A->bool) Y Z d. metric_space (X,d) /\
31241 top_of_metric(X,d) Y /\ top_of_metric(X,d) Z /\
31243 (connected (top_of_metric(X,d)) Z = connected (top_of_metric(Y,d)) Z)`,
31248 TYPE_THEN `Y SUBSET X` SUBGOAL_TAC;
31249 USE 2(MATCH_MP sub_union);
31251 ASM_SIMP_TAC[GSYM top_of_metric_unions];
31254 TYPE_THEN `Z SUBSET X` SUBGOAL_TAC ;
31255 ASM_MESON_TAC[SUBSET_TRANS];
31257 ASM_SIMP_TAC[connected_metric];
31259 TYPE_THEN `metric_space (Y,d)` SUBGOAL_TAC;
31260 ASM_MESON_TAC[metric_subspace];
31263 TYPE_THEN `top_of_metric(Y,d) = induced_top(top_of_metric(X,d)) Y` SUBGOAL_TAC;
31264 ASM_MESON_TAC[top_of_metric_induced];
31266 TYPE_THEN `top_of_metric(Y,d) Z` SUBGOAL_TAC;
31268 ASM_SIMP_TAC[open_induced;top_of_metric_top];
31270 ASM_SIMP_TAC[connected_metric];
31274 let construct_hv_finite = prove_by_refinement(
31275 `!A C v v'. (top2 A) /\ (C SUBSET A) /\ (simple_arc_end C v v') ==>
31276 (?C'. C' SUBSET A /\ simple_arc_end C' v v' /\ hv_finite C')`,
31280 TYPE_THEN `A' = path_component(top_of_metric(A,d_euclid)) v` ABBREV_TAC ;
31281 TYPE_THEN `A' = component (top_of_metric(A,d_euclid)) v` SUBGOAL_TAC;
31284 IMATCH_MP_TAC loc_path_euclid_cor ;
31285 TYPE_THEN `2` EXISTS_TAC;
31286 ASM_REWRITE_TAC[GSYM top2];
31289 TYPE_THEN `A SUBSET (euclid 2)` SUBGOAL_TAC;
31290 USEF `top2` (MATCH_MP sub_union );
31291 RULE_ASSUM_TAC (REWRITE_RULE[top2_unions]);
31295 TYPE_THEN`UNIONS (top_of_metric(A,d_euclid)) = A` SUBGOAL_TAC;
31296 ASM_MESON_TAC [GSYM top_of_metric_unions;metric_euclid;metric_subspace];
31299 TYPE_THEN `A' SUBSET (UNIONS (top_of_metric(A,d_euclid)))` SUBGOAL_TAC;
31300 ASM_MESON_TAC[component_unions];
31304 TYPE_THEN `A' SUBSET (euclid 2)` SUBGOAL_TAC;
31305 IMATCH_MP_TAC SUBSET_TRANS;
31306 TYPE_THEN `A` EXISTS_TAC;
31310 ASSUME_TAC loc_path_conn_top2 ;
31312 TYPE_THEN `A v` SUBGOAL_TAC;
31313 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET]);
31315 DISCH_THEN IMATCH_MP_TAC ;
31317 MESON_TAC[simple_arc_end_end];
31320 TYPE_THEN `top_of_metric(A,d_euclid) = induced_top top2 A` SUBGOAL_TAC;
31323 SIMP_TAC [metric_euclid;top_of_metric_induced ];
31326 TYPE_THEN `top2 A'` SUBGOAL_TAC;
31329 DISCH_THEN_REWRITE;
31330 USE 9 (REWRITE_RULE[ loc_path_conn]);
31331 FIRST_ASSUM IMATCH_MP_TAC ;
31335 TYPE_THEN `~(v = v')` SUBGOAL_TAC;
31337 ASM_MESON_TAC[simple_arc_end_distinct];
31340 TYPE_THEN `connected (top_of_metric(A,d_euclid)) A'` SUBGOAL_TAC;
31342 IMATCH_MP_TAC component_imp_connected;
31343 ASM_MESON_TAC[top_of_metric_top;metric_subspace;metric_euclid];
31346 TYPE_THEN `connected (top_of_metric(euclid 2,d_euclid)) A'` SUBGOAL_TAC;
31347 TH_INTRO_TAC [`euclid 2`;`A`;`A'`;`d_euclid`] connected_metric_pair;
31348 ASM_MESON_TAC [metric_euclid;GSYM top2];
31349 DISCH_THEN_REWRITE;
31351 REWRITE_TAC[GSYM top2];
31354 TYPE_THEN `connected top2 C` SUBGOAL_TAC;
31355 IMATCH_MP_TAC simple_arc_connected;
31356 IMATCH_MP_TAC simple_arc_end_simple;
31360 TYPE_THEN `C SUBSET A'` SUBGOAL_TAC;
31362 IMATCH_MP_TAC connected_component;
31363 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\a`);
31366 MESON_TAC[simple_arc_end_end];
31367 TH_INTRO_TAC[`top2`;`A`;`C`] connected_induced2;
31368 REWRITE_TAC[top2_top;top2_unions];
31370 ASM_MESON_TAC[SUBSET_TRANS];
31374 TYPE_THEN `C v /\ C v'` SUBGOAL_TAC;
31376 MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
31378 TYPE_THEN `A' v /\ A' v'` SUBGOAL_TAC;
31379 ASM_MESON_TAC[ISUBSET];
31382 TH_INTRO_TAC[`A'`;`v`;`v'`] p_conn_conn;
31385 TH_INTRO_TAC[`A'`;`v`;`v'`] p_conn_hv_finite;
31387 DISCH_THEN_FULL_REWRITE;
31389 TYPE_THEN `C'` EXISTS_TAC;
31391 IMATCH_MP_TAC SUBSET_TRANS;
31392 TYPE_THEN `A'` EXISTS_TAC;
31397 let graph_rad_pt_center_piece = prove_by_refinement(
31399 graph_hv_finite_radius G r /\ graph_inc G e v /\
31400 FINITE(graph_edge G) /\ FINITE(graph_vertex G) /\
31401 graph_edge G e /\ graph_inc G e v' /\ ~(v = v') ==>
31402 (? Cv u Cv' u' C''.
31403 (hv_finite Cv /\ hv_finite Cv' /\ (hv_finite C'') /\
31404 ~(graph_vertex G u) /\
31405 ~(graph_vertex G u') /\
31406 simple_arc_end Cv v u /\
31407 simple_arc_end Cv' v' u' /\
31408 simple_arc_end C'' u u' /\
31409 ~C'' v /\ ~C'' v' /\
31410 (euclid 2 u) /\ (euclid 2 u') /\
31411 (d_euclid v u = r) /\ (d_euclid v' u' = r) /\
31412 (Cv SUBSET e) /\ (Cv' SUBSET e) /\
31413 (Cv SUBSET (closed_ball(euclid 2,d_euclid) v r)) /\
31414 (Cv' SUBSET (closed_ball(euclid 2,d_euclid) v' r)) /\
31415 (!e'. (graph_edge G e') /\ ~(e = e') ==> (C'' INTER e' = EMPTY)) /\
31416 (!v''. graph_vertex G v'' /\ ~(graph_inc G e v'') ==>
31417 (C'' INTER (closed_ball(euclid 2,d_euclid) v'' r) = EMPTY))
31422 TH_INTRO_TAC [`G`;`r`;`e`;`v`] graph_rad_pt_select;
31425 TYPE_THEN `Cv = C` ABBREV_TAC ;
31427 TYPE_THEN `Cv` EXISTS_TAC;
31428 TYPE_THEN `u` EXISTS_TAC;
31430 TH_INTRO_TAC [`G`;`r`;`e`;`v'`] graph_rad_pt_select;
31433 TYPE_THEN `Cv' = C'` ABBREV_TAC ;
31435 TYPE_THEN `Cv'` EXISTS_TAC;
31436 TYPE_THEN `u'` EXISTS_TAC;
31439 TYPE_THEN `!v''. graph_vertex G v'' ==> (euclid 2 v'')` SUBGOAL_TAC;
31440 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph;SUBSET ]);
31442 FIRST_ASSUM IMATCH_MP_TAC ;
31446 TYPE_THEN `!v''. graph_inc G e v'' ==> graph_vertex G v''` SUBGOAL_TAC;
31448 TH_INTRO_TAC [`G`;`e`] graph_inc_subset;
31449 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph;]);
31450 ASM_REWRITE_TAC[SUBSET ];
31451 FIRST_ASSUM MP_TAC;
31452 MESON_TAC[ISUBSET];
31455 TYPE_THEN `D = (\ v. (closed_ball(euclid 2,d_euclid) v r))` ABBREV_TAC ;
31456 TYPE_THEN `B = (UNIONS { e' | graph_edge G e' /\ ~(e' = e)})` ABBREV_TAC ;
31457 TYPE_THEN `B' = (UNIONS { DD | ?v''. (graph_vertex G v'' /\ (DD = D v'') /\ ~(graph_inc G e v''))})` ABBREV_TAC ;
31458 TYPE_THEN `B'' = {v, v'}` ABBREV_TAC ;
31459 TYPE_THEN `A = (euclid 2 DIFF (B UNION B' UNION B''))` ABBREV_TAC ;
31460 TYPE_THEN `top2 A` SUBGOAL_TAC;
31461 TH_INTRO_TAC [`top2`;`B UNION B' UNION B''`] closed_open;
31462 IMATCH_MP_TAC closed_union;
31463 REWRITE_TAC[top2_top];
31468 IMATCH_MP_TAC top_closed_unions;
31469 REWRITE_TAC[top2_top;SUBSET;];
31471 IMATCH_MP_TAC FINITE_SUBSET;
31472 TYPE_THEN `graph_edge G` EXISTS_TAC ;
31473 ASM_REWRITE_TAC[SUBSET];
31475 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph;]);
31477 IMATCH_MP_TAC simple_arc_end_closed;
31478 TH_INTRO_TAC [`G`;`x`] graph_edge_end_select;
31483 IMATCH_MP_TAC closed_union;
31484 REWRITE_TAC[top2_top];
31486 IMATCH_MP_TAC top_closed_unions;
31487 REWRITE_TAC[top2_top];
31489 TYPE_THEN `{DD | ?v''. graph_vertex G v'' /\ (DD = D v'') /\ ~graph_inc G e v''} = IMAGE D { v'' | graph_vertex G v'' /\ ~graph_inc G e v''}` SUBGOAL_TAC;
31490 REWRITE_TAC[IMAGE];
31491 IMATCH_MP_TAC EQ_EXT;
31495 DISCH_THEN_REWRITE;
31496 IMATCH_MP_TAC FINITE_IMAGE;
31497 IMATCH_MP_TAC FINITE_SUBSET;
31498 TYPE_THEN `graph_vertex G` EXISTS_TAC;
31499 ASM_REWRITE_TAC[SUBSET ];
31501 REWRITE_TAC[SUBSET];
31504 DISCH_THEN_FULL_REWRITE;
31507 IMATCH_MP_TAC closed_ball_closed;
31508 REWRITE_TAC[metric_euclid];
31510 TYPE_THEN `{v,v'} = {v} UNION {v'}` SUBGOAL_TAC;
31511 IMATCH_MP_TAC EQ_EXT;
31512 REWRITE_TAC[in_pair;UNION;INR IN_SING];
31514 DISCH_THEN_REWRITE;
31515 IMATCH_MP_TAC closed_union;
31516 REWRITE_TAC[top2_top];
31517 TYPE_THEN `graph_inc G e v` (FIND_ASSUM MP_TAC);
31518 TYPE_THEN `graph_inc G e v'` (FIND_ASSUM MP_TAC);
31519 ASM_MESON_TAC[closed_point];
31520 REWRITE_TAC[open_DEF;top2_unions];
31522 DISCH_THEN_REWRITE;
31525 TYPE_THEN `!u'' v''. graph_vertex G v'' /\ (d_euclid v'' u'' = r) ==> ~(graph_vertex G u'')` SUBGOAL_TAC;
31527 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
31529 TYPEL_THEN [`u''`;`v''`] (USE 31 o ISPECL);
31530 TYPE_THEN `~(u'' = v'')` SUBGOAL_TAC;
31533 DISCH_THEN_FULL_REWRITE;
31534 TYPE_THEN `d_euclid v'' v'' = &0` SUBGOAL_TAC;
31535 IMATCH_MP_TAC metric_space_zero;
31536 TYPE_THEN `euclid 2` EXISTS_TAC;
31537 ASM_REWRITE_TAC[metric_euclid];
31538 FIRST_ASSUM IMATCH_MP_TAC ;
31540 DISCH_THEN_FULL_REWRITE;
31545 UNDF `(graph_vertex)`;
31546 ASM_REWRITE_TAC[EMPTY_EXISTS ;INTER ;closed_ball ;];
31547 TYPE_THEN `u''` EXISTS_TAC;
31549 TYPE_THEN `d_euclid u'' u'' = &0` SUBGOAL_TAC;
31550 IMATCH_MP_TAC metric_space_zero;
31551 TYPE_THEN `euclid 2` EXISTS_TAC;
31552 ASM_REWRITE_TAC[metric_euclid];
31553 FIRST_ASSUM IMATCH_MP_TAC ;
31555 DISCH_THEN_REWRITE;
31556 TYPE_THEN `euclid 2 u'' ` SUBGOAL_TAC;
31557 FIRST_ASSUM IMATCH_MP_TAC ;
31559 DISCH_THEN_REWRITE;
31560 TYPE_THEN `euclid 2 v'' ` SUBGOAL_TAC;
31561 FIRST_ASSUM IMATCH_MP_TAC ;
31563 DISCH_THEN_REWRITE;
31568 TYPE_THEN `~graph_vertex G u` SUBGOAL_TAC;
31569 FIRST_ASSUM IMATCH_MP_TAC ;
31570 TYPE_THEN `v` EXISTS_TAC;
31572 FIRST_ASSUM IMATCH_MP_TAC ;
31577 TYPE_THEN `~graph_vertex G u'` SUBGOAL_TAC;
31578 FIRST_ASSUM IMATCH_MP_TAC ;
31579 TYPE_THEN `v'` EXISTS_TAC;
31581 FIRST_ASSUM IMATCH_MP_TAC ;
31586 TYPE_THEN `!(X:A->bool) Y Z. (X UNION Y = Z) ==> (X SUBSET Z)` SUBGOAL_TAC;
31587 SET_TAC[UNION;SUBSET];
31590 TYPE_THEN `simple_arc_end e v v'` SUBGOAL_TAC;
31591 RULE_ASSUM_TAC (REWRITE_RULE [graph_hv_finite_radius;good_plane_graph]);
31593 FIRST_ASSUM IMATCH_MP_TAC ;
31597 TYPE_THEN `graph_vertex G v` SUBGOAL_TAC;
31598 FIRST_ASSUM IMATCH_MP_TAC ;
31601 TYPE_THEN `graph_vertex G v'` SUBGOAL_TAC;
31602 FIRST_ASSUM IMATCH_MP_TAC ;
31606 TYPE_THEN `~D v u'` SUBGOAL_TAC;
31608 PROOF_BY_CONTR_TAC;
31609 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;]);
31611 GRABF `~(v = v')` (TH_INTRO_TAC [`v`;`v'`]);
31613 REWRITE_TAC[EMPTY_EXISTS];
31614 TYPE_THEN `u'` EXISTS_TAC;
31615 ASM_REWRITE_TAC[INTER];
31616 ASM_REWRITE_TAC[closed_ball];
31618 FIRST_ASSUM IMATCH_MP_TAC ;
31623 TYPE_THEN `~(v = u) /\ ~(v = u')` SUBGOAL_TAC;
31627 DISCH_THEN_FULL_REWRITE;
31628 TH_INTRO_TAC[`u`] euclid2_d0;
31630 DISCH_THEN_FULL_REWRITE;
31631 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
31638 DISCH_THEN_FULL_REWRITE;
31641 REWRITE_TAC[closed_ball];
31643 TH_INTRO_TAC [`u'`] euclid2_d0;
31645 DISCH_THEN_FULL_REWRITE;
31646 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
31652 TYPE_THEN `~(v' = u') ` SUBGOAL_TAC;
31655 DISCH_THEN_FULL_REWRITE;
31656 TH_INTRO_TAC[`u'`] euclid2_d0;
31658 DISCH_THEN_FULL_REWRITE;
31659 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
31666 TH_INTRO_TAC [`e`;`v`;`v'`;`u'`] simple_arc_end_cut;
31668 TYPE_THEN `Cv' u'` SUBGOAL_TAC;
31669 TYPE_THEN `simple_arc_end Cv' v' u'` (FIND_ASSUM MP_TAC );
31670 MESON_TAC[simple_arc_end_end2];
31671 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET]);
31674 TYPE_THEN `Cvu' = C''` ABBREV_TAC ;
31675 POP_ASSUM (fun t-> ALL_TAC);
31676 TYPE_THEN `Cu'v' = C'''` ABBREV_TAC ;
31677 POP_ASSUM (fun t -> ALL_TAC);
31678 TYPE_THEN `Cu'v' v'` SUBGOAL_TAC;
31679 TYPE_THEN `simple_arc_end Cu'v' u' v'` (FIND_ASSUM MP_TAC );
31680 MESON_TAC[simple_arc_end_end2];
31682 TYPE_THEN `~Cvu' v'` SUBGOAL_TAC;
31684 USEF `(INTER)` (REWRITE_RULE[FUN_EQ_THM]);
31686 RULE_ASSUM_TAC (REWRITE_RULE[INTER;eq_sing ;INR IN_SING]);
31691 TYPE_THEN `~D v' u` SUBGOAL_TAC;
31694 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;]);
31696 GRABF `~(v' = v)` (TH_INTRO_TAC [`v'`;`v`]);
31698 REWRITE_TAC[EMPTY_EXISTS];
31699 TYPE_THEN `u` EXISTS_TAC;
31700 ASM_REWRITE_TAC[INTER];
31701 ASM_REWRITE_TAC[closed_ball];
31703 FIRST_ASSUM IMATCH_MP_TAC ;
31708 TYPE_THEN `Cvu' u \/ Cu'v' u` SUBGOAL_TAC;
31709 USE 35 (REWRITE_RULE[FUN_EQ_THM;]);
31711 USE 35 (REWRITE_RULE[UNION]);
31713 USE 8(REWRITE_RULE[SUBSET]);
31714 FIRST_ASSUM IMATCH_MP_TAC ;
31716 MESON_TAC[simple_arc_end_end2];
31719 USE 35 (MATCH_MP union_imp_subset);
31720 TYPE_THEN `Cu'v' = Cv'` SUBGOAL_TAC;
31721 TH_INTRO_TAC [`Cu'v'`;`Cv'`;`e`;`v'`;`u'`] simple_arc_end_inj;
31724 IMATCH_MP_TAC simple_arc_end_symm;
31726 IMATCH_MP_TAC simple_arc_end_simple;
31728 DISCH_THEN_REWRITE;
31729 DISCH_THEN_FULL_REWRITE;
31731 TYPE_THEN `~Cv' u` SUBGOAL_TAC;
31736 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET]);
31737 FIRST_ASSUM IMATCH_MP_TAC ;
31742 TYPE_THEN `~(u = u')` SUBGOAL_TAC;
31745 DISCH_THEN_FULL_REWRITE;
31746 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
31748 GRABF `~(v=v')` (TH_INTRO_TAC[`v`;`v'`]);
31750 REWRITE_TAC[EMPTY_EXISTS];
31751 TYPE_THEN `u'` EXISTS_TAC;
31752 REWRITE_TAC[INTER;closed_ball];
31754 REWRITE_TAC[REAL_ARITH `r <= r`];
31756 FIRST_ASSUM IMATCH_MP_TAC ;
31758 FIRST_ASSUM IMATCH_MP_TAC ;
31762 TH_INTRO_TAC[`Cvu'`;`v`;`u'`;`u`] simple_arc_end_cut;
31765 TYPE_THEN `CC = C'''''` ABBREV_TAC ;
31766 POP_ASSUM (fun t->ALL_TAC);
31768 TYPE_THEN `~CC v` SUBGOAL_TAC;
31770 TYPE_THEN `C'''' v` SUBGOAL_TAC;
31772 MESON_TAC[simple_arc_end_end];
31774 TYPE_THEN `v = u` SUBGOAL_TAC;
31776 REWRITE_TAC[INTER;eq_sing;INR IN_SING];
31778 FIRST_ASSUM IMATCH_MP_TAC ;
31780 DISCH_THEN_FULL_REWRITE;
31784 TYPE_THEN `~CC v'` SUBGOAL_TAC;
31786 USE 35 (MATCH_MP union_imp_subset);
31789 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET]);
31791 FIRST_ASSUM IMATCH_MP_TAC ;
31795 TYPE_THEN `CC SUBSET A` SUBGOAL_TAC;
31797 REWRITE_TAC[DIFF_SUBSET];
31799 IMATCH_MP_TAC simple_arc_euclid;
31800 IMATCH_MP_TAC simple_arc_end_simple;
31803 PROOF_BY_CONTR_TAC;
31804 USE 55 (MATCH_MP inter_union);
31805 FIRST_ASSUM MP_TAC;
31807 REWRITE_TAC[DE_MORGAN_THM];
31808 TYPE_THEN `CC SUBSET e` SUBGOAL_TAC;
31809 USE 35 (MATCH_MP union_imp_subset);
31810 IMATCH_MP_TAC SUBSET_TRANS;
31811 TYPE_THEN `Cvu'` EXISTS_TAC;
31813 REWRITE_TAC[SUBSET];
31818 REWRITE_TAC[INTER;UNIONS;EQ_EMPTY ];
31820 TYPE_THEN `e x` SUBGOAL_TAC;
31821 FIRST_ASSUM IMATCH_MP_TAC ;
31824 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
31825 REP_BASIC_TAC ; (* we are up to 69 in the hypothesis stack *)
31826 TYPEL_THEN [`e`;`u''`] (USE 66 o ISPECL);
31828 TYPE_THEN `graph_vertex G x` SUBGOAL_TAC;
31829 USE 66 (REWRITE_RULE[SUBSET]);
31830 FIRST_ASSUM IMATCH_MP_TAC ;
31831 REWRITE_TAC[INTER];
31835 TYPE_THEN `graph_inc G e HAS_SIZE 2` SUBGOAL_TAC;
31836 IMATCH_MP_TAC graph_edge2;
31838 TYPE_THEN `graph_inc G e x` SUBGOAL_TAC;
31840 ASM_REWRITE_TAC[INTER];
31842 TH_INTRO_TAC [`graph_inc G e`;`v`;`x`;`v'`] two_exclusion;
31851 PROOF_BY_CONTR_TAC;
31852 USE 57 (MATCH_MP inter_union);
31854 REWRITE_TAC[DE_MORGAN_THM];
31857 REWRITE_TAC[INTER;UNIONS;];
31858 REWRITE_TAC [EQ_EMPTY];
31860 UNDF `u''' = D v''` ;
31861 DISCH_THEN_FULL_REWRITE;
31862 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
31864 TYPEL_THEN [`e`;`v''`] (USE 59 o ISPECL);
31867 REWRITE_TAC[EMPTY_EXISTS];
31868 TYPE_THEN `x` EXISTS_TAC;
31869 REWRITE_TAC[INTER];
31871 FIRST_ASSUM IMATCH_MP_TAC ;
31875 DISCH_THEN_REWRITE;
31878 REWRITE_TAC[INTER;EQ_EMPTY;in_pair];
31882 TH_INTRO_TAC[`A`;`CC`;`u`;`u'`] construct_hv_finite;
31885 TYPE_THEN `Chv = C''''''` ABBREV_TAC ;
31887 TYPE_THEN `Chv` EXISTS_TAC;
31890 TYPE_THEN `~(A v) /\ ~(A v')` SUBGOAL_TAC;
31893 REWRITE_TAC[DIFF;UNION;in_pair];
31895 TYPE_THEN `~(Chv v) /\ ~(Chv v')` SUBGOAL_TAC;
31898 MESON_TAC[ISUBSET];
31899 DISCH_THEN_REWRITE;
31901 TYPE_THEN `(!e'. ~(e = e') /\ (graph_edge G e') ==> (A INTER e' = {}))` SUBGOAL_TAC;
31905 REWRITE_TAC[EQ_EMPTY;INTER;DIFF;UNION;UNIONS ];
31920 REWRITE_TAC[EQ_EMPTY;INTER;SUBSET;];
31923 TYPE_THEN `!v''. graph_vertex G v'' /\ ~graph_inc G e v'' ==> (A INTER closed_ball (euclid 2,d_euclid) v'' r = {})` SUBGOAL_TAC;
31928 REWRITE_TAC[EQ_EMPTY;INTER;DIFF;UNION;UNIONS;];
31935 CONV_TAC (dropq_conv "u");
31936 TYPE_THEN `v''` EXISTS_TAC;
31943 REWRITE_TAC[EQ_EMPTY;INTER;SUBSET;];
31945 (* Wed Aug 25 14:58:37 EDT 2004 *)
31951 let planar_graph_hv = prove_by_refinement(
31952 `!(G:(A,B)graph_t). (planar_graph G) /\
31953 FINITE (graph_edge G) /\
31954 FINITE (graph_vertex G) /\
31955 ~(graph_edge G = {}) /\
31956 (!v. CARD (graph_edge_around G v) <=| 4)
31957 ==> (?H. graph_isomorphic G H /\
31958 good_plane_graph H /\ (!e. graph_edge H e ==>
31963 TH_INTRO_TAC[`G`] graph_radius_exists;
31967 TYPE_THEN `X = { K | graph_isomorphic H K /\ graph_hv_finite_radius K r}` ABBREV_TAC ;
31968 TYPE_THEN `c = (\ (K:(num->real,(num->real)->bool)graph_t). CARD {x | graph_edge K x /\ ~hv_finite x})` ABBREV_TAC ;
31969 TYPE_THEN `D = (\ v. (closed_ball(euclid 2,d_euclid) v r))` ABBREV_TAC ;
31970 TH_INTRO_TAC[`X`;`c`] select_image_num_min;
31971 REWRITE_TAC[EMPTY_EXISTS];
31972 TYPE_THEN `H` EXISTS_TAC;
31975 ASM_REWRITE_TAC[graph_isomorphic_refl];
31977 TYPE_THEN `K = z` ABBREV_TAC ;
31979 TYPE_THEN `K` EXISTS_TAC;
31984 ASM_MESON_TAC[graph_isomorphic_trans];
31986 TYPE_THEN `graph_hv_finite_radius K r` SUBGOAL_TAC;
31990 DISCH_THEN_REWRITE;
31995 REWRITE_TAC[graph_hv_finite_radius];
31996 DISCH_THEN_REWRITE;
31998 PROOF_BY_CONTR_TAC;
32000 TH_INTRO_TAC[`K`;`e`] graph_edge_end_select;
32003 REWRITE_TAC[graph_hv_finite_radius;good_plane_graph;plane_graph];
32004 DISCH_THEN_REWRITE;
32007 TYPE_THEN `graph_isomorphic G K` SUBGOAL_TAC;
32008 TH_INTRO_TAC[`G`;`H`;`K`] graph_isomorphic_trans;
32013 DISCH_THEN_REWRITE;
32014 DISCH_THEN_REWRITE;
32017 TYPE_THEN `FINITE (graph_edge K)` SUBGOAL_TAC;
32018 USE 18(REWRITE_RULE[graph_isomorphic;graph_iso]);
32022 MESON_TAC[FINITE_BIJ];
32025 TYPE_THEN `~(? e' . (~graph_edge K e') /\ hv_finite e' /\ simple_arc_end e' v v' /\ (e INTER (graph_vertex K) = (e' INTER (graph_vertex K))) /\ (!v. graph_vertex K v /\ ~e' v ==> (e' INTER closed_ball (euclid 2,d_euclid) v r = {})) /\ (!e''. graph_edge K e'' /\ ~(e'' = e) ==> e' INTER e'' SUBSET e INTER e''))` SUBGOAL_TAC;
32029 TH_INTRO_TAC[`K`;`e`;`e'`] graph_replace_card;
32031 TYPE_THEN `K' = graph_replace K e e'` ABBREV_TAC ;
32033 TYPE_THEN `graph_isomorphic H K'` SUBGOAL_TAC;
32037 TH_INTRO_TAC[`H`;`K`;`K'`] graph_isomorphic_trans;
32042 DISCH_THEN_REWRITE;
32044 IMATCH_MP_TAC graph_replace_iso;
32047 DISCH_THEN_REWRITE;
32050 TYPE_THEN `plane_graph K'` SUBGOAL_TAC;
32052 IMATCH_MP_TAC graph_replace_plane;
32055 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph]);
32057 IMATCH_MP_TAC simple_arc_end_simple;
32061 TYPE_THEN `good_plane_graph K'` SUBGOAL_TAC;
32063 IMATCH_MP_TAC good_replace;
32066 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
32069 TYPE_THEN `e v'' /\ e v'''` SUBGOAL_TAC;
32070 USE 22 (REWRITE_RULE[FUN_EQ_THM]);
32071 TYPE_THEN `v''` (WITH 22 o ISPEC);
32072 TYPE_THEN `v'''` (USE 22 o ISPEC);
32073 RULE_ASSUM_TAC (REWRITE_RULE[INTER]);
32078 DISCH_THEN_REWRITE;
32079 DISCH_THEN_REWRITE;
32083 TYPE_THEN `graph_inc K e = {v,v'}` SUBGOAL_TAC;
32084 IMATCH_MP_TAC graph_vertex_exhaust;
32086 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
32089 TYPE_THEN `graph_inc K e = {v'',v'''}` SUBGOAL_TAC;
32090 IMATCH_MP_TAC graph_vertex_exhaust;
32093 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
32098 ASM_REWRITE_TAC[INTER];
32099 DISCH_THEN_FULL_REWRITE;
32100 TYPE_THEN `((v'' = v) /\ (v''' = v')) \/ ((v'' = v') /\ (v''' = v))` SUBGOAL_TAC;
32101 USE 37 (REWRITE_RULE[FUN_EQ_THM]);
32102 TYPE_THEN `v''` (WITH 37 o ISPEC);
32103 TYPE_THEN `v'''` (USE 37 o ISPEC);
32106 REWRITE_TAC[in_pair];
32110 DISCH_THEN DISJ_CASES_TAC;
32114 IMATCH_MP_TAC simple_arc_end_symm;
32118 TYPE_THEN `graph_hv_finite_radius K' r` SUBGOAL_TAC;
32120 IMATCH_MP_TAC graph_replace_hv_finite_radius;
32123 TYPE_THEN `X K'` SUBGOAL_TAC;
32132 (**** Changed by JRH; the new ARITH_TAC doesn't accept alpha-equivs (maybe)
32135 REWRITE_TAC[NOT_IMP; NOT_LE];
32138 TH_INTRO_TAC [`K`;`r`;`e`;`v`;`v'`] graph_rad_pt_center_piece;
32140 USE 18 (REWRITE_RULE[graph_isomorphic;graph_iso]);
32144 MESON_TAC[FINITE_BIJ];
32159 TYPE_THEN `graph_inc K e = {v,v'}` SUBGOAL_TAC;
32160 IMATCH_MP_TAC graph_vertex_exhaust;
32162 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
32166 TYPE_THEN `e INTER graph_vertex K = {v,v'}` SUBGOAL_TAC;
32167 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
32172 DISCH_THEN_REWRITE;
32174 TYPE_THEN `!e v. graph_edge K e /\ graph_inc K e v ==> graph_vertex K v` SUBGOAL_TAC;
32176 TH_INTRO_TAC[`K`;`e'`] graph_inc_subset;
32177 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
32179 REWRITE_TAC[SUBSET];
32180 DISCH_THEN IMATCH_MP_TAC ;
32184 TYPE_THEN `p_conn (Cv UNION Cv' UNION C'') v v'` SUBGOAL_TAC;
32185 IMATCH_MP_TAC pconn_trans;
32186 TYPE_THEN `u` EXISTS_TAC;
32188 TH_INTRO_TAC[`Cv UNION Cv' UNION C''`;`v`;`u`] p_conn_hv_finite;
32189 IMATCH_MP_TAC simple_arc_end_distinct;
32191 DISCH_THEN_REWRITE;
32192 TYPE_THEN `Cv` EXISTS_TAC;
32193 ASM_REWRITE_TAC[SUBSET;UNION];
32195 IMATCH_MP_TAC pconn_trans;
32196 TYPE_THEN `u'` EXISTS_TAC;
32198 TH_INTRO_TAC[`Cv UNION Cv' UNION C''`;`u`;`u'`] p_conn_hv_finite;
32199 IMATCH_MP_TAC simple_arc_end_distinct;
32201 DISCH_THEN_REWRITE;
32202 TYPE_THEN `C''` EXISTS_TAC;
32203 ASM_REWRITE_TAC[SUBSET;UNION];
32205 TH_INTRO_TAC[`Cv UNION Cv' UNION C''`;`u'`;`v'`] p_conn_hv_finite;
32206 IMATCH_MP_TAC simple_arc_end_distinct;
32207 TYPE_THEN `Cv'` EXISTS_TAC;
32208 IMATCH_MP_TAC simple_arc_end_symm;
32210 DISCH_THEN_REWRITE;
32211 TYPE_THEN `Cv'` EXISTS_TAC;
32212 ASM_REWRITE_TAC[SUBSET;UNION];
32215 IMATCH_MP_TAC simple_arc_end_symm;
32219 TH_INTRO_TAC[`Cv UNION Cv' UNION C''`;`v`;`v'`] p_conn_hv_finite;
32223 TYPE_THEN `C` EXISTS_TAC;
32225 (* D final constraints *)
32226 TYPE_THEN`graph K` SUBGOAL_TAC;
32227 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
32231 TYPE_THEN `!e v. graph_edge K e /\ graph_inc K e v ==> graph_vertex K v` SUBGOAL_TAC;
32233 TH_INTRO_TAC[`K`;`e'`]graph_inc_subset;
32235 REWRITE_TAC[SUBSET];
32236 DISCH_THEN IMATCH_MP_TAC ;
32242 TYPE_THEN `C = e` ASM_CASES_TAC;
32246 TYPE_THEN `C SUBSET Cv UNION Cv'` SUBGOAL_TAC;
32249 REWRITE_TAC[SUBSET;UNION;EQ_EMPTY;INTER ];
32252 TYPE_THEN `D v INTER D v' = EMPTY ` SUBGOAL_TAC;
32254 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
32257 DISCH_THEN IMATCH_MP_TAC ;
32260 FIRST_ASSUM IMATCH_MP_TAC ;
32262 FIRST_ASSUM IMATCH_MP_TAC ;
32268 IMATCH_MP_TAC simple_arc_end_inj;
32269 TYPE_THEN `e` EXISTS_TAC;
32270 TYPE_THEN `v` EXISTS_TAC;
32271 TYPE_THEN `v'` EXISTS_TAC;
32272 ASM_REWRITE_TAC[SUBSET_REFL];
32274 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph]);
32276 FIRST_ASSUM IMATCH_MP_TAC ;
32280 IMATCH_MP_TAC simple_arc_end_simple;
32282 IMATCH_MP_TAC SUBSET_TRANS;
32283 TYPE_THEN `Cv UNION Cv'` EXISTS_TAC;
32284 ASM_REWRITE_TAC[union_subset ];
32287 IMATCH_MP_TAC EQ_EXT;
32288 REWRITE_TAC[in_pair;INTER ];
32291 DISCH_THEN DISJ_CASES_TAC;
32293 DISCH_THEN_FULL_REWRITE;
32296 MESON_TAC[simple_arc_end_end2];
32297 FIRST_ASSUM IMATCH_MP_TAC ;
32300 DISCH_THEN_FULL_REWRITE;
32303 MESON_TAC[simple_arc_end_end];
32304 FIRST_ASSUM IMATCH_MP_TAC ;
32307 TYPE_THEN `graph_inc K e x` ASM_CASES_TAC;
32309 RULE_ASSUM_TAC (REWRITE_RULE[in_pair]);
32311 USE 4 (REWRITE_RULE[SUBSET ]);
32315 USE 4(REWRITE_RULE[UNION]);
32319 PROOF_BY_CONTR_TAC;
32320 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
32323 DISCH_THEN (TH_INTRO_TAC[`v`;`x`]);
32325 FIRST_ASSUM IMATCH_MP_TAC ;
32327 REWRITE_TAC[EMPTY_EXISTS];
32328 TYPE_THEN `x` EXISTS_TAC;
32329 REWRITE_TAC[INTER];
32333 REWRITE_TAC[SUBSET];
32335 REWRITE_TAC[closed_ball2_center];
32336 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph]);
32339 USEF `X SUBSET euclid 2` (REWRITE_RULE[SUBSET]);
32340 FIRST_ASSUM IMATCH_MP_TAC ;
32346 PROOF_BY_CONTR_TAC;
32347 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
32350 DISCH_THEN (TH_INTRO_TAC[`v'`;`x`]);
32352 FIRST_ASSUM IMATCH_MP_TAC ;
32354 REWRITE_TAC[EMPTY_EXISTS];
32355 TYPE_THEN `x` EXISTS_TAC;
32356 REWRITE_TAC[INTER];
32360 REWRITE_TAC[SUBSET];
32362 REWRITE_TAC[closed_ball2_center];
32363 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph]);
32366 USEF `X SUBSET euclid 2` (REWRITE_RULE[SUBSET]);
32367 FIRST_ASSUM IMATCH_MP_TAC ;
32372 TYPE_THEN `graph_inc K e x` ASM_CASES_TAC;
32376 PROOF_BY_CONTR_TAC;
32378 REWRITE_TAC[EMPTY_EXISTS];
32379 TYPE_THEN `x` EXISTS_TAC;
32380 ASM_REWRITE_TAC[INTER;closed_ball2_center];
32381 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius;good_plane_graph;plane_graph]);
32383 USEF `X SUBSET euclid 2` (REWRITE_RULE[SUBSET]);
32385 FIRST_ASSUM IMATCH_MP_TAC ;
32405 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
32408 REWRITE_TAC[SUBSET;INTER];
32410 USEF `(SUBSET)` (REWRITE_RULE[SUBSET]);
32414 REWRITE_TAC[UNION];
32416 ASM_MESON_TAC[ISUBSET];
32417 ASM_MESON_TAC[ISUBSET];
32418 PROOF_BY_CONTR_TAC;
32420 DISCH_THEN (TH_INTRO_TAC[`e''`]);
32422 REWRITE_TAC[EMPTY_EXISTS];
32423 TYPE_THEN `x` EXISTS_TAC;
32424 ASM_REWRITE_TAC[INTER];
32427 TYPE_THEN `graph_inc K e v''` ASM_CASES_TAC;
32430 REWRITE_TAC[in_pair];
32433 DISCH_THEN_FULL_REWRITE;
32434 PROOF_BY_CONTR_TAC;
32437 MESON_TAC[simple_arc_end_end2];
32439 DISCH_THEN_FULL_REWRITE;
32440 PROOF_BY_CONTR_TAC;
32443 MESON_TAC[simple_arc_end_end];
32445 TYPE_THEN `C SUBSET D v UNION D v' UNION C''` SUBGOAL_TAC;
32450 REWRITE_TAC[SUBSET;UNION];
32452 REWRITE_TAC[SUBSET];
32454 PROOF_BY_CONTR_TAC;
32455 USE 11 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
32459 USE 10 (REWRITE_RULE[UNION]);
32464 ASM_REWRITE_TAC[in_pair];
32465 PROOF_BY_CONTR_TAC;
32466 USE 8 (REWRITE_RULE[DE_MORGAN_THM]);
32468 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
32471 DISCH_THEN (TH_INTRO_TAC[`v`;`v''`]);
32473 FIRST_ASSUM IMATCH_MP_TAC ;
32475 REWRITE_TAC[INTER;EMPTY_EXISTS];
32476 TYPE_THEN `u` EXISTS_TAC;
32479 DISCH_THEN_REWRITE;
32483 ASM_REWRITE_TAC[in_pair];
32484 PROOF_BY_CONTR_TAC;
32485 USE 8 (REWRITE_RULE[DE_MORGAN_THM]);
32487 RULE_ASSUM_TAC (REWRITE_RULE[graph_hv_finite_radius]);
32490 DISCH_THEN (TH_INTRO_TAC[`v'`;`v''`]);
32492 FIRST_ASSUM IMATCH_MP_TAC ;
32494 REWRITE_TAC[INTER;EMPTY_EXISTS];
32495 TYPE_THEN `u` EXISTS_TAC;
32498 DISCH_THEN_REWRITE;
32502 DISCH_THEN (TH_INTRO_TAC[`v''`]);
32504 REWRITE_TAC[EMPTY_EXISTS;INTER];
32506 (* Thu Aug 26 08:46:13 EDT 2004 *)
32511 (* ------------------------------------------------------------------ *)
32513 (* ------------------------------------------------------------------ *)
32516 let (UNDISCHQ_TAC:(term->bool) -> tactic) =
32517 fun cond (asl,w) ->
32518 let cond' x = try (cond x) with failure -> false in
32519 let asl' = (fst(partition cond' (map (concl o snd) asl))) in
32520 EVERY (map (TRY o UNDISCH_TAC ) asl') (asl,w);;
32522 let UNABBREV_TAC tm =
32523 FIRST[ UNDISCHQ_TAC ( ((=) tm o rhs))
32524 THEN (DISCH_THEN (MP_TAC o SYM)) ;
32525 UNDISCHQ_TAC ( ((=) tm o lhs)) ]
32526 THEN DISCH_THEN_FULL_REWRITE;;
32528 let set_simp_rewrites,extend_simp_rewrites,simp_rewrites,simp_net =
32529 let rewrites = ref (basic_rewrites())
32530 and conv_net = ref (basic_net()) in
32531 let set_simp_rewrites thl =
32532 let canon_thl = itlist (mk_rewrites false) thl ([]:thm list) in
32533 (rewrites := canon_thl;
32534 conv_net := itlist (net_of_thm true) canon_thl empty_net) in
32535 let extend_simp_rewrites thl =
32536 (* is false in simp.ml . Important change. *)
32537 let canon_thl = itlist (mk_rewrites true) thl ([]:thm list) in
32538 (rewrites := canon_thl @ !rewrites;
32539 conv_net := itlist (net_of_thm true) canon_thl (!conv_net)) in
32540 let simp_rewrites() = !rewrites in
32541 let simp_net() = !conv_net in
32542 set_simp_rewrites,extend_simp_rewrites,simp_rewrites,simp_net;;
32545 let rewmaker = mk_rewrites true in
32547 let cthms = itlist rewmaker thl ([]:thm list) in
32548 let net' = itlist (net_of_thm true) cthms (simp_net()) in
32549 let net'' = itlist net_of_cong (basic_congs()) net' in
32550 Simpset(net'',basic_prover,([]:prover list),rewmaker);;
32552 let RSIMP_CONV thl = ONCE_SIMPLIFY_CONV (simp_ss ([]:thm list)) thl;;
32554 let (RSIMP_TAC:thm list -> tactic) = fun (thl:thm list) -> CONV_TAC(RSIMP_CONV thl);;
32556 let ASM_RSIMP_TAC = ASM RSIMP_TAC;;
32560 REP_BASIC_TAC THEN (DROP_ALL_ANT_TAC) THEN
32561 (ASM_RSIMP_TAC[]) THEN
32564 let SUBAGOAL_TAC t = SUBGOAL_THEN t ASSUME_TAC;;
32566 (* EVERY_STEP_TAC := ALL_TAC *)
32568 let subset_imp = prove_by_refinement(
32569 `!A B (x:A). A x /\ A SUBSET B ==> B x`,
32572 ASM_MESON_TAC[ISUBSET];
32577 extend_simp_rewrites[subset_imp]
32580 (* ------------------------------------------------------------------ *)
32581 (* ------------------------------------------------------------------ *)
32584 let plane_graph_image = jordan_def
32585 `plane_graph_image (f:(num->real)->(num->real)) G =
32587 (IMAGE f (graph_vertex G),
32588 IMAGE2 f (graph_edge G),
32589 ( \ e v. (?e' v'. (graph_edge G e') /\
32590 (IMAGE f e' = e) /\ (f v' = v) /\
32591 (graph_inc G e' v'))))`;;
32593 let plane_graph_image_e = prove_by_refinement(
32594 `!f G. (graph_edge (plane_graph_image f G)) =
32595 IMAGE2 f (graph_edge G)`,
32598 REWRITE_TAC[plane_graph_image;graph_edge;part1;drop0;dest_graph_t];
32599 (* Thu Aug 26 10:16:26 EDT 2004 *)
32604 let plane_graph_image_v = prove_by_refinement(
32605 `!f G. (graph_vertex (plane_graph_image f G)) =
32606 IMAGE f (graph_vertex G)`,
32609 REWRITE_TAC[plane_graph_image;dest_graph_t;graph_vertex;];
32610 (* Thu Aug 26 10:17:56 EDT 2004 *)
32615 let plane_graph_image_i = prove_by_refinement(
32616 `!f G. (graph_inc (plane_graph_image f G)) =
32617 ( \ e v. (?e' v'. (graph_edge G e') /\
32618 (IMAGE f e' = e) /\ (f v' = v) /\
32619 (graph_inc G e' v')))`,
32622 REWRITE_TAC[plane_graph_image ;graph_inc;dest_graph_t;drop1];
32623 (* Thu Aug 26 10:20:07 EDT 2004 *)
32628 let plane_graph_image_bij = prove_by_refinement(
32629 `!f G. homeomorphism f top2 top2 /\ plane_graph G ==>
32630 BIJ f (graph_vertex G) (IMAGE f (graph_vertex G)) /\
32631 BIJ (IMAGE f) (graph_edge G) (IMAGE2 f (graph_edge G))`,
32636 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;top2_unions]);
32637 TYPE_THEN `graph_vertex G SUBSET (euclid 2)` SUBGOAL_TAC;
32638 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32641 TYPE_THEN `!e. graph_edge G e ==> (e SUBSET (euclid 2))` SUBGOAL_TAC;
32642 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32643 IMATCH_MP_TAC simple_arc_euclid;
32644 IMATCH_MP_TAC subset_imp;
32648 IMATCH_MP_TAC inj_bij;
32650 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
32651 FIRST_ASSUM IMATCH_MP_TAC ;
32652 ASM_MESON_TAC[subset_imp];
32654 USE 3 (MATCH_MP image_powerset);
32655 REWRITE_TAC[IMAGE2];
32656 IMATCH_MP_TAC inj_bij;
32658 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
32659 FIRST_ASSUM IMATCH_MP_TAC ;
32660 (* ASM_MESON_TAC[ISUBSET]; *)
32664 let plane_graph_image_iso = prove_by_refinement(
32665 `!f G. (homeomorphism f top2 top2 /\ plane_graph G ==>
32666 graph_isomorphic G (plane_graph_image f G))`,
32670 REWRITE_TAC[graph_isomorphic;graph_iso;];
32672 TYPE_THEN `f` EXISTS_TAC;
32674 TYPE_THEN `IMAGE f` EXISTS_TAC;
32675 TYPE_THEN `f,IMAGE f` EXISTS_TAC;
32676 REWRITE_TAC[plane_graph_image_e;plane_graph_image_v;plane_graph_image_i];
32678 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;top2_unions]);
32679 TYPE_THEN `graph_vertex G SUBSET (euclid 2)` SUBGOAL_TAC;
32680 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32682 TYPE_THEN `!e. graph_edge G e ==> (e SUBSET (euclid 2))` SUBGOAL_TAC;
32683 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32684 IMATCH_MP_TAC simple_arc_euclid;
32685 IMATCH_MP_TAC subset_imp;
32689 IMATCH_MP_TAC inj_bij;
32691 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
32692 FIRST_ASSUM IMATCH_MP_TAC ;
32693 ASM_MESON_TAC[ISUBSET];
32696 USE 3 (MATCH_MP image_powerset);
32697 REWRITE_TAC[IMAGE2];
32698 IMATCH_MP_TAC inj_bij;
32700 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;INJ]);
32701 FIRST_ASSUM IMATCH_MP_TAC ;
32704 IMATCH_MP_TAC EQ_EXT;
32706 TYPE_THEN `x` UNABBREV_TAC;
32707 TYPE_THEN `e' = e` SUBGOAL_TAC;
32708 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE2;BIJ;INJ]);
32709 FIRST_ASSUM IMATCH_MP_TAC ;
32712 TYPE_THEN `e'` UNABBREV_TAC ;
32713 REWRITE_TAC[IMAGE];
32718 USE 8(REWRITE_RULE[IMAGE]);
32721 (* Thu Aug 26 10:49:22 EDT 2004 *)
32725 extend_simp_rewrites [(REAL_ARITH `&0 < &1`)];;
32727 extend_simp_rewrites [prove_by_refinement(
32728 `metric_space(euclid 2,d_euclid)`,
32731 ASM_MESON_TAC[metric_euclid];
32735 extend_simp_rewrites [prove_by_refinement(
32736 `!G. plane_graph G ==> graph_vertex G SUBSET (euclid 2)`,
32739 REWRITE_TAC[plane_graph];
32743 let simple_arc_end_cont = prove_by_refinement(
32744 `!C v v'. simple_arc_end C v v' <=>
32745 (?f. (C = IMAGE f {x | &0 <= x /\ x <= &1}) /\
32747 (top_of_metric ({x | &0 <= x /\ x <= &1},d_real)) top2 /\
32748 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) /\
32753 REWRITE_TAC[simple_arc_end];
32754 ONCE_REWRITE_TAC [EQ_SYM_EQ];
32756 TH_INTRO_TAC [`&0`;`&1`;`f`;`euclid 2`;`d_euclid`] cont_extend_real_lemma;
32758 ASM_REWRITE_TAC[GSYM top2];
32759 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
32760 REWRITE_TAC[IMAGE;SUBSET];
32761 FIRST_ASSUM IMATCH_MP_TAC ;
32762 TYPE_THEN `g` EXISTS_TAC;
32765 REWRITE_TAC[IMAGE];
32766 IMATCH_MP_TAC EQ_EXT;
32769 FIRST_ASSUM IMATCH_MP_TAC ;
32773 ASM_REWRITE_TAC[top2];
32776 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
32778 ASM_MESON_TAC[REAL_ARITH `x <=. x `;REAL_ARITH `&0 <=. &1`];
32782 IMATCH_MP_TAC continuous_interval;
32783 (* Thu Aug 26 12:57:09 EDT 2004 *)
32787 let graph_edge_euclid = prove_by_refinement(
32788 `!G e. (plane_graph G /\ graph_edge G e) ==> (e SUBSET (euclid 2))`,
32792 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32793 IMATCH_MP_TAC simple_arc_euclid;
32794 IMATCH_MP_TAC subset_imp;
32799 let plane_graph_image_plane = prove_by_refinement(
32800 `!f G. (homeomorphism f top2 top2 /\ good_plane_graph G ==>
32801 good_plane_graph(plane_graph_image f G))`,
32804 REWRITE_TAC[good_plane_graph];
32805 TH_INTRO_TAC[`G`;`plane_graph_image f G`] graph_isomorphic_graph;
32806 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32808 IMATCH_MP_TAC plane_graph_image_iso;
32809 ASM_REWRITE_TAC[plane_graph];
32811 TYPE_THEN `graph_vertex G SUBSET (euclid 2)` SUBGOAL_TAC;
32813 TYPE_THEN `!e. graph_edge G e ==> (e SUBSET (euclid 2))` SUBGOAL_TAC;
32814 IMATCH_MP_TAC graph_edge_euclid;
32817 TH_INTRO_TAC[`f`;`G`] plane_graph_image_bij;
32819 ASM_REWRITE_TAC[plane_graph;GSYM CONJ_ASSOC;];
32820 TYPE_THEN `(!e v v'. graph_edge (plane_graph_image f G) e /\ ~(v = v') /\ graph_inc (plane_graph_image f G) e v /\ graph_inc (plane_graph_image f G) e v' ==> simple_arc_end e v v')` SUBGOAL_TAC;
32821 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph_image_e;plane_graph_image_v;plane_graph_image_i]);
32822 TYPE_THEN `v` UNABBREV_TAC;
32823 TYPE_THEN `v'` UNABBREV_TAC;
32824 TYPE_THEN `e` UNABBREV_TAC;
32825 TYPE_THEN `e' = e''` SUBGOAL_TAC ;
32826 USE 6 (REWRITE_RULE[BIJ;INJ;IMAGE2]);
32827 FIRST_ASSUM IMATCH_MP_TAC ;
32828 TYPE_THEN `e''` UNABBREV_TAC;
32829 UND 0 THEN (DISCH_THEN (TH_INTRO_TAC [`e'`;`v'''`;`v''`]));
32831 TYPE_THEN `v'''` UNABBREV_TAC;
32832 USE 0 (REWRITE_RULE[simple_arc_end_cont]);
32833 REWRITE_TAC[simple_arc_end_cont];
32834 TYPE_THEN `f o f'` EXISTS_TAC;
32835 REWRITE_TAC[IMAGE_o];
32838 IMATCH_MP_TAC continuous_comp;
32839 TYPE_THEN `top2` EXISTS_TAC;
32840 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism]);
32841 ASM_REWRITE_TAC[top2_unions];
32842 TYPE_THEN `UNIONS (top_of_metric ({x | &0 <= x /\ x <= &1},d_real)) = {x | &0 <= x /\ x <= &1}` SUBGOAL_TAC;
32843 TH_INTRO_TAC[`{x | &0 <= x /\ x <= &1}`;`d_real`] top_of_metric_unions;
32844 TYPE_THEN `{x | &0 <= x /\ x <= &1} SUBSET UNIV ` SUBAGOAL_TAC;
32846 IMATCH_MP_TAC metric_subspace;
32848 REWRITE_TAC [metric_real;];
32849 UND 21 THEN DISCH_THEN (fun t->ONCE_REWRITE_TAC[GSYM t]);
32851 USE 15 (REWRITE_RULE[INJ]);
32852 REWRITE_TAC[IMAGE;SUBSET];
32853 FIRST_ASSUM IMATCH_MP_TAC ;
32856 REWRITE_TAC[comp_comp];
32857 IMATCH_MP_TAC COMP_INJ;
32859 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ;top2_unions]);
32860 REWRITE_TAC[o_DEF];
32863 TYPE_THEN `graph_edge (plane_graph_image f G) SUBSET simple_arc top2` SUBGOAL_TAC;
32864 REWRITE_TAC[SUBSET];
32865 TH_INTRO_TAC[`plane_graph_image f G`;`x`] graph_edge_end_select;
32866 UND 8 THEN DISCH_THEN (TH_INTRO_TAC[`x`;`v`;`v'`]);
32867 IMATCH_MP_TAC simple_arc_end_simple;
32872 MP_TAC plane_graph_image_v THEN DISCH_THEN_FULL_REWRITE;
32873 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ;INJ;]);
32874 USE 16 (REWRITE_RULE[top2_unions]);
32875 REWRITE_TAC[IMAGE;SUBSET];
32876 FIRST_ASSUM IMATCH_MP_TAC ;
32877 IMATCH_MP_TAC subset_imp;
32881 (fun t-> (RULE_ASSUM_TAC (REWRITE_RULE t) THEN REWRITE_TAC t )) [plane_graph_image_e;plane_graph_image_v;plane_graph_image_i];
32882 IMATCH_MP_TAC EQ_EXT;
32884 TYPE_THEN `x` UNABBREV_TAC ;
32885 TYPE_THEN `e` UNABBREV_TAC;
32886 REWRITE_TAC[INTER];
32888 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32891 USE 10 (REWRITE_RULE[INTER]);
32892 REWRITE_TAC[IMAGE];
32895 REWRITE_TAC[IMAGE];
32896 TYPE_THEN `v'` EXISTS_TAC;
32897 TH_INTRO_TAC [`G`;`e'`] graph_inc_subset;
32898 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32899 IMATCH_MP_TAC subset_imp;
32901 USE 8 (REWRITE_RULE[IMAGE2]);
32902 TYPE_THEN `FF = IMAGE f` ABBREV_TAC ;
32903 USE 8 (REWRITE_RULE[IMAGE]);
32904 TYPE_THEN `x'` EXISTS_TAC;
32905 USE 10 (REWRITE_RULE[INTER]);
32906 TYPE_THEN `FF` UNABBREV_TAC;
32907 USE 10 (REWRITE_RULE[IMAGE]);
32908 TYPE_THEN `x` UNABBREV_TAC;
32909 TYPE_THEN `x''` EXISTS_TAC;
32910 TYPE_THEN `e` UNABBREV_TAC;
32911 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32912 REWRITE_TAC[INTER];
32913 USE 13 (REWRITE_RULE[IMAGE]);
32914 TYPE_THEN `x'' =x` SUBAGOAL_TAC;
32915 USE 2(REWRITE_RULE[homeomorphism;BIJ;INJ;top2_unions]);
32916 FIRST_ASSUM IMATCH_MP_TAC ;
32918 IMATCH_MP_TAC subset_imp;
32921 IMATCH_MP_TAC subset_imp;
32922 TYPE_THEN `x'` EXISTS_TAC;
32925 (fun t-> (RULE_ASSUM_TAC (REWRITE_RULE t) THEN REWRITE_TAC t )) [plane_graph_image_e;plane_graph_image_v;plane_graph_image_i];
32926 USE 10 (REWRITE_RULE[IMAGE2]);
32927 USE 11 (REWRITE_RULE[IMAGE2]);
32928 TYPE_THEN `FF = IMAGE f` ABBREV_TAC ;
32929 USE 10 (REWRITE_RULE[IMAGE]);
32930 USE 11 (REWRITE_RULE[IMAGE]);
32931 TYPE_THEN `e` UNABBREV_TAC;
32932 TYPE_THEN `e'` UNABBREV_TAC;
32933 TH_INTRO_TAC [`f`;`euclid 2`;`euclid 2`;`x'`;`x`] (GSYM inj_inter);
32934 RULE_ASSUM_TAC (REWRITE_RULE[homeomorphism;BIJ;top2_unions]);
32935 TYPE_THEN `FF` UNABBREV_TAC;
32936 IMATCH_MP_TAC IMAGE_SUBSET;
32937 RULE_ASSUM_TAC (REWRITE_RULE[plane_graph]);
32938 TYPEL_THEN [`x'`;`x`] (fun t-> UND 1 THEN DISCH_THEN (TH_INTRO_TAC t));
32940 TYPE_THEN `x'` UNABBREV_TAC;
32946 let h_compat = jordan_def `h_compat f <=> !x y. (SND x = SND y) ==>
32947 (IMAGE f (mk_line (point x) (point y)) =
32948 mk_line (f (point x)) (f (point y)))`;;
32950 let v_compat = jordan_def `v_compat f <=> !x y. (FST x = FST y) ==>
32951 (IMAGE f (mk_line (point x) (point y)) =
32952 mk_line (f (point x)) (f (point y)))`;;
32954 let h_translate = jordan_def `h_translate r p = p + r *# e1`;;
32956 let v_translate = jordan_def `v_translate r p = p + r *# e2`;;
32958 let r_scale = jordan_def `r_scale r p =
32959 if ( &.0 < p 0) then (point (r * p 0, p 1)) else p`;;
32961 let u_scale = jordan_def `u_scale r p =
32962 if ( &.0 < p 1) then (point ( p 0, r * p 1)) else p`;;
32964 let cont_domain = prove_by_refinement(
32965 `!(f:A->B) g U V. (continuous f U V) /\ (!x. UNIONS U x ==> (f x = g x))
32966 ==> (continuous g U V)`,
32969 REWRITE_TAC[preimage;continuous;];
32970 TYPE_THEN `{x | UNIONS U x /\ v (g x)} = {x | UNIONS U x /\ v (f x)}` SUBAGOAL_TAC;
32971 IMATCH_MP_TAC EQ_EXT;
32972 IMATCH_MP_TAC (TAUT `(A ==> (B <=> C)) ==> (A /\ B <=> A /\ C)`);
32973 FIRST_ASSUM IMATCH_MP_TAC ;
32977 let h_translate_bij = prove_by_refinement(
32978 `!r. BIJ (h_translate r) (euclid 2) (euclid 2)`,
32982 REWRITE_TAC[BIJ;INJ;h_translate];
32985 ASM_SIMP_TAC[euclid_add_closure;e1;point_scale;euclid_point];
32986 RULE_ASSUM_TAC (REWRITE_RULE[euclid_plus;euclid_scale;e1]);
32987 IMATCH_MP_TAC EQ_EXT;
32988 USE 0 (REWRITE_RULE[FUN_EQ_THM]);
32990 UND 0 THEN REAL_ARITH_TAC;
32991 REWRITE_TAC[SURJ;h_translate];
32993 TYPE_THEN `x - (r *# e1)` EXISTS_TAC;
32995 REWRITE_TAC[point_scale;e1];
32996 ASM_SIMP_TAC[euclid_sub_closure;euclid_point];
32997 REWRITE_TAC[euclid_plus;euclid_minus;euclid_scale];
32998 IMATCH_MP_TAC EQ_EXT;
33000 (* Tue Sep 7 10:15:46 EDT 2004 *)
33006 let v_translate_bij = prove_by_refinement(
33007 `!r. BIJ (v_translate r) (euclid 2) (euclid 2)`,
33011 REWRITE_TAC[BIJ;INJ;v_translate];
33014 ASM_SIMP_TAC[euclid_add_closure;e2;point_scale;euclid_point];
33015 RULE_ASSUM_TAC (REWRITE_RULE[euclid_plus;euclid_scale;e2]);
33016 IMATCH_MP_TAC EQ_EXT;
33017 USE 0 (REWRITE_RULE[FUN_EQ_THM]);
33019 UND 0 THEN REAL_ARITH_TAC;
33020 REWRITE_TAC[SURJ;v_translate];
33022 TYPE_THEN `x - (r *# e2)` EXISTS_TAC;
33024 REWRITE_TAC[point_scale;e2];
33025 ASM_SIMP_TAC[euclid_sub_closure;euclid_point];
33026 REWRITE_TAC[euclid_plus;euclid_minus;euclid_scale];
33027 IMATCH_MP_TAC EQ_EXT;
33029 (* Tue Sep 7 10:16:38 EDT 2004 *)
33035 extend_simp_rewrites [euclid_point];;
33036 extend_simp_rewrites [coord01];;
33038 let r_scale_bij = prove_by_refinement(
33039 `!r. (&0 < r) ==> BIJ (r_scale r) (euclid 2) (euclid 2)`,
33043 REWRITE_TAC[BIJ;INJ;r_scale;];
33047 REWRITE_TAC[euclid_point];
33048 USE 2 (MATCH_MP point_onto);
33049 USE 3 (MATCH_MP point_onto);
33050 REWRITE_TAC[point_inj];
33051 TYPE_THEN `x` UNABBREV_TAC;
33052 TYPE_THEN `y` UNABBREV_TAC;
33053 REWRITE_TAC[PAIR_SPLIT];
33054 RULE_ASSUM_TAC (REWRITE_RULE[coord01]);
33055 UND 1 THEN COND_CASES_TAC;
33056 UND 1 THEN COND_CASES_TAC;
33057 RULE_ASSUM_TAC (REWRITE_RULE[point_inj;PAIR_SPLIT]);
33058 RULE_ASSUM_TAC (REWRITE_RULE[REAL_EQ_LMUL]);
33059 UND 4 THEN UND 0 THEN REAL_ARITH_TAC ;
33060 RULE_ASSUM_TAC (REWRITE_RULE[point_inj;PAIR_SPLIT]);
33061 TYPE_THEN `FST p` UNABBREV_TAC;
33062 PROOF_BY_CONTR_TAC;
33063 UND 3 THEN REWRITE_TAC[];
33064 REWRITE_TAC[real_gt];
33065 IMATCH_MP_TAC REAL_LT_MUL;
33066 UND 1 THEN COND_CASES_TAC;
33067 RULE_ASSUM_TAC (REWRITE_RULE[point_inj;PAIR_SPLIT ]);
33068 TYPE_THEN `FST p'` UNABBREV_TAC;
33069 PROOF_BY_CONTR_TAC;
33070 UND 2 THEN REWRITE_TAC[];
33071 IMATCH_MP_TAC REAL_LT_MUL;
33072 RULE_ASSUM_TAC (REWRITE_RULE[point_inj]);
33074 REWRITE_TAC[SURJ;r_scale];
33076 USE 1 (MATCH_MP point_onto);
33077 TYPE_THEN `x` UNABBREV_TAC;
33078 TYPE_THEN `&0 < FST p` ASM_CASES_TAC;
33079 TYPE_THEN `point ((&1/r)* FST p, SND p)` EXISTS_TAC;
33080 TYPE_THEN `&0 < &1/ r * FST p` SUBAGOAL_TAC;
33081 IMATCH_MP_TAC REAL_LT_MUL;
33082 IMATCH_MP_TAC REAL_LT_DIV;
33085 REWRITE_TAC[PAIR_SPLIT;REAL_MUL_ASSOC];
33086 TYPE_THEN `(r * &1/r) * FST p = &1 * FST p` SUBAGOAL_TAC;
33089 IMATCH_MP_TAC REAL_DIV_LMUL;
33090 UND 3 THEN UND 0 THEN REAL_ARITH_TAC;
33092 TYPE_THEN `point p` EXISTS_TAC;
33094 (* Tue Sep 7 10:55:54 EDT 2004 *)
33099 let u_scale_bij = prove_by_refinement(
33100 `!r. (&0 < r) ==> BIJ (u_scale r) (euclid 2) (euclid 2)`,
33104 REWRITE_TAC[BIJ;INJ;u_scale;];
33108 USE 2 (MATCH_MP point_onto);
33109 USE 3 (MATCH_MP point_onto);
33110 REWRITE_TAC[point_inj];
33111 TYPE_THEN `x` UNABBREV_TAC;
33112 TYPE_THEN `y` UNABBREV_TAC;
33113 REWRITE_TAC[PAIR_SPLIT];
33114 RULE_ASSUM_TAC (REWRITE_RULE[coord01]);
33115 UND 1 THEN COND_CASES_TAC;
33116 UND 1 THEN COND_CASES_TAC;
33117 RULE_ASSUM_TAC (REWRITE_RULE[point_inj;PAIR_SPLIT]);
33118 RULE_ASSUM_TAC (REWRITE_RULE[REAL_EQ_LMUL]);
33119 UND 1 THEN UND 0 THEN REAL_ARITH_TAC ;
33120 RULE_ASSUM_TAC (REWRITE_RULE[point_inj;PAIR_SPLIT]);
33121 TYPE_THEN `SND p` UNABBREV_TAC;
33122 PROOF_BY_CONTR_TAC;
33123 UND 3 THEN REWRITE_TAC[];
33124 IMATCH_MP_TAC REAL_LT_MUL;
33125 UND 1 THEN COND_CASES_TAC;
33126 RULE_ASSUM_TAC (REWRITE_RULE[point_inj;PAIR_SPLIT ]);
33127 TYPE_THEN `SND p'` UNABBREV_TAC;
33128 PROOF_BY_CONTR_TAC;
33129 UND 2 THEN REWRITE_TAC[];
33130 IMATCH_MP_TAC REAL_LT_MUL;
33131 RULE_ASSUM_TAC (REWRITE_RULE[point_inj]);
33133 REWRITE_TAC[SURJ;u_scale];
33135 USE 1 (MATCH_MP point_onto);
33136 TYPE_THEN `x` UNABBREV_TAC;
33137 TYPE_THEN `&0 < SND p` ASM_CASES_TAC;
33138 TYPE_THEN `point (FST p, (&1/r)* SND p)` EXISTS_TAC;
33139 TYPE_THEN `&0 < &1/ r * SND p` SUBAGOAL_TAC;
33140 IMATCH_MP_TAC REAL_LT_MUL;
33141 IMATCH_MP_TAC REAL_LT_DIV;
33144 REWRITE_TAC[PAIR_SPLIT;REAL_MUL_ASSOC];
33145 TYPE_THEN `(r * &1/r) * SND p = &1 * SND p` SUBAGOAL_TAC;
33148 IMATCH_MP_TAC REAL_DIV_LMUL;
33149 UND 3 THEN UND 0 THEN REAL_ARITH_TAC;
33151 TYPE_THEN `point p` EXISTS_TAC;
33153 (* Tue Sep 7 11:01:53 EDT 2004 *)
33158 let h_translate_inv = prove_by_refinement(
33159 `!r x. (euclid 2 x) ==>
33160 (h_translate (--. r) x = INV (h_translate r) (euclid 2) (euclid 2) x)`,
33164 IMATCH_MP_TAC EQ_SYM;
33165 TH_INTRO_TAC[`h_translate r`;`euclid 2`;`euclid 2`;`h_translate (--. r) x`;`x`] INVERSE_XY;
33166 ASM_REWRITE_TAC[h_translate_bij;h_translate;e1;point_scale];
33167 ASM_SIMP_TAC[euclid_add_closure;euclid_point];
33168 REWRITE_TAC[h_translate;euclid_plus;e1;euclid_scale];
33169 IMATCH_MP_TAC EQ_EXT;
33171 (* Tue Sep 7 11:11:17 EDT 2004 *)
33175 let v_translate_inv = prove_by_refinement(
33176 `!r x. (euclid 2 x) ==>
33177 (v_translate (--. r) x = INV (v_translate r) (euclid 2) (euclid 2) x)`,
33181 IMATCH_MP_TAC EQ_SYM;
33182 TH_INTRO_TAC[`v_translate r`;`euclid 2`;`euclid 2`;`v_translate (--. r) x`;`x`] INVERSE_XY;
33183 ASM_REWRITE_TAC[v_translate_bij;v_translate;e2;point_scale];
33184 ASM_SIMP_TAC[euclid_add_closure;euclid_point];
33185 REWRITE_TAC[v_translate;euclid_plus;e2;euclid_scale];
33186 IMATCH_MP_TAC EQ_EXT;
33188 (* Tue Sep 7 11:12:42 EDT 2004 *)
33192 extend_simp_rewrites[prove_by_refinement(
33193 `!x r. (&0 < r) ==> (r * (&1/r) * x = x)`,
33196 REWRITE_TAC [REAL_MUL_ASSOC];
33197 TYPE_THEN `(r * &1/r) * x = &1 * x` SUBAGOAL_TAC;
33200 IMATCH_MP_TAC REAL_DIV_LMUL;
33201 UND 1 THEN UND 0 THEN REAL_ARITH_TAC;
33206 extend_simp_rewrites[ prove_by_refinement(
33207 `!r. (&0 < r) ==> (&0 < &1 / r)`,
33211 IMATCH_MP_TAC REAL_LT_DIV;
33215 extend_simp_rewrites[ REAL_LE_POW_2];;
33217 extend_simp_rewrites[ prove_by_refinement(
33218 `!x y. &0 <= x pow 2 + y pow 2`,
33222 IMATCH_MP_TAC REAL_LE_ADD;
33226 let r_scale_inv = prove_by_refinement(
33227 `!r x. (&0 < r) /\ (euclid 2 x) ==>
33228 (r_scale (&1/r) x = INV (r_scale r) (euclid 2) (euclid 2) x)`,
33232 IMATCH_MP_TAC EQ_SYM;
33233 TH_INTRO_TAC[`r_scale r`;`euclid 2`;`euclid 2`;`r_scale (&1/r) x`;`x`] INVERSE_XY;
33234 ASM_SIMP_TAC [r_scale_bij];
33235 TH_INTRO_TAC[`&1/r`] r_scale_bij;
33236 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
33237 REWRITE_TAC[r_scale];
33238 USE 0 (MATCH_MP point_onto);
33239 TYPE_THEN `x` UNABBREV_TAC;
33240 TYPE_THEN `&0 < FST p` ASM_CASES_TAC;
33241 REWRITE_TAC[coord01];
33242 TYPE_THEN `&0 < (&1 / r) * FST p` SUBAGOAL_TAC;
33243 IMATCH_MP_TAC REAL_LT_MUL;
33246 (* Tue Sep 7 11:40:41 EDT 2004 *)
33251 let u_scale_inv = prove_by_refinement(
33252 `!r x. (&0 < r) /\ (euclid 2 x) ==>
33253 (u_scale (&1/r) x = INV (u_scale r) (euclid 2) (euclid 2) x)`,
33257 IMATCH_MP_TAC EQ_SYM;
33258 TH_INTRO_TAC[`u_scale r`;`euclid 2`;`euclid 2`;`u_scale (&1/r) x`;`x`] INVERSE_XY;
33259 ASM_SIMP_TAC [u_scale_bij];
33260 TH_INTRO_TAC[`&1/r`] u_scale_bij;
33261 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
33262 REWRITE_TAC[u_scale];
33263 USE 0 (MATCH_MP point_onto);
33264 TYPE_THEN `x` UNABBREV_TAC;
33265 TYPE_THEN `&0 < SND p` ASM_CASES_TAC;
33266 REWRITE_TAC[coord01];
33267 TYPE_THEN `&0 < (&1 / r) * SND p` SUBAGOAL_TAC;
33268 IMATCH_MP_TAC REAL_LT_MUL;
33271 (* Tue Sep 7 11:56:05 EDT 2004 *)
33277 let metric_continuous_continuous_top2 = prove_by_refinement(
33278 `!f. (IMAGE f (euclid 2) SUBSET (euclid 2) ==>
33279 (continuous f top2 top2 =
33280 metric_continuous f (euclid 2,d_euclid) (euclid 2,d_euclid)))`,
33284 IMATCH_MP_TAC metric_continuous_continuous;
33288 let h_translate_cont = prove_by_refinement(
33289 `!r. continuous (h_translate r) (top2) (top2)`,
33293 TH_INTRO_TAC [`h_translate r`] metric_continuous_continuous_top2;
33294 ASSUME_TAC h_translate_bij;
33296 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
33297 REWRITE_TAC[IMAGE;SUBSET];
33298 FIRST_ASSUM IMATCH_MP_TAC ;
33300 REWRITE_TAC[metric_continuous;metric_continuous_pt];
33301 TYPE_THEN `epsilon` EXISTS_TAC;
33303 REWRITE_TAC[h_translate];
33304 TH_INTRO_TAC[`2`;`x`;`y`;`r *# e1`] metric_translate;
33305 REWRITE_TAC[e1;point_scale];
33306 (* Tue Sep 7 12:09:30 EDT 2004 *)
33311 let v_translate_cont = prove_by_refinement(
33312 `!r. continuous (v_translate r) (top2) (top2)`,
33316 TH_INTRO_TAC [`v_translate r`] metric_continuous_continuous_top2;
33317 ASSUME_TAC v_translate_bij;
33319 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
33320 REWRITE_TAC[IMAGE;SUBSET];
33321 FIRST_ASSUM IMATCH_MP_TAC ;
33323 REWRITE_TAC[metric_continuous;metric_continuous_pt];
33324 TYPE_THEN `epsilon` EXISTS_TAC;
33326 REWRITE_TAC[v_translate];
33327 TH_INTRO_TAC[`2`;`x`;`y`;`r *# e2`] metric_translate;
33328 REWRITE_TAC[e2;point_scale];
33329 (* Tue Sep 7 12:10:54 EDT 2004 *)
33333 let r_scale_cont = prove_by_refinement(
33334 `!r. (&0 < r) ==> (continuous (r_scale r) top2 top2)`,
33338 TYPE_THEN `&0 < (&1 + r)` SUBAGOAL_TAC;
33339 UND 0 THEN REAL_ARITH_TAC;
33340 TH_INTRO_TAC[`r_scale r`] metric_continuous_continuous_top2;
33341 ASSUME_TAC r_scale_bij;
33343 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
33344 REWRITE_TAC[IMAGE;SUBSET];
33345 FIRST_ASSUM IMATCH_MP_TAC ;
33346 REWRITE_TAC[metric_continuous;metric_continuous_pt];
33347 TYPE_THEN `&1/(&1 + r)*epsilon` EXISTS_TAC;
33348 TYPE_THEN `epsilon' = &1/(&1+r)*epsilon` ABBREV_TAC ;
33349 TYPE_THEN `epsilon = (&1 + r)*epsilon'` SUBAGOAL_TAC;
33350 TYPE_THEN `epsilon'` UNABBREV_TAC;
33351 TYPE_THEN `epsilon` UNABBREV_TAC;
33354 ASM_MESON_TAC[REAL_PROP_POS_LMUL];
33355 USE 5(MATCH_MP point_onto);
33356 TYPE_THEN `y` UNABBREV_TAC;
33357 USE 6(MATCH_MP point_onto);
33358 TYPE_THEN `x` UNABBREV_TAC;
33360 TYPE_THEN `!x y. (r*x - r*y) pow 2 <= ((&1 + r) pow 2 ) * ((x - y) pow 2)` SUBAGOAL_TAC;
33361 REWRITE_TAC[GSYM REAL_SUB_LDISTRIB;REAL_POW_MUL ];
33362 IMATCH_MP_TAC REAL_LE_RMUL;
33363 REWRITE_TAC[REAL_POW_2];
33364 IMATCH_MP_TAC ABS_SQUARE_LE;
33365 UND 0 THEN REAL_ARITH_TAC;
33366 REWRITE_TAC[GSYM REAL_POW_MUL];
33368 TYPE_THEN `!x y. (&1 pow 2) *((x - y) pow 2) <= ((&1 + r) pow 2 ) * ((x - y) pow 2)` SUBAGOAL_TAC;
33369 IMATCH_MP_TAC REAL_LE_RMUL;
33370 REWRITE_TAC[REAL_POW_2];
33371 IMATCH_MP_TAC ABS_SQUARE_LE;
33372 UND 0 THEN REAL_ARITH_TAC;
33373 UND 6 THEN REDUCE_TAC;
33375 TYPE_THEN `!x y. (&0 <= x) /\ (&0 <= y) ==> ((r*x + y) pow 2 <= ((&1 + r) pow 2) * ((x + y) pow 2))` SUBAGOAL_TAC;
33376 REWRITE_TAC[GSYM REAL_POW_MUL];
33377 REWRITE_TAC[REAL_POW_2];
33378 IMATCH_MP_TAC ABS_SQUARE_LE;
33379 TYPE_THEN `abs (r*x' + y') = r*x' + y'` SUBAGOAL_TAC;
33380 REWRITE_TAC[ABS_REFL];
33381 IMATCH_MP_TAC REAL_LE_ADD;
33382 ASM_MESON_TAC[REAL_LE_MUL;REAL_ARITH `&0 < x==> &0 <= x`];
33383 ineq_le_tac `(r*x' + y') + x' + r*y' = (&1 + r)*(x' + y')` ;
33385 TYPE_THEN `sqrt ((&1 + r) pow 2 * ((FST p' - FST p) pow 2 + (SND p' - SND p) pow 2)) < (&1 + r) * epsilon'` SUBAGOAL_TAC;
33386 TYPE_THEN `sqrt (((&1 + r)*epsilon') pow 2) = (&1 + r)*epsilon'` SUBAGOAL_TAC;
33387 IMATCH_MP_TAC POW_2_SQRT;
33388 IMATCH_MP_TAC REAL_LE_MUL;
33389 UND 7 THEN UND 1 THEN REAL_ARITH_TAC;
33390 UND 9 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC [GSYM t]);
33391 IMATCH_MP_TAC SQRT_MONO_LT;
33392 REWRITE_TAC[GSYM REAL_POW_MUL;REAL_ADD_LDISTRIB ];
33393 REWRITE_TAC[REAL_POW_MUL;GSYM REAL_ADD_LDISTRIB ];
33394 IMATCH_MP_TAC REAL_LT_LMUL;
33396 IMATCH_MP_TAC REAL_PROP_POS_POW;
33397 TH_INTRO_TAC [`(FST p' - FST p) pow 2 + (SND p' - SND p) pow 2`;`epsilon' pow 2`] (GSYM REAL_PROP_LT_SQRT);
33398 TYPE_THEN `sqrt(epsilon' pow 2) = epsilon'` SUBAGOAL_TAC;
33399 IMATCH_MP_TAC POW_2_SQRT;
33400 UND 7 THEN REAL_ARITH_TAC;
33401 RULE_ASSUM_TAC (REWRITE_RULE[d_euclid_point]);
33403 IMATCH_MP_TAC REAL_LET_TRANS;
33404 TYPE_THEN `sqrt ((&1 + r) pow 2 * ((FST p' - FST p) pow 2 + (SND p' - SND p) pow 2))` EXISTS_TAC;
33406 REWRITE_TAC[r_scale];
33407 COND_CASES_TAC THEN COND_CASES_TAC;
33408 UND 4 THEN REWRITE_TAC[d_euclid_point];
33409 IMATCH_MP_TAC SQRT_MONO_LE;
33410 (* IMATCH_MP_TAC REAL_LET_TRANS; *)
33411 REWRITE_TAC[REAL_LDISTRIB];
33412 IMATCH_MP_TAC REAL_LE_ADD2;
33414 UND 4 THEN (REWRITE_TAC [d_euclid_point]);
33415 TYPE_THEN `u = --. (FST p)` ABBREV_TAC ;
33416 TYPE_THEN `FST p = -- u` SUBAGOAL_TAC;
33417 UND 12 THEN REAL_ARITH_TAC;
33418 REWRITE_TAC[REAL_ARITH `x - --. y = x + y`];
33419 IMATCH_MP_TAC SQRT_MONO_LE;
33420 REWRITE_TAC[REAL_LDISTRIB];
33421 IMATCH_MP_TAC REAL_LE_ADD2;
33422 FIRST_ASSUM IMATCH_MP_TAC ;
33423 UND 10 THEN UND 13 THEN UND 11 THEN REAL_ARITH_TAC;
33425 UND 4 THEN (REWRITE_TAC [d_euclid_point]);
33426 TYPE_THEN `u = --. (FST p')` ABBREV_TAC ;
33427 TYPE_THEN `FST p' = -- u` SUBAGOAL_TAC;
33428 UND 12 THEN REAL_ARITH_TAC;
33429 REWRITE_TAC[REAL_ARITH `-- x - v = -- (v + x)`;REAL_POW_NEG;EVEN2 ];
33430 IMATCH_MP_TAC SQRT_MONO_LE;
33431 REWRITE_TAC[REAL_LDISTRIB];
33432 IMATCH_MP_TAC REAL_LE_ADD2;
33433 FIRST_ASSUM IMATCH_MP_TAC ;
33434 UND 10 THEN UND 13 THEN UND 11 THEN REAL_ARITH_TAC;
33436 UND 4 THEN (REWRITE_TAC [d_euclid_point]);
33437 IMATCH_MP_TAC SQRT_MONO_LE;
33438 REWRITE_TAC[REAL_LDISTRIB];
33439 IMATCH_MP_TAC REAL_LE_ADD2;
33440 (* Tue Sep 7 15:33:59 EDT 2004 *)
33445 let u_scale_cont = prove_by_refinement(
33446 `!r. (&0 < r) ==> (continuous (u_scale r) top2 top2)`,
33450 TYPE_THEN `&0 < (&1 + r)` SUBAGOAL_TAC;
33451 UND 0 THEN REAL_ARITH_TAC;
33452 TH_INTRO_TAC[`u_scale r`] metric_continuous_continuous_top2;
33453 ASSUME_TAC u_scale_bij;
33455 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
33456 REWRITE_TAC[IMAGE;SUBSET];
33457 FIRST_ASSUM IMATCH_MP_TAC ;
33458 REWRITE_TAC[metric_continuous;metric_continuous_pt];
33459 TYPE_THEN `&1/(&1 + r)*epsilon` EXISTS_TAC;
33460 TYPE_THEN `epsilon' = &1/(&1+r)*epsilon` ABBREV_TAC ;
33461 TYPE_THEN `epsilon = (&1 + r)*epsilon'` SUBAGOAL_TAC;
33462 TYPE_THEN `epsilon'` UNABBREV_TAC;
33463 TYPE_THEN `epsilon` UNABBREV_TAC;
33466 ASM_MESON_TAC[REAL_PROP_POS_LMUL];
33467 USE 5(MATCH_MP point_onto);
33468 TYPE_THEN `y` UNABBREV_TAC;
33469 USE 6(MATCH_MP point_onto);
33470 TYPE_THEN `x` UNABBREV_TAC;
33472 TYPE_THEN `!x y. (r*x - r*y) pow 2 <= ((&1 + r) pow 2 ) * ((x - y) pow 2)` SUBAGOAL_TAC;
33473 REWRITE_TAC[GSYM REAL_SUB_LDISTRIB;REAL_POW_MUL ];
33474 IMATCH_MP_TAC REAL_LE_RMUL;
33475 REWRITE_TAC[REAL_POW_2];
33476 IMATCH_MP_TAC ABS_SQUARE_LE;
33477 UND 0 THEN REAL_ARITH_TAC;
33478 REWRITE_TAC[GSYM REAL_POW_MUL];
33480 TYPE_THEN `!x y. (&1 pow 2) *((x - y) pow 2) <= ((&1 + r) pow 2 ) * ((x - y) pow 2)` SUBAGOAL_TAC;
33481 IMATCH_MP_TAC REAL_LE_RMUL;
33482 REWRITE_TAC[REAL_POW_2];
33483 IMATCH_MP_TAC ABS_SQUARE_LE;
33484 UND 0 THEN REAL_ARITH_TAC;
33485 UND 6 THEN REDUCE_TAC;
33487 TYPE_THEN `!x y. (&0 <= x) /\ (&0 <= y) ==> ((r*x + y) pow 2 <= ((&1 + r) pow 2) * ((x + y) pow 2))` SUBAGOAL_TAC;
33488 REWRITE_TAC[GSYM REAL_POW_MUL];
33489 REWRITE_TAC[REAL_POW_2];
33490 IMATCH_MP_TAC ABS_SQUARE_LE;
33491 TYPE_THEN `abs (r*x' + y') = r*x' + y'` SUBAGOAL_TAC;
33492 REWRITE_TAC[ABS_REFL];
33493 IMATCH_MP_TAC REAL_LE_ADD;
33494 ASM_MESON_TAC[REAL_LE_MUL;REAL_ARITH `&0 < x==> &0 <= x`];
33495 ineq_le_tac `(r*x' + y') + x' + r*y' = (&1 + r)*(x' + y')` ;
33497 TYPE_THEN `sqrt ((&1 + r) pow 2 * ((FST p' - FST p) pow 2 + (SND p' - SND p) pow 2)) < (&1 + r) * epsilon'` SUBAGOAL_TAC;
33498 TYPE_THEN `sqrt (((&1 + r)*epsilon') pow 2) = (&1 + r)*epsilon'` SUBAGOAL_TAC;
33499 IMATCH_MP_TAC POW_2_SQRT;
33500 IMATCH_MP_TAC REAL_LE_MUL;
33501 UND 7 THEN UND 1 THEN REAL_ARITH_TAC;
33502 UND 9 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC [GSYM t]);
33503 IMATCH_MP_TAC SQRT_MONO_LT;
33504 REWRITE_TAC[GSYM REAL_POW_MUL;REAL_ADD_LDISTRIB ];
33505 REWRITE_TAC[REAL_POW_MUL;GSYM REAL_ADD_LDISTRIB ];
33506 IMATCH_MP_TAC REAL_LT_LMUL;
33508 IMATCH_MP_TAC REAL_PROP_POS_POW;
33509 TH_INTRO_TAC [`(FST p' - FST p) pow 2 + (SND p' - SND p) pow 2`;`epsilon' pow 2`] (GSYM REAL_PROP_LT_SQRT);
33510 TYPE_THEN `sqrt(epsilon' pow 2) = epsilon'` SUBAGOAL_TAC;
33511 IMATCH_MP_TAC POW_2_SQRT;
33512 UND 7 THEN REAL_ARITH_TAC;
33513 RULE_ASSUM_TAC (REWRITE_RULE[d_euclid_point]);
33515 IMATCH_MP_TAC REAL_LET_TRANS;
33516 TYPE_THEN `sqrt ((&1 + r) pow 2 * ((FST p' - FST p) pow 2 + (SND p' - SND p) pow 2))` EXISTS_TAC;
33518 REWRITE_TAC[u_scale];
33519 COND_CASES_TAC THEN COND_CASES_TAC;
33520 UND 4 THEN REWRITE_TAC[d_euclid_point];
33521 IMATCH_MP_TAC SQRT_MONO_LE;
33522 (* IMATCH_MP_TAC REAL_LET_TRANS; *)
33523 REWRITE_TAC[REAL_LDISTRIB];
33524 IMATCH_MP_TAC REAL_LE_ADD2;
33526 UND 4 THEN (REWRITE_TAC [d_euclid_point]);
33527 TYPE_THEN `u = --. (SND p)` ABBREV_TAC ;
33528 TYPE_THEN `SND p = -- u` SUBAGOAL_TAC;
33529 UND 12 THEN REAL_ARITH_TAC;
33530 REWRITE_TAC[REAL_ARITH `x - --. y = x + y`];
33531 IMATCH_MP_TAC SQRT_MONO_LE;
33532 REWRITE_TAC[REAL_LDISTRIB];
33533 IMATCH_MP_TAC REAL_LE_ADD2;
33534 FIRST_ASSUM IMATCH_MP_TAC ;
33535 UND 10 THEN UND 13 THEN UND 11 THEN REAL_ARITH_TAC;
33537 UND 4 THEN (REWRITE_TAC [d_euclid_point]);
33538 TYPE_THEN `u = --. (SND p')` ABBREV_TAC ;
33539 TYPE_THEN `SND p' = -- u` SUBAGOAL_TAC;
33540 UND 12 THEN REAL_ARITH_TAC;
33541 REWRITE_TAC[REAL_ARITH `-- x - v = -- (v + x)`;REAL_POW_NEG;EVEN2 ];
33542 IMATCH_MP_TAC SQRT_MONO_LE;
33543 REWRITE_TAC[REAL_LDISTRIB];
33544 IMATCH_MP_TAC REAL_LE_ADD2;
33545 FIRST_ASSUM IMATCH_MP_TAC ;
33546 UND 10 THEN UND 13 THEN UND 11 THEN REAL_ARITH_TAC;
33548 UND 4 THEN (REWRITE_TAC [d_euclid_point]);
33549 IMATCH_MP_TAC SQRT_MONO_LE;
33550 REWRITE_TAC[REAL_LDISTRIB];
33551 IMATCH_MP_TAC REAL_LE_ADD2;
33552 (* Tue Sep 7 15:40:34 EDT 2004 *)
33556 let h_translate_hom = prove_by_refinement(
33557 `!r. (homeomorphism (h_translate r) top2 top2)`,
33561 IMATCH_MP_TAC bicont_homeomorphism;
33562 REWRITE_TAC[top2_unions;h_translate_bij;h_translate_cont];
33563 IMATCH_MP_TAC cont_domain;
33564 REWRITE_TAC[top2_unions];
33565 TYPE_THEN `h_translate (-- r)` EXISTS_TAC;
33566 REWRITE_TAC[h_translate_inv;h_translate_cont];
33567 (* Tue Sep 7 15:56:20 EDT 2004 *)
33572 let v_translate_hom = prove_by_refinement(
33573 `!r. (homeomorphism (v_translate r) top2 top2)`,
33577 IMATCH_MP_TAC bicont_homeomorphism;
33578 REWRITE_TAC[top2_unions;v_translate_bij;v_translate_cont];
33579 IMATCH_MP_TAC cont_domain;
33580 REWRITE_TAC[top2_unions];
33581 TYPE_THEN `v_translate (-- r)` EXISTS_TAC;
33582 REWRITE_TAC[v_translate_inv;v_translate_cont];
33583 (* Tue Sep 7 15:57:06 EDT 2004 *)
33587 let r_scale_hom = prove_by_refinement(
33588 `!r. (&0 < r) ==> (homeomorphism (r_scale r) top2 top2)`,
33592 IMATCH_MP_TAC bicont_homeomorphism;
33593 ASM_SIMP_TAC [top2_unions;r_scale_bij;r_scale_cont];
33594 IMATCH_MP_TAC cont_domain;
33595 REWRITE_TAC[top2_unions];
33596 TYPE_THEN `r_scale (&1/r)` EXISTS_TAC;
33597 TYPE_THEN `&0 < &1/r` SUBAGOAL_TAC;
33598 ASM_SIMP_TAC [r_scale_inv;r_scale_cont];
33599 (* Tue Sep 7 16:00:14 EDT 2004 *)
33604 let u_scale_hom = prove_by_refinement(
33605 `!r. (&0 < r) ==> (homeomorphism (u_scale r) top2 top2)`,
33609 IMATCH_MP_TAC bicont_homeomorphism;
33610 ASM_SIMP_TAC [top2_unions;u_scale_bij;u_scale_cont];
33611 IMATCH_MP_TAC cont_domain;
33612 REWRITE_TAC[top2_unions];
33613 TYPE_THEN `u_scale (&1/r)` EXISTS_TAC;
33614 TYPE_THEN `&0 < &1/r` SUBAGOAL_TAC;
33615 ASM_SIMP_TAC [u_scale_inv;u_scale_cont];
33616 (* Tue Sep 7 16:01:04 EDT 2004 *)
33622 let h_translate_h = prove_by_refinement(
33623 `!r. (h_compat (h_translate r))`,
33626 REWRITE_TAC[h_compat;h_translate;e1;point_scale;mk_line;IMAGE];
33627 IMATCH_MP_TAC EQ_EXT;
33629 TYPE_THEN `x'` UNABBREV_TAC;
33630 TYPE_THEN `x''` UNABBREV_TAC;
33632 TYPE_THEN `t` EXISTS_TAC;
33633 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33634 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33635 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33636 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33638 TYPE_THEN `x'` UNABBREV_TAC;
33639 CONV_TAC (dropq_conv "x");
33640 CONV_TAC (dropq_conv "x''");
33641 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33642 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33643 TYPE_THEN `t` EXISTS_TAC;
33644 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33645 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33647 (* Tue Sep 7 16:13:50 EDT 2004 *)
33652 let v_translate_v = prove_by_refinement(
33653 `!r. (v_compat (v_translate r))`,
33656 REWRITE_TAC[v_compat;v_translate;e2;point_scale;mk_line;IMAGE];
33657 IMATCH_MP_TAC EQ_EXT;
33659 TYPE_THEN `x'` UNABBREV_TAC;
33660 TYPE_THEN `x''` UNABBREV_TAC;
33662 TYPE_THEN `t` EXISTS_TAC;
33663 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33664 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33665 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33666 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33668 TYPE_THEN `x'` UNABBREV_TAC;
33669 CONV_TAC (dropq_conv "x");
33670 CONV_TAC (dropq_conv "x''");
33671 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33672 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33673 TYPE_THEN `t` EXISTS_TAC;
33674 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33675 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33677 (* Tue Sep 7 16:15:33 EDT 2004 *)
33683 let h_translate_v = prove_by_refinement(
33684 `!r. (v_compat (h_translate r))`,
33687 REWRITE_TAC[v_compat;h_translate;e1;point_scale;mk_line;IMAGE];
33688 IMATCH_MP_TAC EQ_EXT;
33690 TYPE_THEN `x'` UNABBREV_TAC;
33691 TYPE_THEN `x''` UNABBREV_TAC;
33693 TYPE_THEN `t` EXISTS_TAC;
33694 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33695 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33696 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33697 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33699 TYPE_THEN `x'` UNABBREV_TAC;
33700 CONV_TAC (dropq_conv "x");
33701 CONV_TAC (dropq_conv "x''");
33702 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33703 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33704 TYPE_THEN `t` EXISTS_TAC;
33705 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33706 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33708 (* Tue Sep 7 16:17:13 EDT 2004 *)
33712 let v_translate_h = prove_by_refinement(
33713 `!r. (h_compat (v_translate r))`,
33716 REWRITE_TAC[h_compat;v_translate;e2;point_scale;mk_line;IMAGE];
33717 IMATCH_MP_TAC EQ_EXT;
33719 TYPE_THEN `x'` UNABBREV_TAC;
33720 TYPE_THEN `x''` UNABBREV_TAC;
33722 TYPE_THEN `t` EXISTS_TAC;
33723 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33724 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33725 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33726 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33728 TYPE_THEN `x'` UNABBREV_TAC;
33729 CONV_TAC (dropq_conv "x");
33730 CONV_TAC (dropq_conv "x''");
33731 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33732 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33733 TYPE_THEN `t` EXISTS_TAC;
33734 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33735 REWRITE_TAC[point_inj;PAIR_SPLIT ];
33737 (* Tue Sep 7 16:18:12 EDT 2004 *)
33742 let lin_solve_x = prove_by_refinement(
33743 `!a c. ~(c = &0) ==> (?t. c*t = a)`,
33747 TYPE_THEN `a/c` EXISTS_TAC;
33748 IMATCH_MP_TAC REAL_DIV_LMUL;
33753 let mk_line_pt = prove_by_refinement(
33754 `!x. mk_line x x = {x}`,
33757 REWRITE_TAC[mk_line;trivial_lin_combo];
33758 IMATCH_MP_TAC EQ_EXT;
33759 REWRITE_TAC[INR IN_SING];
33763 let h_compat_bij = prove_by_refinement(
33764 `!f t. (BIJ f (euclid 2) (euclid 2) /\
33765 (!x. f (point x) 1 = t + SND x) ==>
33769 REWRITE_TAC[BIJ;h_compat];
33770 TYPE_THEN `x = y` ASM_CASES_TAC;
33771 REWRITE_TAC[mk_line_pt];
33772 IMATCH_MP_TAC EQ_EXT;
33773 REWRITE_TAC[IMAGE;INR IN_SING];
33776 TYPE_THEN`point y` EXISTS_TAC;
33778 TYPE_THEN `!x. f (point x) = (point ( (f (point x)) 0, t + SND x ))` SUBAGOAL_TAC;
33779 TYPE_THEN `euclid 2 (f (point x'))` SUBAGOAL_TAC;
33780 RULE_ASSUM_TAC (REWRITE_RULE[SURJ]);
33781 USE 5 (MATCH_MP point_onto);
33782 REWRITE_TAC[point_inj ;PAIR_SPLIT;];
33785 UND 1 THEN REWRITE_TAC[coord01];
33787 UND 5 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t] THEN (ASSUME_TAC t));
33788 IMATCH_MP_TAC SUBSET_ANTISYM;
33790 REWRITE_TAC[IMAGE;SUBSET;];
33791 TYPE_THEN `x'` UNABBREV_TAC;
33792 UND 7 THEN REWRITE_TAC[mk_line];
33793 TYPE_THEN `x''` UNABBREV_TAC;
33794 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33795 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33796 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33797 TYPE_THEN `x' = (t' * FST x + (&1 - t') * FST y,t' * SND y + (&1 - t') * SND y)` ABBREV_TAC ;
33798 TYPE_THEN `SND x' = SND y` SUBAGOAL_TAC;
33799 TYPE_THEN `x'` UNABBREV_TAC;
33804 UND 5 THEN (DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]));
33805 REWRITE_TAC[point_inj ;PAIR_SPLIT;];
33806 TH_INTRO_TAC[`f (point x') 0 - f(point y) 0`;`f (point x) 0 - f (point y) 0`] lin_solve_x;
33807 TYPE_THEN `f (point x) = f (point y)` SUBAGOAL_TAC;
33808 UND 8 THEN (DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]));
33809 REWRITE_TAC[point_inj ;PAIR_SPLIT ];
33810 UND 5 THEN REAL_ARITH_TAC;
33811 UND 4 THEN REWRITE_TAC[];
33812 ONCE_REWRITE_TAC[GSYM point_inj];
33813 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
33814 FIRST_ASSUM IMATCH_MP_TAC ;
33815 TYPE_THEN `t'` EXISTS_TAC;
33817 UND 5 THEN REAL_ARITH_TAC;
33820 REWRITE_TAC[mk_line;SUBSET;IMAGE];
33821 CONV_TAC (dropq_conv "x''");
33822 TYPE_THEN `x'` UNABBREV_TAC;
33823 TYPE_THEN `?u. (euclid_plus (t' *# point (f (point x) 0,t + SND y)) ((&1 - t') *# point (f (point y) 0,t + SND y))) = point (u , t + SND y)` SUBAGOAL_TAC;
33824 REWRITE_TAC[point_scale;point_add ;point_inj ; PAIR_SPLIT ;];
33825 CONV_TAC (dropq_conv "u");
33829 TYPE_THEN `?x'. point(u, t + SND y) = f (point x')` SUBAGOAL_TAC;
33830 RULE_ASSUM_TAC (REWRITE_RULE[SURJ]);
33831 TSPEC `point (u,t + SND y)` 2;
33832 RULE_ASSUM_TAC (REWRITE_RULE[euclid_point]);
33833 USE 7 (MATCH_MP point_onto);
33834 TYPE_THEN `y'` UNABBREV_TAC;
33835 TYPE_THEN `p` EXISTS_TAC;
33837 TH_INTRO_TAC[`FST x' - FST y`;`FST x - FST y`] lin_solve_x;
33838 UND 4 THEN REWRITE_TAC[PAIR_SPLIT ];
33839 UND 7 THEN REAL_ARITH_TAC;
33840 TYPE_THEN `t'` EXISTS_TAC;
33842 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33843 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33844 TYPE_THEN `x' = FST x',SND x'` SUBAGOAL_TAC;
33845 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add;point_inj;PAIR_SPLIT;];
33847 UND 7 THEN REAL_ARITH_TAC;
33850 TYPE_THEN `f (point x')` UNABBREV_TAC;
33851 USE 5 (REWRITE_RULE[point_inj;PAIR_SPLIT;]);
33852 UND 5 THEN REAL_ARITH_TAC;
33853 (* Tue Sep 7 22:08:48 EDT 2004 *)
33858 let r_scale_h = prove_by_refinement(
33859 `!r. (&0 < r) ==> (h_compat (r_scale r))`,
33863 IMATCH_MP_TAC h_compat_bij;
33864 TYPE_THEN `&0` EXISTS_TAC;
33866 ASM_SIMP_TAC [r_scale_bij];
33867 REWRITE_TAC[r_scale];
33869 (* Tue Sep 7 22:11:42 EDT 2004 *)
33874 let h_compat_bij2 = prove_by_refinement(
33875 `!f s. (BIJ f (euclid 2) (euclid 2) /\
33876 (!x. f (point x) 1 = s(SND x)) /\ (INJ s UNIV UNIV) ==>
33880 REWRITE_TAC[BIJ;h_compat];
33881 TYPE_THEN `x = y` ASM_CASES_TAC;
33882 REWRITE_TAC[mk_line_pt];
33883 IMATCH_MP_TAC EQ_EXT;
33884 REWRITE_TAC[IMAGE;INR IN_SING];
33887 TYPE_THEN`point y` EXISTS_TAC;
33889 TYPE_THEN `!x. f (point x) = (point ( (f (point x)) 0, s(SND x) ))` SUBAGOAL_TAC;
33890 TYPE_THEN `euclid 2 (f (point x'))` SUBAGOAL_TAC;
33891 RULE_ASSUM_TAC (REWRITE_RULE[SURJ]);
33892 USE 6 (MATCH_MP point_onto);
33893 REWRITE_TAC[point_inj ;PAIR_SPLIT;];
33896 UND 2 THEN REWRITE_TAC[coord01];
33898 UND 5 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t] THEN (ASSUME_TAC t));
33899 IMATCH_MP_TAC SUBSET_ANTISYM;
33901 REWRITE_TAC[IMAGE;SUBSET;];
33902 TYPE_THEN `x'` UNABBREV_TAC;
33903 UND 8 THEN REWRITE_TAC[mk_line];
33904 TYPE_THEN `x''` UNABBREV_TAC;
33905 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33906 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33907 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
33908 TYPE_THEN `x' = (t * FST x + (&1 - t) * FST y,t * SND y + (&1 - t) * SND y)` ABBREV_TAC ;
33909 TYPE_THEN `SND x' = SND y` SUBAGOAL_TAC;
33910 TYPE_THEN `x'` UNABBREV_TAC;
33915 UND 6 THEN (DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]));
33916 REWRITE_TAC[point_inj ;PAIR_SPLIT;];
33917 TH_INTRO_TAC[`f (point x') 0 - f(point y) 0`;`f (point x) 0 - f (point y) 0`] lin_solve_x;
33918 TYPE_THEN `f (point x) = f (point y)` SUBAGOAL_TAC;
33919 UND 9 THEN (DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]));
33920 REWRITE_TAC[point_inj ;PAIR_SPLIT ];
33921 UND 6 THEN REAL_ARITH_TAC;
33922 UND 5 THEN REWRITE_TAC[];
33923 ONCE_REWRITE_TAC[GSYM point_inj];
33924 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
33925 FIRST_ASSUM IMATCH_MP_TAC ;
33926 TYPE_THEN `t` EXISTS_TAC;
33928 UND 6 THEN REAL_ARITH_TAC;
33931 REWRITE_TAC[mk_line;SUBSET;IMAGE];
33932 CONV_TAC (dropq_conv "x''");
33933 TYPE_THEN `x'` UNABBREV_TAC;
33934 TYPE_THEN `?u. (euclid_plus (t *# point (f (point x) 0,s(SND y))) ((&1 - t) *# point (f (point y) 0,s(SND y)))) = point (u , s(SND y))` SUBAGOAL_TAC;
33935 REWRITE_TAC[point_scale;point_add ;point_inj ; PAIR_SPLIT ;];
33936 CONV_TAC (dropq_conv "u");
33938 ONCE_ASM_REWRITE_TAC [];
33939 UND 7 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
33941 TYPE_THEN `?x'. point(u, s(SND y)) = f (point x')` SUBAGOAL_TAC;
33942 RULE_ASSUM_TAC (REWRITE_RULE[SURJ]);
33943 TSPEC `point (u,s(SND y))` 3;
33944 RULE_ASSUM_TAC (REWRITE_RULE[euclid_point]);
33945 USE 8 (MATCH_MP point_onto);
33946 TYPE_THEN `y'` UNABBREV_TAC;
33947 TYPE_THEN `p` EXISTS_TAC;
33949 TH_INTRO_TAC[`FST x' - FST y`;`FST x - FST y`] lin_solve_x;
33950 UND 5 THEN REWRITE_TAC[PAIR_SPLIT ];
33951 UND 8 THEN REAL_ARITH_TAC;
33953 TYPE_THEN `t` EXISTS_TAC;
33955 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
33956 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
33957 TYPE_THEN `x' = FST x',SND x'` SUBAGOAL_TAC;
33958 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add;point_inj;PAIR_SPLIT;];
33960 UND 8 THEN REAL_ARITH_TAC;
33963 TYPE_THEN `f (point x')` UNABBREV_TAC;
33964 USE 6 (REWRITE_RULE[point_inj;PAIR_SPLIT;]);
33965 TYPE_THEN `SND y = SND x'` SUBAGOAL_TAC;
33966 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
33967 FIRST_ASSUM IMATCH_MP_TAC ;
33968 UND 12 THEN REAL_ARITH_TAC;
33969 (* Wed Sep 8 20:04:34 EDT 2004 *)
33974 let u_scale_h = prove_by_refinement(
33975 `!r. (&0 < r) ==> (h_compat (u_scale r))`,
33979 IMATCH_MP_TAC h_compat_bij2;
33980 TYPE_THEN `(\ z. if (&0 < z) then (r*z) else z)` EXISTS_TAC;
33981 ASM_SIMP_TAC[u_scale_bij];
33983 REWRITE_TAC[u_scale];
33984 TYPE_THEN `&0 < SND x` ASM_CASES_TAC;
33985 REWRITE_TAC[coord01];
33986 TYPE_THEN `x = FST x, SND x` SUBAGOAL_TAC;
33988 UND 1 THEN COND_CASES_TAC THEN COND_CASES_TAC;
33989 IMATCH_MP_TAC REAL_EQ_LMUL_IMP;
33991 UND 0 THEN REAL_ARITH_TAC;
33992 TYPE_THEN `y` UNABBREV_TAC;
33993 PROOF_BY_CONTR_TAC;
33994 UND 2 THEN REWRITE_TAC[];
33995 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
33996 TYPE_THEN `x` UNABBREV_TAC;
33997 PROOF_BY_CONTR_TAC;
33998 UND 3 THEN REWRITE_TAC[];
33999 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
34003 let v_compat_bij2 = prove_by_refinement(
34004 `!f s. (BIJ f (euclid 2) (euclid 2) /\
34005 (!x. f (point x) 0 = s(FST x)) /\ (INJ s UNIV UNIV) ==>
34009 REWRITE_TAC[BIJ;v_compat];
34010 TYPE_THEN `x = y` ASM_CASES_TAC;
34011 REWRITE_TAC[mk_line_pt];
34012 IMATCH_MP_TAC EQ_EXT;
34013 REWRITE_TAC[IMAGE;INR IN_SING];
34016 TYPE_THEN`point y` EXISTS_TAC;
34018 TYPE_THEN `!x. f (point x) = point(s(FST x), (f (point x)) 1 )` SUBAGOAL_TAC;
34019 TYPE_THEN `euclid 2 (f (point x'))` SUBAGOAL_TAC;
34020 RULE_ASSUM_TAC (REWRITE_RULE[SURJ]);
34021 USE 6 (MATCH_MP point_onto);
34022 REWRITE_TAC[point_inj ;PAIR_SPLIT;];
34025 UND 2 THEN REWRITE_TAC[coord01];
34027 UND 5 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t] THEN (ASSUME_TAC t));
34028 IMATCH_MP_TAC SUBSET_ANTISYM;
34030 REWRITE_TAC[IMAGE;SUBSET;];
34031 TYPE_THEN `x'` UNABBREV_TAC;
34032 UND 8 THEN REWRITE_TAC[mk_line];
34033 TYPE_THEN `x''` UNABBREV_TAC;
34034 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
34035 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
34036 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add];
34037 TYPE_THEN `x' = (t * FST y + (&1 - t) * FST y,t * SND x + (&1 - t) * SND y)` ABBREV_TAC ;
34038 TYPE_THEN `FST x' = FST y` SUBAGOAL_TAC;
34039 TYPE_THEN `x'` UNABBREV_TAC;
34044 UND 6 THEN (DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]));
34045 REWRITE_TAC[point_inj ;PAIR_SPLIT;];
34046 TH_INTRO_TAC[`f (point x') 1 - f(point y) 1`;`f (point x) 1 - f (point y) 1`] lin_solve_x;
34047 TYPE_THEN `f (point x) = f (point y)` SUBAGOAL_TAC;
34048 UND 9 THEN (DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]));
34049 REWRITE_TAC[point_inj ;PAIR_SPLIT ];
34050 UND 6 THEN REAL_ARITH_TAC;
34051 UND 5 THEN REWRITE_TAC[];
34052 ONCE_REWRITE_TAC[GSYM point_inj];
34053 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
34054 FIRST_ASSUM IMATCH_MP_TAC ;
34055 TYPE_THEN `t` EXISTS_TAC;
34057 UND 6 THEN REAL_ARITH_TAC;
34058 UND 6 THEN REAL_ARITH_TAC;
34060 REWRITE_TAC[mk_line;SUBSET;IMAGE];
34061 CONV_TAC (dropq_conv "x''");
34062 TYPE_THEN `x'` UNABBREV_TAC;
34063 TYPE_THEN `?u. (euclid_plus (t *# (f (point x))) ((&1 - t) *# (f (point y)))) = point ( s(FST y), u)` SUBAGOAL_TAC;
34064 ONCE_ASM_REWRITE_TAC[];
34065 REWRITE_TAC[point_scale;point_add ;point_inj ; PAIR_SPLIT ;];
34066 CONV_TAC (dropq_conv "u");
34069 TYPE_THEN `?x'. point( s(FST y),u) = f (point x')` SUBAGOAL_TAC;
34070 RULE_ASSUM_TAC (REWRITE_RULE[SURJ]);
34071 TSPEC `point (s(FST y),u)` 3;
34072 RULE_ASSUM_TAC (REWRITE_RULE[euclid_point]);
34073 USE 9 (MATCH_MP point_onto);
34074 TYPE_THEN `y'` UNABBREV_TAC;
34075 TYPE_THEN `p` EXISTS_TAC;
34077 TH_INTRO_TAC[`SND x' - SND y`;`SND x - SND y`] lin_solve_x;
34078 UND 5 THEN REWRITE_TAC[PAIR_SPLIT ];
34079 UND 9 THEN REAL_ARITH_TAC;
34080 TYPE_THEN `t'` EXISTS_TAC;
34082 TYPE_THEN `x = FST x,SND x` SUBAGOAL_TAC;
34083 TYPE_THEN `y = FST y,SND y` SUBAGOAL_TAC;
34084 TYPE_THEN `x' = FST x',SND x'` SUBAGOAL_TAC;
34085 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[point_scale;point_add;point_inj;PAIR_SPLIT;];
34086 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
34088 UND 9 THEN REAL_ARITH_TAC;
34091 TYPE_THEN `f (point x')` UNABBREV_TAC;
34092 USE 6 (REWRITE_RULE[point_inj;PAIR_SPLIT;]);
34093 TYPE_THEN `FST y = FST x'` SUBAGOAL_TAC;
34094 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
34095 FIRST_ASSUM IMATCH_MP_TAC ;
34096 UND 13 THEN REAL_ARITH_TAC;
34097 (* Wed Sep 8 21:10:34 EDT 2004 *)
34103 let r_scale_v = prove_by_refinement(
34104 `!r. (&0 < r) ==> (v_compat (r_scale r))`,
34108 IMATCH_MP_TAC v_compat_bij2;
34109 TYPE_THEN `(\ z. if (&0 < z) then (r*z) else z)` EXISTS_TAC;
34110 ASM_SIMP_TAC[r_scale_bij];
34112 REWRITE_TAC[r_scale];
34113 TYPE_THEN `&0 < FST x` ASM_CASES_TAC;
34114 REWRITE_TAC[coord01];
34115 TYPE_THEN `x = FST x, SND x` SUBAGOAL_TAC;
34117 UND 1 THEN COND_CASES_TAC THEN COND_CASES_TAC;
34118 IMATCH_MP_TAC REAL_EQ_LMUL_IMP;
34120 UND 0 THEN REAL_ARITH_TAC;
34121 TYPE_THEN `y` UNABBREV_TAC;
34122 PROOF_BY_CONTR_TAC;
34123 UND 2 THEN REWRITE_TAC[];
34124 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
34125 TYPE_THEN `x` UNABBREV_TAC;
34126 PROOF_BY_CONTR_TAC;
34127 UND 3 THEN REWRITE_TAC[];
34128 IMATCH_MP_TAC REAL_PROP_POS_MUL2;
34132 let u_scale_v = prove_by_refinement(
34133 `!r. (&0 < r) ==> (v_compat (u_scale r))`,
34137 IMATCH_MP_TAC v_compat_bij2;
34138 TYPE_THEN `(\ z. &0 + z)` EXISTS_TAC;
34139 ASM_SIMP_TAC[u_scale_bij];
34142 REWRITE_TAC[u_scale];
34149 (* ------------------------------------------------------------------ *)
34151 (* ------------------------------------------------------------------ *)
34153 let mk_line_hyper2_fst = prove_by_refinement(
34154 `!x y. (FST x = FST y) ==> (mk_line (point x) (point y) SUBSET
34155 hyperplane 2 e1 (FST x))`,
34159 TYPE_THEN `x = y` ASM_CASES_TAC;
34160 REWRITE_TAC[mk_line_pt;SUBSET;INR IN_SING ];
34161 REWRITE_TAC[e1;GSYM line2D_F;SUBSET;mk_line;];
34162 TYPE_THEN `y` EXISTS_TAC;
34164 IMATCH_MP_TAC (prove_by_refinement( `!A B. (A = B) ==> (A SUBSET (B:A->bool))`,[MESON_TAC[SUBSET_REFL]]));
34165 REWRITE_TAC[GSYM mk_line_hyper2_e1];
34166 ONCE_REWRITE_TAC [EQ_SYM_EQ];
34167 IMATCH_MP_TAC mk_line_2;
34168 REWRITE_TAC[mk_line_hyper2_e1;];
34169 REWRITE_TAC[e1;GSYM line2D_F;point_inj;PAIR_SPLIT];
34171 TYPE_THEN `x` EXISTS_TAC;
34174 TYPE_THEN `y` EXISTS_TAC;
34175 UND 1 THEN ASM_REWRITE_TAC[PAIR_SPLIT];
34176 (* Thu Sep 9 10:13:23 EDT 2004 *)
34181 let mk_line_hyper2_snd = prove_by_refinement(
34182 `!x y. (SND x = SND y) ==> (mk_line (point x) (point y) SUBSET
34183 hyperplane 2 e2 (SND x))`,
34187 TYPE_THEN `x = y` ASM_CASES_TAC;
34188 REWRITE_TAC[mk_line_pt;SUBSET;INR IN_SING ];
34189 REWRITE_TAC[e2;GSYM line2D_S;SUBSET;mk_line;];
34190 TYPE_THEN `y` EXISTS_TAC;
34192 IMATCH_MP_TAC (prove_by_refinement( `!A B. (A = B) ==> (A SUBSET (B:A->bool))`,[MESON_TAC[SUBSET_REFL]]));
34193 REWRITE_TAC[GSYM mk_line_hyper2_e2];
34194 ONCE_REWRITE_TAC [EQ_SYM_EQ];
34195 IMATCH_MP_TAC mk_line_2;
34196 REWRITE_TAC[mk_line_hyper2_e2;];
34197 REWRITE_TAC[e2;GSYM line2D_S;point_inj;PAIR_SPLIT];
34199 TYPE_THEN `x` EXISTS_TAC;
34202 TYPE_THEN `y` EXISTS_TAC;
34203 UND 1 THEN ASM_REWRITE_TAC[PAIR_SPLIT];
34204 (* Thu Sep 9 10:16:19 EDT 2004 *)
34208 let hv_line_hyper = prove_by_refinement(
34209 `!E e. hv_line E /\ E e ==> (?z.
34210 (e SUBSET hyperplane 2 e1 z) \/ (e SUBSET hyperplane 2 e2 z))`,
34213 REWRITE_TAC[hv_line];
34216 FIRST_ASSUM DISJ_CASES_TAC;
34217 TYPE_THEN `FST y` EXISTS_TAC;
34220 IMATCH_MP_TAC mk_line_hyper2_fst;
34221 TYPE_THEN `SND x` EXISTS_TAC;
34224 IMATCH_MP_TAC mk_line_hyper2_snd;
34225 (* Thu Sep 9 10:20:05 EDT 2004 *)
34230 let hv_line_hyper2 = prove_by_refinement(
34231 `!E. hv_line E /\ FINITE E ==> (?E'.
34232 (UNIONS E SUBSET UNIONS E') /\ (FINITE E') /\
34234 (?z. (e = hyperplane 2 e1 z) \/ (e = hyperplane 2 e2 z))))`,
34238 TYPE_THEN `!e. ?h. (E e ==> (e SUBSET h /\ (?z. (h = hyperplane 2 e1 z) \/ (h = hyperplane 2 e2 z))))` SUBAGOAL_TAC;
34240 TH_INTRO_TAC[`E`;`e`] hv_line_hyper;
34241 FIRST_ASSUM DISJ_CASES_TAC;
34243 TYPE_THEN `z` EXISTS_TAC;
34245 TYPE_THEN `z` EXISTS_TAC;
34247 TYPE_THEN `IMAGE h E` EXISTS_TAC;
34249 REWRITE_TAC[UNIONS;SUBSET;IMAGE];
34250 CONV_TAC (dropq_conv "u");
34252 TYPE_THEN `u` EXISTS_TAC;
34253 ASM_MESON_TAC[ISUBSET];
34256 IMATCH_MP_TAC FINITE_IMAGE;
34257 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE]);
34259 (* Thu Sep 9 10:32:28 EDT 2004 *)
34264 let finite_graph_edge = prove_by_refinement(
34265 `!(G:(A,B)graph_t) (H:(A',B')graph_t). FINITE(graph_edge G) /\
34266 graph_isomorphic G H ==> FINITE (graph_edge H)`,
34269 REWRITE_TAC[graph_isomorphic;graph_iso];
34270 ASM_MESON_TAC[FINITE_BIJ];
34274 let finite_graph_vertex = prove_by_refinement(
34275 `!(G:(A,B)graph_t) (H:(A',B')graph_t). FINITE(graph_vertex G) /\
34276 graph_isomorphic G H ==> FINITE (graph_vertex H)`,
34279 REWRITE_TAC[graph_isomorphic;graph_iso];
34280 ASM_MESON_TAC[FINITE_BIJ];
34284 let graph_edge_nonempty = prove_by_refinement(
34285 `!(G:(A,B)graph_t) (H:(A',B')graph_t). ~(graph_edge G = EMPTY ) /\
34286 graph_isomorphic G H ==> ~(graph_edge H = EMPTY )`,
34289 REWRITE_TAC[graph_isomorphic;graph_iso];
34290 USE 5 (REWRITE_RULE[EMPTY_EXISTS]);
34291 UND 0 THEN (REWRITE_TAC [EMPTY_EXISTS]);
34292 TYPE_THEN `v u'` EXISTS_TAC ;
34293 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
34297 let graph_edge_around_finite = prove_by_refinement(
34298 `!(G:(A,B)graph_t) v.
34299 (FINITE (graph_edge G)) ==> (FINITE (graph_edge_around G v))`,
34302 REWRITE_TAC[graph_edge_around];
34303 IMATCH_MP_TAC FINITE_SUBSET;
34305 REWRITE_TAC[SUBSET];
34309 let graph_edge_around4 = prove_by_refinement(
34310 `!(G:(A,B)graph_t) (H:(A',B')graph_t). (graph G) /\
34311 (FINITE (graph_edge G)) /\
34312 (!v. CARD (graph_edge_around G v) <=| 4) /\
34313 graph_isomorphic G H ==> (!v. CARD (graph_edge_around H v) <=| 4)`,
34318 TYPE_THEN `graph_vertex H v` ASM_CASES_TAC;
34319 RULE_ASSUM_TAC (REWRITE_RULE [graph_isomorphic]);
34320 TYPE_THEN `?v'. (graph_vertex G v' /\ ((FST f) v' = v))` SUBAGOAL_TAC;
34321 RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT ;graph_iso]);
34322 USE 6 (REWRITE_RULE[BIJ;SURJ]);
34323 TYPE_THEN `v` UNABBREV_TAC;
34324 TH_INTRO_TAC[`G`;`H`;`f`;`v'`] graph_iso_around;
34325 TH_INTRO_TAC[`SND f`; `(graph_edge_around G v')`] CARD_IMAGE_LE;
34326 IMATCH_MP_TAC graph_edge_around_finite;
34327 IMATCH_MP_TAC LE_TRANS;
34329 ASM_MESON_TAC [ARITH_RULE `0 <=| 4`; CARD_CLAUSES;graph_isomorphic_graph;graph_edge_around_empty];
34330 (* Thu Sep 9 11:49:01 EDT 2004 *)
34336 let graph_near_support = prove_by_refinement(
34337 `!(G:(A,B)graph_t). (planar_graph G) /\
34338 FINITE (graph_edge G) /\
34339 FINITE (graph_vertex G) /\
34340 ~(graph_edge G = {}) /\
34341 (!v. CARD (graph_edge_around G v) <=| 4)
34342 ==> (?H E. graph_isomorphic G H /\
34343 (FINITE E) /\ (good_plane_graph H) /\
34344 (!e. (graph_edge H e ==> e SUBSET UNIONS E)) /\
34345 (!v. (graph_vertex H v ==>
34346 E (hyperplane 2 e1 (v 0)) /\ E (hyperplane 2 e2 (v 1)))) /\
34348 (?z. (e = hyperplane 2 e1 z) \/ (e = hyperplane 2 e2 z)))))`,
34352 TH_INTRO_TAC[`G`] planar_graph_hv;
34353 TYPE_THEN `H` EXISTS_TAC;
34354 TYPE_THEN `A = IMAGE (\ v. hyperplane 2 e1 (v 0)) (graph_vertex H)` ABBREV_TAC ;
34355 TYPE_THEN `B = IMAGE (\ v. hyperplane 2 e2 (v 1)) (graph_vertex H)` ABBREV_TAC ;
34356 RULE_ASSUM_TAC (REWRITE_RULE[hv_finite]);
34359 TYPE_THEN `?E'. !e. (graph_edge H e ==> (e SUBSET UNIONS (E' e)) /\ (FINITE (E' e)) /\ (!e'. E' e e' ==> (?z. (e' = hyperplane 2 e1 z) \/ (e' = hyperplane 2 e2 z))))` SUBAGOAL_TAC;
34363 TH_INTRO_TAC[`E e`] hv_line_hyper2;
34364 TYPE_THEN `E'` EXISTS_TAC;
34365 IMATCH_MP_TAC SUBSET_TRANS;
34368 TYPE_THEN `C = UNIONS (IMAGE E' (graph_edge H))` ABBREV_TAC ;
34369 TYPE_THEN `A UNION B UNION C` EXISTS_TAC;
34371 REWRITE_TAC[FINITE_UNION];
34373 TYPE_THEN `A` UNABBREV_TAC;
34374 IMATCH_MP_TAC FINITE_IMAGE;
34375 IMATCH_MP_TAC finite_graph_vertex;
34378 TYPE_THEN `B` UNABBREV_TAC;
34379 IMATCH_MP_TAC FINITE_IMAGE;
34380 IMATCH_MP_TAC finite_graph_vertex;
34382 TYPE_THEN `C` UNABBREV_TAC;
34383 TH_INTRO_TAC[`IMAGE E' (graph_edge H)`] FINITE_FINITE_UNIONS;
34384 IMATCH_MP_TAC FINITE_IMAGE;
34385 IMATCH_MP_TAC finite_graph_edge;
34387 USE 11 (REWRITE_RULE[IMAGE]);
34391 REWRITE_TAC[UNIONS_UNION];
34392 IMATCH_MP_TAC in_union;
34394 IMATCH_MP_TAC in_union;
34396 TYPE_THEN `C` UNABBREV_TAC;
34399 IMATCH_MP_TAC SUBSET_TRANS;
34401 IMATCH_MP_TAC UNIONS_UNIONS;
34402 REWRITE_TAC[SUBSET;UNIONS;IMAGE;];
34403 CONV_TAC (dropq_conv "u");
34407 REWRITE_TAC[UNION];
34408 TYPE_THEN `A` UNABBREV_TAC;
34409 TYPE_THEN `B` UNABBREV_TAC;
34410 REWRITE_TAC[IMAGE];
34420 USE 12 (REWRITE_RULE[UNION]);
34421 UND 12 THEN REP_CASES_TAC;
34422 TYPE_THEN `A` UNABBREV_TAC;
34423 USE 12 (REWRITE_RULE[IMAGE]);
34425 TYPE_THEN `B` UNABBREV_TAC;
34426 USE 12 (REWRITE_RULE[IMAGE]);
34428 TYPE_THEN `C` UNABBREV_TAC;
34429 USE 12 (REWRITE_RULE[IMAGE;UNIONS]);
34430 TYPE_THEN `u` UNABBREV_TAC;
34432 (* Thu Sep 9 12:12:51 EDT 2004 *)
34437 let h_translate_point = prove_by_refinement(
34438 `!u v r. (h_translate r (point (u,v)) = point (u+r,v))`,
34441 REWRITE_TAC[h_translate;e1;point_scale;point_add];
34446 let v_translate_point = prove_by_refinement(
34447 `!u v r. (v_translate r (point (u,v)) = point (u,v + r))`,
34450 REWRITE_TAC[v_translate;e2;point_scale;point_add];
34455 let hyperplane1_h_translate = prove_by_refinement(
34456 `!z r. (IMAGE (h_translate r) (hyperplane 2 e1 z) =
34457 (hyperplane 2 e1 (z + r)))`,
34460 REWRITE_TAC[GSYM mk_line_hyper2_e1];
34461 ASSUME_TAC v_compat;
34462 TSPEC `(h_translate r)` 0;
34463 RULE_ASSUM_TAC (REWRITE_RULE[h_translate_v]);
34464 UND 0 THEN (DISCH_THEN (TH_INTRO_TAC[`z, &0`;`z, &1`]));
34465 REWRITE_TAC[h_translate_point];
34469 let hyperplane2_h_translate = prove_by_refinement(
34470 `!z r. (IMAGE (h_translate r) (hyperplane 2 e2 z) =
34471 (hyperplane 2 e2 z))`,
34474 REWRITE_TAC[GSYM mk_line_hyper2_e2];
34475 ASSUME_TAC h_compat;
34476 TSPEC `(h_translate r)` 0;
34477 RULE_ASSUM_TAC (REWRITE_RULE[h_translate_h]);
34478 UND 0 THEN (DISCH_THEN (TH_INTRO_TAC[` &0,z`;` &1,z`]));
34479 REWRITE_TAC[h_translate_point];
34480 ONCE_REWRITE_TAC[EQ_SYM_EQ];
34481 IMATCH_MP_TAC mk_line_2;
34482 REWRITE_TAC[mk_line_hyper2_e2;];
34483 REWRITE_TAC[GSYM line2D_S;e2;point_inj ];
34485 CONV_TAC (dropq_conv "p");
34487 CONV_TAC (dropq_conv "p");
34488 RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT]);
34489 UND 1 THEN REAL_ARITH_TAC;
34493 let hyperplane2_v_translate = prove_by_refinement(
34494 `!z r. (IMAGE (v_translate r) (hyperplane 2 e2 z) =
34495 (hyperplane 2 e2 (z + r)))`,
34498 REWRITE_TAC[GSYM mk_line_hyper2_e2];
34499 ASSUME_TAC h_compat;
34500 TSPEC `(v_translate r)` 0;
34501 RULE_ASSUM_TAC (REWRITE_RULE[v_translate_h]);
34502 UND 0 THEN (DISCH_THEN (TH_INTRO_TAC[`&0,z`;`&1,z`]));
34503 REWRITE_TAC[v_translate_point];
34507 let hyperplane1_v_translate = prove_by_refinement(
34508 `!z r. (IMAGE (v_translate r) (hyperplane 2 e1 z) =
34509 (hyperplane 2 e1 z))`,
34512 REWRITE_TAC[GSYM mk_line_hyper2_e1];
34513 ASSUME_TAC v_compat;
34514 TSPEC `(v_translate r)` 0;
34515 RULE_ASSUM_TAC (REWRITE_RULE[v_translate_v]);
34516 UND 0 THEN (DISCH_THEN (TH_INTRO_TAC[` z,&0`;`z,&1`]));
34517 REWRITE_TAC[v_translate_point];
34518 ONCE_REWRITE_TAC[EQ_SYM_EQ];
34519 IMATCH_MP_TAC mk_line_2;
34520 REWRITE_TAC[mk_line_hyper2_e1;];
34521 REWRITE_TAC[GSYM line2D_F;e1;point_inj ];
34523 CONV_TAC (dropq_conv "p");
34525 CONV_TAC (dropq_conv "p");
34526 RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT]);
34527 UND 1 THEN REAL_ARITH_TAC;
34528 (* Thu Sep 9 13:43:45 EDT 2004 *)
34533 let r_scale_point = prove_by_refinement(
34534 `!r u v. (r_scale r (point (u,v))) =
34535 point ((if (&0 < u) then r*u else u),v)`,
34538 REWRITE_TAC[r_scale];
34539 TYPE_THEN `&0 < u` ASM_CASES_TAC;
34543 let u_scale_point = prove_by_refinement(
34544 `!r u v. (u_scale r (point (u,v))) =
34545 point (u,(if (&0 < v) then r*v else v))`,
34548 REWRITE_TAC[u_scale];
34549 TYPE_THEN `&0 < v` ASM_CASES_TAC;
34553 let hyperplane2_r_scale = prove_by_refinement(
34554 `!z r. (&0 < r) ==> (IMAGE (r_scale r) (hyperplane 2 e2 z) =
34555 (hyperplane 2 e2 z))`,
34558 REWRITE_TAC[GSYM mk_line_hyper2_e2];
34559 ASSUME_TAC h_compat;
34560 TSPEC `(r_scale r)` 1;
34561 TYPE_THEN `h_compat(r_scale r)` SUBAGOAL_TAC THENL [ASM_MESON_TAC[r_scale_h];ALL_TAC];
34563 UND 1 THEN (DISCH_THEN (TH_INTRO_TAC[` &0,z`;`&1,z`]));
34564 REWRITE_TAC[r_scale_point];
34565 ONCE_REWRITE_TAC[EQ_SYM_EQ];
34566 IMATCH_MP_TAC mk_line_2;
34567 REWRITE_TAC[REAL_ARITH `~(&0 < &0)`];
34568 REWRITE_TAC[mk_line_hyper2_e2;];
34569 REWRITE_TAC[GSYM line2D_S;e2;point_inj ];
34571 CONV_TAC (dropq_conv "p");
34573 CONV_TAC (dropq_conv "p");
34574 RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT;REAL_ARITH `r * &1 = r`]);
34575 UND 3 THEN UND 0 THEN REAL_ARITH_TAC;
34579 let hyperplane1_r_scale = prove_by_refinement(
34580 `!z r. (&0 < r) ==> (IMAGE (r_scale r) (hyperplane 2 e1 z) =
34581 (hyperplane 2 e1 (if &0 < z then r*z else z)))`,
34584 REWRITE_TAC[GSYM mk_line_hyper2_e1];
34585 ASSUME_TAC v_compat;
34586 TSPEC `(r_scale r)` 1;
34587 TYPE_THEN `v_compat(r_scale r)` SUBAGOAL_TAC THENL [ASM_MESON_TAC[r_scale_v];ALL_TAC];
34589 UND 1 THEN (DISCH_THEN (TH_INTRO_TAC[`z,&0`;`z,&1`]));
34590 REWRITE_TAC[r_scale_point];
34594 let hyperplane1_u_scale = prove_by_refinement(
34595 `!z r. (&0 < r) ==> (IMAGE (u_scale r) (hyperplane 2 e1 z) =
34596 (hyperplane 2 e1 z))`,
34599 REWRITE_TAC[GSYM mk_line_hyper2_e1];
34600 ASSUME_TAC v_compat;
34601 TSPEC `(u_scale r)` 1;
34602 TYPE_THEN `v_compat(u_scale r)` SUBAGOAL_TAC THENL [ASM_MESON_TAC[u_scale_v];ALL_TAC];
34604 UND 1 THEN (DISCH_THEN (TH_INTRO_TAC[` z,&0`;`z,&1`]));
34605 REWRITE_TAC[u_scale_point];
34606 ONCE_REWRITE_TAC[EQ_SYM_EQ];
34607 IMATCH_MP_TAC mk_line_2;
34608 REWRITE_TAC[REAL_ARITH `~(&0 < &0)`];
34609 REWRITE_TAC[mk_line_hyper2_e1;];
34610 REWRITE_TAC[GSYM line2D_F;e1;point_inj ];
34612 CONV_TAC (dropq_conv "p");
34614 CONV_TAC (dropq_conv "p");
34615 RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT;REAL_ARITH `r * &1 = r`]);
34616 UND 3 THEN UND 0 THEN REAL_ARITH_TAC;
34620 let hyperplane2_u_scale = prove_by_refinement(
34621 `!z r. (&0 < r) ==> (IMAGE (u_scale r) (hyperplane 2 e2 z) =
34622 (hyperplane 2 e2 (if &0 < z then r*z else z)))`,
34625 REWRITE_TAC[GSYM mk_line_hyper2_e2];
34626 ASSUME_TAC h_compat;
34627 TSPEC `(u_scale r)` 1;
34628 TYPE_THEN `h_compat(u_scale r)` SUBAGOAL_TAC THENL [ASM_MESON_TAC[u_scale_h];ALL_TAC];
34630 UND 1 THEN (DISCH_THEN (TH_INTRO_TAC[`&0,z`;`&1,z`]));
34631 REWRITE_TAC[u_scale_point];
34632 (* Thu Sep 9 14:04:58 EDT 2004 *)
34637 let homeomorphism_compose = prove_by_refinement(
34638 `!U V W (f:A->B) (g:B->C). homeomorphism f U V /\ homeomorphism g V W
34640 homeomorphism (g o f) U W`,
34643 REWRITE_TAC[homeomorphism];
34645 REWRITE_TAC[comp_comp];
34646 IMATCH_MP_TAC COMP_BIJ;
34650 IMATCH_MP_TAC continuous_comp;
34652 RULE_ASSUM_TAC (REWRITE_RULE[BIJ;SURJ]);
34653 REWRITE_TAC[IMAGE;SUBSET];
34654 FIRST_ASSUM IMATCH_MP_TAC ;
34656 REWRITE_TAC[IMAGE_o];
34657 FIRST_ASSUM IMATCH_MP_TAC ;
34661 let hyperplane1_inj = prove_by_refinement(
34662 `!z w. (hyperplane 2 e1 z = hyperplane 2 e1 w) ==> (z = w)`,
34665 REWRITE_TAC[e1; GSYM line2D_F];
34666 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
34667 USE 0 (REWRITE_RULE[]);
34668 TSPEC `point(z,&0)` 0;
34669 RULE_ASSUM_TAC (REWRITE_RULE[point_inj]);
34671 TYPE_THEN `(?p. (z,&0 = p) /\ (FST p = z))` SUBAGOAL_TAC;
34672 CONV_TAC (dropq_conv "p");
34677 let hyperplane2_inj = prove_by_refinement(
34678 `!z w. (hyperplane 2 e2 z = hyperplane 2 e2 w) ==> (z = w)`,
34681 REWRITE_TAC[e2; GSYM line2D_S];
34682 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
34683 USE 0 (REWRITE_RULE[]);
34684 TSPEC `point(z,z)` 0;
34685 RULE_ASSUM_TAC (REWRITE_RULE[point_inj]);
34687 TYPE_THEN `(?p. (z,z = p) /\ (SND p = z))` SUBAGOAL_TAC;
34688 CONV_TAC (dropq_conv "p");
34693 let graph_support_init = prove_by_refinement(
34694 `!(G:(A,B)graph_t). (planar_graph G) /\
34695 FINITE (graph_edge G) /\
34696 FINITE (graph_vertex G) /\
34697 ~(graph_edge G = {}) /\
34698 (!v. CARD (graph_edge_around G v) <=| 4)
34699 ==> (?H E. graph_isomorphic G H /\
34700 (FINITE E) /\ (good_plane_graph H) /\
34701 (!e. (graph_edge H e ==> e SUBSET UNIONS E)) /\
34702 (!v. (graph_vertex H v ==>
34703 E (hyperplane 2 e1 (v 0)) /\ E (hyperplane 2 e2 (v 1)))) /\
34706 ((e = hyperplane 2 e1 z) \/ (e = hyperplane 2 e2 z))))))`,
34710 TH_INTRO_TAC[`G`] graph_near_support;
34711 TYPE_THEN `EH = E INTER { h | ?z. (h = hyperplane 2 e1 z) }` ABBREV_TAC ;
34712 TYPE_THEN `EV = E INTER {h | ?z. (h = hyperplane 2 e2 z) }` ABBREV_TAC ;
34713 TYPE_THEN `E = EH UNION EV` SUBAGOAL_TAC;
34714 IMATCH_MP_TAC SUBSET_ANTISYM;
34716 TYPE_THEN `EH` UNABBREV_TAC;
34717 TYPE_THEN `EV` UNABBREV_TAC;
34718 REWRITE_TAC[SUBSET;INTER;UNION];
34720 REWRITE_TAC[UNION;SUBSET];
34721 TYPE_THEN `EH` UNABBREV_TAC;
34722 TYPE_THEN `EV` UNABBREV_TAC;
34723 RULE_ASSUM_TAC (REWRITE_RULE[INTER;GSYM LEFT_AND_OVER_OR]);
34725 TYPE_THEN `FINITE EH /\ FINITE EV` SUBAGOAL_TAC;
34727 USE 13 (MATCH_MP union_imp_subset);
34728 ASM_MESON_TAC[FINITE_SUBSET];
34729 (*** Modified by JRH for new theorem name
34730 TH_INTRO_TAC[`(\ z. (hyperplane 2 e1 z))`;`UNIV:real->bool`;`EH`] FINITE_SUBSET_IMAGE;
34732 TH_INTRO_TAC[`(\ z. (hyperplane 2 e1 z))`;`UNIV:real->bool`;`EH`] FINITE_SUBSET_IMAGE_IMP;
34733 TYPE_THEN `EH` UNABBREV_TAC;
34734 REWRITE_TAC[INTER;SUBSET;IMAGE;UNIV];
34735 (*** Modified by JRH for new theorem name
34736 TH_INTRO_TAC[`(\ z. (hyperplane 2 e2 z))`;`UNIV:real->bool`;`EV`] FINITE_SUBSET_IMAGE;
34738 TH_INTRO_TAC[`(\ z. (hyperplane 2 e2 z))`;`UNIV:real->bool`;`EV`] FINITE_SUBSET_IMAGE_IMP;
34739 TYPE_THEN `EV` UNABBREV_TAC;
34740 REWRITE_TAC[INTER;SUBSET;IMAGE;UNIV];
34742 WITH 21 (MATCH_MP finite_LB);
34743 WITH 18 (MATCH_MP finite_LB);
34744 TYPE_THEN `f = (h_translate (&1 - t')) o (v_translate (&1 - t))` ABBREV_TAC ;
34745 TYPE_THEN `plane_graph_image f H` EXISTS_TAC;
34746 TYPE_THEN `IMAGE2 f E` EXISTS_TAC;
34748 TYPE_THEN `homeomorphism f top2 top2` SUBAGOAL_TAC;
34749 TYPE_THEN `f` UNABBREV_TAC;
34750 IMATCH_MP_TAC homeomorphism_compose;
34751 TYPE_THEN `top2` EXISTS_TAC;
34752 REWRITE_TAC[v_translate_hom;h_translate_hom];
34754 TYPE_THEN `graph_isomorphic H (plane_graph_image f H)` SUBAGOAL_TAC;
34755 IMATCH_MP_TAC plane_graph_image_iso;
34756 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph]);
34759 TH_INTRO_TAC[`G`;`H`;`plane_graph_image f H`] graph_isomorphic_trans;
34762 REWRITE_TAC[IMAGE2];
34763 IMATCH_MP_TAC FINITE_IMAGE;
34764 ASM_REWRITE_TAC[FINITE_UNION];
34767 IMATCH_MP_TAC plane_graph_image_plane;
34769 TYPE_THEN `!z. IMAGE f (hyperplane 2 e1 z) = hyperplane 2 e1 (z - t' + &1)` SUBAGOAL_TAC;
34770 TYPE_THEN `f` UNABBREV_TAC;
34771 REWRITE_TAC[IMAGE_o;hyperplane1_v_translate;hyperplane1_h_translate];
34774 TYPE_THEN `!z. IMAGE f (hyperplane 2 e2 z) = hyperplane 2 e2 (z - t + &1)` SUBAGOAL_TAC;
34775 TYPE_THEN `f` UNABBREV_TAC;
34776 REWRITE_TAC[IMAGE_o;hyperplane2_v_translate;hyperplane2_h_translate];
34779 REWRITE_TAC[IMAGE2;GSYM image_unions;];
34780 REWRITE_TAC[plane_graph_image_e;plane_graph_image_v;IMAGE2];
34783 TYPE_THEN `g = IMAGE f` ABBREV_TAC ;
34784 USE 29 (REWRITE_RULE[IMAGE]);
34785 TYPE_THEN `g` UNABBREV_TAC;
34786 IMATCH_MP_TAC IMAGE_SUBSET;
34788 FIRST_ASSUM IMATCH_MP_TAC ;
34792 USE 29 (REWRITE_RULE[IMAGE]);
34793 TYPE_THEN `euclid 2 x` SUBAGOAL_TAC;
34794 RULE_ASSUM_TAC (REWRITE_RULE[good_plane_graph;plane_graph;SUBSET]);
34795 USE 31 (MATCH_MP point_onto);
34796 TYPE_THEN `x` UNABBREV_TAC;
34797 TYPE_THEN `v` UNABBREV_TAC;
34798 TYPE_THEN `f (point p) = point(FST p - t' + &1 , SND p - t + &1)` SUBAGOAL_TAC;
34799 TYPE_THEN `f` UNABBREV_TAC;
34800 TYPE_THEN `p = FST p,SND p` SUBAGOAL_TAC;
34801 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[h_translate_point;v_translate_point;o_DEF ;];
34802 PURE_ONCE_ASM_REWRITE_TAC[] THEN PURE_REWRITE_TAC[h_translate_point;v_translate_point;o_DEF ;];
34803 REWRITE_TAC[point_inj ;PAIR_SPLIT];
34809 IMATCH_MP_TAC image_imp;
34810 RULE_ASSUM_TAC (REWRITE_RULE[coord01]);
34811 IMATCH_MP_TAC image_imp;
34812 RULE_ASSUM_TAC (REWRITE_RULE[coord01]);
34814 TYPE_THEN `g = IMAGE f` ABBREV_TAC ;
34815 USE 29 (REWRITE_RULE[IMAGE]);
34816 TYPE_THEN `EH x \/ EV x` SUBAGOAL_TAC;
34817 TYPE_THEN `E` UNABBREV_TAC;
34818 RULE_ASSUM_TAC (REWRITE_RULE[UNION]);
34819 FIRST_ASSUM DISJ_CASES_TAC;
34820 TYPE_THEN `EH` UNABBREV_TAC;
34821 RULE_ASSUM_TAC (REWRITE_RULE[INTER]);
34823 TYPE_THEN `z - t' + &1` EXISTS_TAC;
34824 TYPE_THEN `s' z` SUBAGOAL_TAC;
34825 USE 16 (REWRITE_RULE[SUBSET;IMAGE]);
34831 TYPE_THEN `z = x'` SUBAGOAL_TAC;
34832 IMATCH_MP_TAC hyperplane1_inj;
34835 UND 23 THEN REAL_ARITH_TAC;
34836 TYPE_THEN `EV` UNABBREV_TAC;
34837 RULE_ASSUM_TAC (REWRITE_RULE[INTER]);
34839 TYPE_THEN `z - t + &1` EXISTS_TAC;
34840 TYPE_THEN `s'' z` SUBAGOAL_TAC;
34841 USE 19 (REWRITE_RULE[SUBSET;IMAGE]);
34847 TYPE_THEN `z = x'` SUBAGOAL_TAC;
34848 IMATCH_MP_TAC hyperplane2_inj;
34851 UND 22 THEN REAL_ARITH_TAC;
34852 (* Thu Sep 9 17:00:37 EDT 2004 *)
34857 let hyperplane_ne = prove_by_refinement(
34858 `!z z'. ~(hyperplane 2 e1 z = hyperplane 2 e2 z')`,
34861 REWRITE_TAC[e1;e2;GSYM line2D_S;GSYM line2D_F];
34862 RULE_ASSUM_TAC (ONCE_REWRITE_RULE[FUN_EQ_THM]);
34863 TSPEC `point(z, z'+ &1)` 0;
34865 RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT;point_inj]);
34867 TYPE_THEN `(?p. ((z = FST p) /\ (z' + &1 = SND p)) /\ (FST p = z))` SUBAGOAL_TAC;
34868 TYPE_THEN `(z,z' + &1)` EXISTS_TAC;
34869 ASSUME_TAC (REAL_ARITH `~(z' + &1 = z')`);
34875 (* ------------------------------------------------------------------ *)
34877 (* ------------------------------------------------------------------ *)
34880 extend_simp_rewrites[UNION_EMPTY ];;
34882 let inductive_set_restrict = prove_by_refinement(
34883 `!G A S. inductive_set G S /\
34884 ~(S INTER A = EMPTY) /\
34885 segment A /\ A SUBSET G ==> inductive_set A (S INTER A)`,
34888 REWRITE_TAC[inductive_set];
34890 REWRITE_TAC[INTER;SUBSET];
34891 REWRITE_TAC[INTER];
34892 FIRST_ASSUM IMATCH_MP_TAC ;
34893 RULE_ASSUM_TAC (REWRITE_RULE[INTER]);
34895 ASM_MESON_TAC[ISUBSET];
34899 let inductive_set_adj = prove_by_refinement(
34900 `!A B S m. inductive_set (A UNION B) S /\ (endpoint B m) /\
34901 (FINITE A) /\ (FINITE B) /\
34902 (endpoint A m) /\ (A SUBSET S) ==> (~(S INTER B = EMPTY)) `,
34906 TYPE_THEN `?e. A e /\ closure top2 e (pointI m)` SUBAGOAL_TAC;
34907 TYPE_THEN `terminal_edge A m` EXISTS_TAC;
34908 IMATCH_MP_TAC terminal_endpoint;
34909 TYPE_THEN `?e'. B e' /\ closure top2 e' (pointI m)` SUBAGOAL_TAC;
34910 TYPE_THEN `terminal_edge B m` EXISTS_TAC;
34911 IMATCH_MP_TAC terminal_endpoint;
34912 RULE_ASSUM_TAC (REWRITE_RULE[inductive_set]);
34916 TYPE_THEN `e = e'` ASM_CASES_TAC;
34917 TYPE_THEN `e'` UNABBREV_TAC;
34918 RULE_ASSUM_TAC (REWRITE_RULE[SUBSET ;EQ_EMPTY;INTER; ]);
34921 TYPE_THEN `S e /\ (A UNION B) e' /\ adj e e'` SUBAGOAL_TAC;
34923 ASM_MESON_TAC[ISUBSET];
34925 REWRITE_TAC[UNION];
34927 REWRITE_TAC[EMPTY_EXISTS;INTER;];
34930 RULE_ASSUM_TAC (REWRITE_RULE[EQ_EMPTY ;INTER]);
34935 let inductive_set_join = prove_by_refinement(
34936 `!A B S . ~(S INTER A = EMPTY) /\ (segment B) /\ (segment A) /\
34937 (?m. endpoint A m /\ endpoint B m) /\
34938 (inductive_set (A UNION B) S) ==>
34939 (S = (A UNION B))`,
34943 TH_INTRO_TAC[`A UNION B`;`A`;`S`] inductive_set_restrict;
34944 REWRITE_TAC[SUBSET;UNION];
34946 TYPE_THEN `(S INTER A) = A` SUBAGOAL_TAC;
34947 USE 6 (REWRITE_RULE[inductive_set]);
34948 USE 3 (REWRITE_RULE[segment]);
34949 FIRST_ASSUM IMATCH_MP_TAC ;
34951 TYPE_THEN `A SUBSET S` SUBAGOAL_TAC;
34952 UND 7 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t]);
34953 REWRITE_TAC[INTER;SUBSET];
34955 TH_INTRO_TAC [`A`;`B`;`S`;`m`] inductive_set_adj;
34956 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
34958 TH_INTRO_TAC[`A UNION B`;`B`;`S`] inductive_set_restrict;
34959 REWRITE_TAC[SUBSET;UNION];
34960 TYPE_THEN `(S INTER B) = B` SUBAGOAL_TAC;
34961 USE 10 (REWRITE_RULE[inductive_set]);
34962 USE 4 (REWRITE_RULE[segment]);
34963 FIRST_ASSUM IMATCH_MP_TAC ;
34965 TYPE_THEN `B SUBSET S` SUBAGOAL_TAC;
34966 UND 11 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t]);
34967 REWRITE_TAC[INTER;SUBSET];
34968 IMATCH_MP_TAC SUBSET_ANTISYM;
34969 USE 0 (REWRITE_RULE[inductive_set]);
34970 REWRITE_TAC[union_subset];
34974 let segment_union = prove_by_refinement(
34975 `!A B m. segment A /\ segment B /\
34976 endpoint A m /\ endpoint B m /\
34977 (A INTER B = EMPTY) /\
34978 (!n. (0 < num_closure A (pointI n)) /\
34979 (0 < num_closure B (pointI n)) ==> (n = m) )
34981 segment (A UNION B)` ,
34986 TYPE_THEN `FINITE A /\ FINITE B` SUBAGOAL_TAC;
34987 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
34989 REWRITE_TAC[segment];
34990 ASM_REWRITE_TAC[FINITE_UNION];
34993 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
34994 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
34995 UND 8 THEN REWRITE_TAC[EMPTY_EXISTS;UNION];
34996 TYPE_THEN `u` EXISTS_TAC;
34999 REWRITE_TAC[union_subset];
35000 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35002 TYPE_THEN `!m'. { C | (A UNION B) C /\ closure top2 C (pointI m')} = {C | A C /\ closure top2 C (pointI m')} UNION {C | B C /\ closure top2 C (pointI m')}` SUBAGOAL_TAC;
35003 IMATCH_MP_TAC EQ_EXT;
35004 REWRITE_TAC[UNION];
35005 TYPE_THEN `A x` ASM_CASES_TAC;
35006 RULE_ASSUM_TAC (REWRITE_RULE[EQ_EMPTY;INTER]);
35009 TYPE_THEN `!m. num_closure(A UNION B) (pointI m) = num_closure A (pointI m) + num_closure B (pointI m)` SUBAGOAL_TAC;
35010 REWRITE_TAC[num_closure];
35011 IMATCH_MP_TAC (CARD_UNION);
35013 IMATCH_MP_TAC FINITE_SUBSET;
35014 TYPE_THEN `A` EXISTS_TAC;
35015 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35016 REWRITE_TAC[SUBSET];
35018 IMATCH_MP_TAC FINITE_SUBSET;
35019 TYPE_THEN `B` EXISTS_TAC;
35020 REWRITE_TAC[SUBSET];
35021 REWRITE_TAC[EQ_EMPTY ];
35022 RULE_ASSUM_TAC (REWRITE_RULE[EQ_EMPTY;INTER ]);
35026 TYPE_THEN `num_closure A (pointI m') = 0` ASM_CASES_TAC;
35028 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35029 TYPE_THEN `num_closure B (pointI m') = 0` ASM_CASES_TAC;
35031 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35032 UND 10 THEN UND 11 THEN REWRITE_TAC [ARITH_RULE `~(x = 0) <=> (0 < x)`];
35033 TYPE_THEN `m' = m` SUBAGOAL_TAC;
35034 FIRST_ASSUM IMATCH_MP_TAC ;
35035 RULE_ASSUM_TAC (REWRITE_RULE[endpoint]);
35036 REWRITE_TAC[ARITH_RULE `1+ 1 = 2`;INR IN_INSERT];
35038 TYPE_THEN `inductive_set (A UNION B) S` SUBAGOAL_TAC;
35039 REWRITE_TAC[inductive_set];
35042 TYPE_THEN `~(S INTER A = EMPTY)` ASM_CASES_TAC;
35044 IMATCH_MP_TAC inductive_set_join;
35047 TYPE_THEN `~(S INTER B = EMPTY)` SUBAGOAL_TAC;
35048 UND 15 THEN UND 14 THEN UND 11 THEN UND 12 THEN REWRITE_TAC[INTER;EQ_EMPTY;SUBSET;UNION] THEN MESON_TAC[];
35050 ONCE_REWRITE_TAC [UNION_COMM];
35051 IMATCH_MP_TAC inductive_set_join;
35052 ONCE_REWRITE_TAC [UNION_COMM];
35057 let two_endpoint_segment = prove_by_refinement(
35058 `!C p q m. segment C /\ endpoint C q /\ endpoint C p /\ endpoint C m /\
35060 (q = m) \/ (q = p)`,
35064 TYPE_THEN `psegment C` SUBAGOAL_TAC;
35065 IMATCH_MP_TAC endpoint_psegment;
35068 TH_INTRO_TAC[`C`] endpoint_size2;
35069 IMATCH_MP_TAC (TAUT `(~A ==> B) ==> (A \/ B)`);
35070 IMATCH_MP_TAC two_exclusion;
35075 let EQ_ANTISYM = prove_by_refinement(
35076 `!A B. (A ==>B) /\ (B ==> A) ==> (A = B)`,
35083 let segment_union2 = prove_by_refinement(
35084 `!A B m p. segment A /\ segment B /\ ~(m = p) /\
35085 endpoint A m /\ endpoint B m /\
35086 endpoint A p /\ endpoint B p /\
35087 (A INTER B = EMPTY) /\
35088 (!n. (0 < num_closure A (pointI n)) /\ (0 < num_closure B (pointI n)) <=>
35089 (((n = m ) \/ (n = p) )))
35091 rectagon (A UNION B)`,
35095 TYPE_THEN `FINITE A /\ FINITE B` SUBAGOAL_TAC;
35096 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35098 REWRITE_TAC[rectagon];
35099 ASM_REWRITE_TAC[FINITE_UNION];
35102 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35103 RULE_ASSUM_TAC (REWRITE_RULE[EMPTY_EXISTS]);
35104 UND 11 THEN REWRITE_TAC[EMPTY_EXISTS;UNION];
35105 TYPE_THEN `u` EXISTS_TAC;
35108 REWRITE_TAC[union_subset];
35109 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35111 TYPE_THEN `!m'. { C | (A UNION B) C /\ closure top2 C (pointI m')} = {C | A C /\ closure top2 C (pointI m')} UNION {C | B C /\ closure top2 C (pointI m')}` SUBAGOAL_TAC;
35112 IMATCH_MP_TAC EQ_EXT;
35113 REWRITE_TAC[UNION];
35114 TYPE_THEN `A x` ASM_CASES_TAC;
35115 RULE_ASSUM_TAC (REWRITE_RULE[EQ_EMPTY;INTER]);
35119 TYPE_THEN `!m. num_closure(A UNION B) (pointI m) = num_closure A (pointI m) + num_closure B (pointI m)` SUBAGOAL_TAC;
35120 REWRITE_TAC[num_closure];
35121 IMATCH_MP_TAC (CARD_UNION);
35123 IMATCH_MP_TAC FINITE_SUBSET;
35124 TYPE_THEN `A` EXISTS_TAC;
35125 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35126 REWRITE_TAC[SUBSET];
35128 IMATCH_MP_TAC FINITE_SUBSET;
35129 TYPE_THEN `B` EXISTS_TAC;
35130 REWRITE_TAC[SUBSET];
35131 REWRITE_TAC[EQ_EMPTY ];
35132 RULE_ASSUM_TAC (REWRITE_RULE[EQ_EMPTY;INTER ]);
35135 TYPE_THEN `!q. endpoint A q ==> (q = m) \/ (q = p)` SUBAGOAL_TAC;
35136 IMATCH_MP_TAC two_endpoint_segment;
35138 TYPE_THEN `!q. endpoint B q ==> (q = m) \/ (q = p)` SUBAGOAL_TAC;
35139 IMATCH_MP_TAC two_endpoint_segment;
35140 TYPE_THEN `B` EXISTS_TAC;
35143 TYPE_THEN `!m. (num_closure A (pointI m) = 1) <=> (num_closure B (pointI m) = 1)` SUBAGOAL_TAC;
35144 IMATCH_MP_TAC EQ_ANTISYM;
35145 RULE_ASSUM_TAC (REWRITE_RULE[endpoint]);
35148 FIRST_ASSUM DISJ_CASES_TAC;
35152 FIRST_ASSUM DISJ_CASES_TAC;
35157 FULL_REWRITE_TAC[endpoint];
35158 TYPE_THEN `!x. {0, 2} x <=> {0, 1, 2} x /\ ~(x = 1)` SUBAGOAL_TAC;
35159 REWRITE_TAC[INSERT];
35162 TYPE_THEN `num_closure A (pointI m') = 0` ASM_CASES_TAC;
35164 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35167 UND 25 THEN ARITH_TAC;
35169 TYPE_THEN `num_closure B (pointI m') = 0` ASM_CASES_TAC;
35171 RULE_ASSUM_TAC (REWRITE_RULE[segment]);
35173 FULL_REWRITE_TAC [ARITH_RULE `~(x = 0) <=> (0 < x)`];
35174 TYPE_THEN `(m' = m) \/ (m' = p)` SUBAGOAL_TAC;
35177 TYPE_THEN `num_closure A (pointI m') = 1` SUBAGOAL_TAC;
35178 FIRST_ASSUM DISJ_CASES_TAC;
35181 TYPE_THEN `num_closure B (pointI m') = 1` SUBAGOAL_TAC;
35182 FIRST_ASSUM DISJ_CASES_TAC;
35185 REWRITE_TAC[ARITH_RULE `1+ 1 = 2`;INR IN_INSERT;ARITH_RULE `~(2 = 1)`];
35187 TYPE_THEN `inductive_set (A UNION B) S` SUBAGOAL_TAC;
35188 REWRITE_TAC[inductive_set];
35191 TYPE_THEN `~(S INTER A = EMPTY)` ASM_CASES_TAC;
35193 IMATCH_MP_TAC inductive_set_join;
35196 TYPE_THEN `~(S INTER B = EMPTY)` SUBAGOAL_TAC;
35197 UND 20 THEN UND 21 THEN UND 17 THEN UND 18 THEN REWRITE_TAC[INTER;EQ_EMPTY;SUBSET;UNION] THEN MESON_TAC[];
35199 ONCE_REWRITE_TAC [UNION_COMM];
35200 IMATCH_MP_TAC inductive_set_join;
35201 ONCE_REWRITE_TAC [UNION_COMM];
35206 let card_inj = prove_by_refinement(
35207 `!(f:A->B) A B. INJ f A B /\ FINITE B ==> (CARD A <= CARD B)`,
35211 TYPE_THEN `CARD (IMAGE f A) = CARD A` SUBAGOAL_TAC;
35212 IMATCH_MP_TAC CARD_IMAGE_INJ;
35214 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
35215 FIRST_ASSUM IMATCH_MP_TAC ;
35216 IMATCH_MP_TAC FINITE_INJ;
35219 IMATCH_MP_TAC CARD_SUBSET;
35220 RULE_ASSUM_TAC (REWRITE_RULE[INJ]);
35221 REWRITE_TAC[IMAGE;SUBSET];
35222 FIRST_ASSUM IMATCH_MP_TAC ;
35226 let inj_bij_size = prove_by_refinement(
35227 `!A B (f:A->B). INJ f A B /\ B HAS_SIZE (CARD A) ==> BIJ f A B`,
35230 REWRITE_TAC[HAS_SIZE];
35231 TH_INTRO_TAC [`f`;`A`] inj_bij;
35232 FULL_REWRITE_TAC[INJ];
35234 TYPE_THEN `IMAGE f A = B` SUBAGOAL_TAC;
35235 IMATCH_MP_TAC CARD_SUBSET_EQ;
35237 FULL_REWRITE_TAC[INJ];
35238 REWRITE_TAC[IMAGE;SUBSET];
35240 IMATCH_MP_TAC EQ_SYM;
35241 IMATCH_MP_TAC BIJ_CARD;
35243 ASM_MESON_TAC[FINITE_INJ];
35248 let bij_empty = prove_by_refinement(
35249 `!(f:A->B). BIJ f EMPTY EMPTY `,
35252 REWRITE_TAC[BIJ;INJ;SURJ];
35256 let bij_sing = prove_by_refinement(
35257 `!(f:A->B) a b. BIJ f {a} {b} <=> (f a = b)`,
35260 REWRITE_TAC[BIJ;INJ;SURJ;INR IN_SING ];
35265 let card_sing = prove_by_refinement(
35266 `!(a:A). (CARD {a} = 1)`,
35270 THM_INTRO_TAC[`a`;`EMPTY:A->bool`] card_suc_insert;
35271 REWRITE_TAC[FINITE_RULES];
35272 FULL_REWRITE_TAC[CARD_CLAUSES];
35273 TYPE_THEN `CARD {a}` UNABBREV_TAC;
35278 let pair_indistinct = prove_by_refinement(
35279 `!(a:A). {a,a} = {a}`,
35282 MESON_TAC[INR ABSORPTION;INR COMPONENT];
35286 let has_size2_distinct = prove_by_refinement(
35287 `!(a:A) b. {a,b} HAS_SIZE 2 ==> ~(a = b)`,
35291 TYPE_THEN `b` UNABBREV_TAC;
35292 FULL_REWRITE_TAC [pair_indistinct];
35293 THM_INTRO_TAC[`a`] sing_has_size1;
35294 FULL_REWRITE_TAC[HAS_SIZE];
35295 UND 0 THEN UND 2 THEN ARITH_TAC;
35299 let has_size2_subset = prove_by_refinement(
35300 `!X (a:A) b. X HAS_SIZE 2 /\ X SUBSET {a,b} ==> (X = {a,b})`,
35304 FULL_REWRITE_TAC [has_size2];
35305 TYPE_THEN `X` UNABBREV_TAC;
35306 IMATCH_MP_TAC SUBSET_ANTISYM;
35307 FULL_REWRITE_TAC[SUBSET;in_pair];
35308 FIRST_ASSUM DISJ_CASES_TAC;
35309 TYPE_THEN `x` UNABBREV_TAC;
35318 let inj_subset2 = prove_by_refinement(
35319 `!t t' s (f:A->B). INJ f s t /\ t SUBSET t' ==> INJ f s t'`,
35322 REWRITE_TAC[INJ;SUBSET;];
35324 FIRST_ASSUM IMATCH_MP_TAC;
35325 FIRST_ASSUM IMATCH_MP_TAC ;
35329 let terminal_adj = prove_by_refinement(
35330 `!E b. segment E /\ endpoint E b /\ ~(SING E) ==>
35331 (?!e. E e /\ adj (terminal_edge E b) e )`,
35335 REWRITE_TAC[EXISTS_UNIQUE_ALT];
35336 THM_INTRO_TAC[`E`;`b`] terminal_endpoint;
35337 FULL_REWRITE_TAC[segment];
35339 THM_INTRO_TAC[`terminal_edge E b`] two_endpoint;
35340 FULL_REWRITE_TAC[segment;ISUBSET];
35342 FULL_REWRITE_TAC[has_size2];
35343 USE 6 (REWRITE_RULE[FUN_EQ_THM]);
35344 TYPE_THEN `?x. !y. (closure top2 (terminal_edge E b) (pointI y) <=> ((y = x) \/ (y = b)))` SUBAGOAL_TAC;
35345 USE 6 (REWRITE_RULE[in_pair]);
35346 REWRITE_TAC[in_pair];
35347 TYPE_THEN `(b = b') \/ (b = a)` SUBAGOAL_TAC;
35349 FIRST_ASSUM DISJ_CASES_TAC ;
35350 TYPE_THEN `a` EXISTS_TAC;
35352 TYPE_THEN `b'` EXISTS_TAC;
35354 TYPE_THEN `!e. (adj (terminal_edge E b) e /\ (E e) ==> (closure top2 e (pointI x)))` SUBAGOAL_TAC;
35355 THM_INTRO_TAC[`terminal_edge E b`;`e`] edge_inter;
35356 ASM_MESON_TAC[segment;ISUBSET];
35357 FULL_REWRITE_TAC[INTER;eq_sing];
35360 FIRST_ASSUM DISJ_CASES_TAC;
35362 FULL_REWRITE_TAC[endpoint];
35363 THM_INTRO_TAC[`E`;`(pointI b)`] num_closure1;
35364 FULL_REWRITE_TAC[segment];
35367 TSPEC `terminal_edge E b` 15;
35369 TYPE_THEN `e' = terminal_edge E b` SUBAGOAL_TAC;
35371 TYPE_THEN `e' = e` SUBAGOAL_TAC;
35373 FULL_REWRITE_TAC[adj];
35374 UND 18 THEN UND 17 THEN UND 16 THEN MESON_TAC[];
35376 THM_INTRO_TAC[`E`;`terminal_edge E b`] midpoint_exists;
35377 FULL_REWRITE_TAC[SING];
35379 TSPEC `terminal_edge E b` 0;
35382 FULL_REWRITE_TAC[midpoint];
35383 THM_INTRO_TAC[`E`;`(pointI m)`] num_closure2;
35384 FULL_REWRITE_TAC[segment];
35387 TYPE_THEN `?c. ~(terminal_edge E b = c) /\ (E c) /\ (closure top2 c (pointI m))` SUBAGOAL_TAC;
35389 TSPEC `terminal_edge E b` 11;
35391 FIRST_ASSUM DISJ_CASES_TAC;
35392 TYPE_THEN `b''` EXISTS_TAC;
35393 TYPE_THEN `a'` EXISTS_TAC;
35395 TYPE_THEN `c` EXISTS_TAC;
35399 TYPE_THEN `adj (terminal_edge E b) c` SUBAGOAL_TAC;
35401 REWRITE_TAC[EMPTY_EXISTS;INTER;];
35402 TYPE_THEN `pointI m` EXISTS_TAC;
35404 IMATCH_MP_TAC EQ_ANTISYM ;
35406 TYPE_THEN `closure top2 y (pointI x)` SUBAGOAL_TAC;
35407 FIRST_ASSUM IMATCH_MP_TAC ;
35408 TYPE_THEN `closure top2 c (pointI x)` SUBAGOAL_TAC;
35409 FIRST_ASSUM IMATCH_MP_TAC ;
35411 TYPE_THEN `closure top2 (terminal_edge E b) (pointI x)` SUBAGOAL_TAC;
35412 TYPE_THEN `({0,1,2} (num_closure E (pointI x)))` SUBAGOAL_TAC;
35413 UND 2 THEN MESON_TAC[segment];
35414 FULL_REWRITE_TAC[INSERT;];
35415 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
35416 FULL_REWRITE_TAC[segment];
35417 THM_INTRO_TAC[`E`;`(pointI x)`] num_closure0;
35419 THM_INTRO_TAC[`E`;`(pointI x)`] num_closure1;
35420 THM_INTRO_TAC[`E`;`(pointI x)`] num_closure2;
35422 UND 22 THEN REP_CASES_TAC ;
35423 TYPE_THEN `(terminal_edge E b = a'') \/ (terminal_edge E b = b''')` SUBAGOAL_TAC;
35424 TSPEC `terminal_edge E b` 22;
35426 TYPE_THEN `(c = a'') \/ (c = b''')` SUBAGOAL_TAC;
35429 TYPE_THEN `(y = a'') \/ (y = b''')` SUBAGOAL_TAC;
35432 FIRST_ASSUM DISJ_CASES_TAC;
35433 TYPE_THEN `a''` UNABBREV_TAC;
35434 PROOF_BY_CONTR_TAC;
35436 TYPE_THEN `b'''` UNABBREV_TAC;
35437 USE 18(REWRITE_RULE[adj]);
35438 UND 29 THEN UND 15 THEN UND 28 THEN MESON_TAC[];
35439 TYPE_THEN `b'''` UNABBREV_TAC;
35440 USE 18 (REWRITE_RULE[adj]);
35441 UND 31 THEN UND 15 THEN UND 29 THEN UND 28 THEN MESON_TAC[];
35443 UND 20 THEN UND 21 THEN UND 14 THEN UND 19 THEN UND 22 THEN MESON_TAC[];
35444 UND 22 THEN UND 19 THEN UND 20 THEN MESON_TAC[];
35446 TYPE_THEN `y` UNABBREV_TAC;
35450 let psegment_order_induct_lemma = prove_by_refinement(
35451 `!n. !E a b. psegment E /\ (CARD E = n) /\ (endpoint E a) /\
35452 (endpoint E b) /\ ~(a = b) ==>
35453 (?f. (BIJ f { p | p < n} E) /\ (f 0 = terminal_edge E a) /\
35454 ((0 < n) ==> (f (n - 1) = terminal_edge E b)) /\
35455 (!i j. (i < CARD E /\ j < CARD E) ==>
35456 (adj (f i) (f j) = ((SUC i = j) \/ (SUC j = i) ))))`,
35461 TYPE_THEN `f = (\ (x:num). terminal_edge E a)` ABBREV_TAC ;
35462 TYPE_THEN `f` EXISTS_TAC;
35463 TYPE_THEN `{ p | p < 0} = EMPTY` SUBAGOAL_TAC;
35464 REWRITE_TAC[EQ_EMPTY];
35465 UND 6 THEN ARITH_TAC;
35466 TYPE_THEN `E HAS_SIZE 0` SUBAGOAL_TAC;
35467 REWRITE_TAC[HAS_SIZE];
35468 FULL_REWRITE_TAC[psegment;segment];
35469 FULL_REWRITE_TAC[HAS_SIZE_0];
35470 REWRITE_TAC[ARITH_RULE `~(k <| 0)`;bij_empty];
35473 REWRITE_TAC[ARITH_RULE `0 <| SUC n /\ (SUC n - 1 = n)`];
35474 TYPE_THEN `n = 0` ASM_CASES_TAC;
35476 REWRITE_TAC[ARITH_RULE `i <| SUC 0 <=> (i = 0)`;];
35477 REWRITE_TAC[ARITH_RULE `~(SUC 0 = 0)`;adj];
35478 TYPE_THEN `n` UNABBREV_TAC;
35479 FULL_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`];
35480 TYPE_THEN `E HAS_SIZE 1` SUBAGOAL_TAC;
35481 FULL_REWRITE_TAC[HAS_SIZE;psegment;segment];
35482 USE 5(MATCH_MP CARD_SING_CONV);
35483 FULL_REWRITE_TAC[SING];
35484 TYPE_THEN `E` UNABBREV_TAC;
35485 TYPE_THEN `f = (\ (y:num). x )` ABBREV_TAC ;
35486 TYPE_THEN `f` EXISTS_TAC;
35487 TYPE_THEN `FINITE {x}` SUBAGOAL_TAC;
35488 FULL_REWRITE_TAC[psegment;segment];
35489 TYPE_THEN `{p | p = 0} = {0}` SUBAGOAL_TAC;
35490 IMATCH_MP_TAC EQ_EXT;
35491 REWRITE_TAC[INR IN_SING];
35493 TYPE_THEN `f 0 = x` SUBAGOAL_TAC;
35495 REWRITE_TAC[bij_sing];
35496 TH_INTRO_TAC[`{x}`;`a`] terminal_endpoint;
35497 TH_INTRO_TAC[`{x}`;`b`] terminal_endpoint;
35498 FULL_REWRITE_TAC[INR IN_SING];
35499 (* - A2 and above *)
35500 TYPE_THEN `e = terminal_edge E b` ABBREV_TAC ;
35501 TYPE_THEN `b' = other_end e b` ABBREV_TAC ;
35502 TYPE_THEN `E' = E DELETE e` ABBREV_TAC ;
35504 TYPE_THEN `E e /\ closure top2 e (pointI b)` SUBAGOAL_TAC;
35505 TYPE_THEN `e` UNABBREV_TAC;
35506 IMATCH_MP_TAC terminal_endpoint;
35507 RULE_ASSUM_TAC (REWRITE_RULE[psegment;segment]);
35509 TYPE_THEN `psegment E'` SUBAGOAL_TAC;
35510 REWRITE_TAC[psegment];
35512 TYPE_THEN `E'` UNABBREV_TAC;
35513 IMATCH_MP_TAC segment_delete;
35514 TYPE_THEN `b` EXISTS_TAC;
35515 RULE_ASSUM_TAC (REWRITE_RULE[psegment]);
35517 TYPE_THEN `E` UNABBREV_TAC;
35518 THM_INTRO_TAC [`e`] sing_has_size1;
35519 RULE_ASSUM_TAC (REWRITE_RULE[HAS_SIZE]);
35520 UND 12 THEN UND 3 THEN UND 6 THEN ARITH_TAC;
35521 THM_INTRO_TAC [`E'`;`E`] rectagon_subset;
35522 RULE_ASSUM_TAC (REWRITE_RULE[psegment]);
35523 TYPE_THEN `E'` UNABBREV_TAC;
35524 REWRITE_TAC[DELETE;SUBSET];
35525 TYPE_THEN `E'` UNABBREV_TAC;
35526 UND 13 THEN UND 11 THEN MESON_TAC[INR DELETE_NON_ELEMENT];
35528 TYPE_THEN `SUC (CARD E') = SUC n` SUBAGOAL_TAC;
35529 TYPE_THEN `E'` UNABBREV_TAC;
35530 TYPE_THEN `SUC n` UNABBREV_TAC;
35531 IMATCH_MP_TAC CARD_SUC_DELETE;
35532 FULL_REWRITE_TAC[psegment;segment];
35533 FULL_REWRITE_TAC[SUC_INJ];
35535 THM_INTRO_TAC [`E`;`b`;`e`] psegment_delete_end;
35537 TYPE_THEN `E` UNABBREV_TAC;
35538 FULL_REWRITE_TAC[card_sing];
35539 UND 3 THEN UND 6 THEN ARITH_TAC;
35541 TYPE_THEN `endpoint E' = {a,b'}` SUBAGOAL_TAC;
35542 IMATCH_MP_TAC has_size2_subset;
35544 IMATCH_MP_TAC endpoint_size2;
35545 TYPE_THEN `E'` UNABBREV_TAC;
35546 REWRITE_TAC[SUBSET;INSERT;DELETE];
35547 FIRST_ASSUM DISJ_CASES_TAC;
35548 THM_INTRO_TAC [`E`;`x`;`a`;`b`] two_endpoint_segment;
35549 FULL_REWRITE_TAC[psegment];
35551 THM_INTRO_TAC[`e`;`b`] other_end_prop;
35552 UND 4 THEN REWRITE_TAC[psegment;segment;SUBSET;];
35554 TYPE_THEN `{a,b'} HAS_SIZE 2` SUBAGOAL_TAC;
35555 TYPE_THEN `{a,b'}` UNABBREV_TAC;
35556 IMATCH_MP_TAC endpoint_size2;
35557 USE 16 (MATCH_MP has_size2_distinct);
35558 UND 5 THEN DISCH_THEN (THM_INTRO_TAC[`E'`;`a`;`b'`]);
35559 REWRITE_TAC[in_pair];
35561 TYPE_THEN `g = (\ i. if (i <| n) then f i else e)` ABBREV_TAC ;
35562 TYPE_THEN `!i. (i <| n) ==> (g i = f i)` SUBAGOAL_TAC;
35563 TYPE_THEN `g` UNABBREV_TAC;
35564 TYPE_THEN `g n = e` SUBAGOAL_TAC;
35565 TYPE_THEN `g` UNABBREV_TAC;
35566 REWRITE_TAC[ARITH_RULE `~(n <| n)`];
35567 TYPE_THEN `g` EXISTS_TAC;
35570 IMATCH_MP_TAC inj_bij_size;
35571 REWRITE_TAC[CARD_NUMSEG_LT];
35573 TYPE_THEN `{p | p <| SUC n} = {p | p <| n} UNION {n}` SUBAGOAL_TAC;
35574 IMATCH_MP_TAC EQ_EXT;
35575 REWRITE_TAC[UNION;INR IN_SING];
35577 IMATCH_MP_TAC inj_split;
35579 TYPE_THEN `INJ g {p | p <| n} E = INJ f {p | p <| n} E` SUBAGOAL_TAC;
35580 IMATCH_MP_TAC inj_domain_sub;
35581 USE 24 (REWRITE_RULE[]);
35582 RULE_ASSUM_TAC (REWRITE_RULE[BIJ]);
35584 IMATCH_MP_TAC inj_subset2;
35586 UND 9 THEN REWRITE_TAC[SUBSET;DELETE];
35587 TYPE_THEN `E'` UNABBREV_TAC;
35589 REWRITE_TAC[INJ;INR IN_SING;];
35591 REWRITE_TAC[IMAGE;INTER;EQ_EMPTY;INR IN_SING ];
35592 TYPE_THEN `x''` UNABBREV_TAC;
35593 TYPE_THEN `x` UNABBREV_TAC;
35594 TYPE_THEN `g n` UNABBREV_TAC;
35596 TYPE_THEN `g x'` UNABBREV_TAC;
35597 FULL_REWRITE_TAC[BIJ;SURJ];
35599 TYPE_THEN `E'` UNABBREV_TAC;
35600 FULL_REWRITE_TAC[DELETE];
35602 UND 4 THEN ASM_REWRITE_TAC[HAS_SIZE;psegment;segment;rectagon];
35604 TYPE_THEN `E' SUBSET E` SUBAGOAL_TAC;
35605 TYPE_THEN `E'` UNABBREV_TAC;
35606 REWRITE_TAC[DELETE;SUBSET];
35609 TYPE_THEN `0 <| n` SUBAGOAL_TAC;
35610 UND 6 THEN ARITH_TAC;
35611 TYPE_THEN `f 0` UNABBREV_TAC;
35613 TYPE_THEN `e' = terminal_edge E' a` ABBREV_TAC ;
35614 THM_INTRO_TAC[`E'`;`a`;`e'`] terminal_unique;
35615 REWRITE_TAC[INR in_pair];
35616 UND 12 THEN REWRITE_TAC[psegment;segment];
35617 TYPE_THEN `e'` UNABBREV_TAC;
35618 TYPE_THEN `g 0 ` UNABBREV_TAC;
35619 THM_INTRO_TAC[`E`;`a`;`terminal_edge E' a`] terminal_unique;
35620 UND 4 THEN (REWRITE_TAC[psegment;segment]);
35622 ASM_MESON_TAC[ISUBSET];
35624 TYPE_THEN `E' (terminal_edge E' b')` SUBAGOAL_TAC;
35625 THM_INTRO_TAC[`E'`;`b'`] terminal_endpoint;
35626 FULL_REWRITE_TAC[psegment;segment;INR in_pair ];
35628 TYPE_THEN `~(E' (terminal_edge E b))` SUBAGOAL_TAC;
35629 TYPE_THEN `E'` UNABBREV_TAC;
35630 FULL_REWRITE_TAC[DELETE];
35631 TYPE_THEN `terminal_edge E b` UNABBREV_TAC;
35633 TYPE_THEN `adj e (g (n - 1))` SUBAGOAL_TAC;
35634 TYPE_THEN `g (n - 1) = f (n-1 )` SUBAGOAL_TAC;
35635 TYPE_THEN `g` UNABBREV_TAC;
35636 TYPE_THEN `n - 1 < n` SUBAGOAL_TAC;
35637 UND 21 THEN ARITH_TAC;
35638 TYPE_THEN `f (n - 1)` UNABBREV_TAC;
35639 TYPE_THEN `e` UNABBREV_TAC;
35641 REWRITE_TAC[INTER;EMPTY_EXISTS];
35643 TYPE_THEN `g n` UNABBREV_TAC;
35645 TYPE_THEN `pointI b'` EXISTS_TAC;
35647 TYPE_THEN `b'` UNABBREV_TAC;
35648 THM_INTRO_TAC[`terminal_edge E b`;`b`]other_end_prop;
35649 FULL_REWRITE_TAC[psegment;segment;ISUBSET];
35650 THM_INTRO_TAC [`E'`;`b'`] terminal_endpoint;
35651 FULL_REWRITE_TAC[psegment;segment;in_pair];
35653 TYPE_THEN `!i. (i <| SUC n) ==> (adj (g n) (g i) = (SUC i = n))` SUBAGOAL_TAC;
35654 TYPE_THEN `( i' = n) \/ (i' <| n)` SUBAGOAL_TAC;
35655 UND 30 THEN ARITH_TAC;
35656 FIRST_ASSUM DISJ_CASES_TAC;
35660 THM_INTRO_TAC[`E`;`b`] terminal_adj;
35661 FULL_REWRITE_TAC[psegment];
35663 USE 35 (MATCH_MP CARD_SING);
35664 TYPE_THEN `CARD E` UNABBREV_TAC;
35665 UND 3 THEN UND 21 THEN ARITH_TAC;
35666 FULL_REWRITE_TAC[EXISTS_UNIQUE_ALT];
35667 TYPE_THEN `!i'. (i' <| n) ==> (adj e (g i') = (e' = (g i')))` SUBAGOAL_TAC;
35669 TYPE_THEN `E (g i'')` SUBAGOAL_TAC;
35670 FULL_REWRITE_TAC[BIJ;SURJ];
35671 FIRST_ASSUM IMATCH_MP_TAC ;
35672 UND 34 THEN ARITH_TAC;
35674 IMATCH_MP_TAC EQ_ANTISYM;
35676 TYPE_THEN `e'` UNABBREV_TAC;
35678 TYPE_THEN `n - 1 < n` SUBAGOAL_TAC;
35679 UND 21 THEN ARITH_TAC;
35680 TYPE_THEN `(g i' = g (n - 1)) ==> (SUC i' = n)` SUBAGOAL_TAC;
35681 FULL_REWRITE_TAC [BIJ;INJ];
35682 IMATCH_MP_TAC (ARITH_RULE `((i' = n - 1) /\ (0 < n)) ==> (SUC i' = n)` );
35683 FIRST_ASSUM IMATCH_MP_TAC ;
35685 FIRST_ASSUM IMATCH_MP_TAC ;
35688 TYPE_THEN `i' = n - 1` SUBAGOAL_TAC;
35689 UND 35 THEN UND 21 THEN ARITH_TAC;
35691 TYPE_THEN `i'` UNABBREV_TAC;
35694 TYPE_THEN `(i = n) \/ (i <| n)` SUBAGOAL_TAC;
35695 UND 26 THEN ARITH_TAC;
35696 FIRST_ASSUM DISJ_CASES_TAC;
35698 UND 30 THEN ARITH_TAC;
35700 TYPE_THEN `(j = n) \/ (j <| n)` SUBAGOAL_TAC;
35701 UND 25 THEN ARITH_TAC;
35702 FIRST_ASSUM DISJ_CASES_TAC;
35703 ONCE_REWRITE_TAC [adj_symm];
35704 UND 26 THEN ARITH_TAC;
35706 TYPE_THEN `g` UNABBREV_TAC;
35707 FIRST_ASSUM IMATCH_MP_TAC ;
35713 (* a couple of variants *)
35714 let psegment_order = prove_by_refinement(
35715 `!E a b. psegment E /\ (endpoint E a) /\
35716 (endpoint E b) /\ ~(a = b) ==>
35717 (?f. (BIJ f { p | p < CARD E} E) /\ (f 0 = terminal_edge E a) /\
35718 ((0 < CARD E) ==> (f (CARD E - 1) = terminal_edge E b)) /\
35719 (!i j. (i < CARD E /\ j < CARD E) ==>
35720 (adj (f i) (f j) = ((SUC i = j) \/ (SUC j = i) ))))`,
35724 THM_INTRO_TAC[`CARD E`;`E`;`a`;`b`] psegment_order_induct_lemma;
35729 let psegment_order' = prove_by_refinement(
35730 `!A m. psegment A /\ endpoint A m ==>
35731 (?f. BIJ f {p | p < CARD A} A /\
35732 (f 0 = terminal_edge A m) /\
35733 (!i j. (i < CARD A /\ j < CARD A) ==>
35734 (adj (f i) (f j) = ((SUC i = j) \/ (SUC j = i) ))))`,
35738 THM_INTRO_TAC[`A`] endpoint_size2;
35739 FULL_REWRITE_TAC[has_size2];
35740 TYPE_THEN `?n. (endpoint A n) /\ ~(m = n)` SUBAGOAL_TAC;
35742 FULL_REWRITE_TAC[in_pair];
35743 FIRST_ASSUM DISJ_CASES_TAC;
35744 TYPE_THEN `a` EXISTS_TAC;
35745 TYPE_THEN `b` EXISTS_TAC;
35746 THM_INTRO_TAC[`A`;`m`;`n`] psegment_order;
35747 TYPE_THEN `f` EXISTS_TAC;
35752 let order_imp_psegment = prove_by_refinement(
35753 `!f n. (INJ f { p | p < n} (edge)) /\ (0 < n) /\
35754 (!i j. (i < n /\ j < n) ==>
35755 (adj (f i) (f j) = ((SUC i = j) \/ (SUC j = i) ))) ==>
35756 (psegment (IMAGE f { p | p < n}))`,
35760 TYPE_THEN `E = IMAGE f {p | p <| n}` ABBREV_TAC ;
35761 IMATCH_MP_TAC endpoint_psegment;
35762 REWRITE_TAC[segment;];
35763 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
35764 TYPE_THEN `E` UNABBREV_TAC;
35765 IMATCH_MP_TAC FINITE_IMAGE;
35766 REWRITE_TAC[FINITE_NUMSEG_LT];
35768 TYPE_THEN `~(E = {})` SUBAGOAL_TAC;
35769 TYPE_THEN `E` UNABBREV_TAC;
35770 FULL_REWRITE_TAC[image_empty];
35771 FULL_REWRITE_TAC[EQ_EMPTY];
35774 TYPE_THEN `E SUBSET edge` SUBAGOAL_TAC;
35775 TYPE_THEN `E` UNABBREV_TAC;
35776 FULL_REWRITE_TAC[IMAGE;INJ;SUBSET];
35777 FIRST_ASSUM IMATCH_MP_TAC ;
35779 TYPE_THEN `E (f 0)` SUBAGOAL_TAC;
35780 TYPE_THEN `E` UNABBREV_TAC ;
35781 REWRITE_TAC[IMAGE];
35782 TYPE_THEN `0` EXISTS_TAC;
35785 TYPE_THEN `edge (f 0)` SUBAGOAL_TAC;
35786 FULL_REWRITE_TAC[SUBSET];
35788 TYPE_THEN `?m. endpoint E m` SUBAGOAL_TAC;
35789 REWRITE_TAC[endpoint];
35790 ASM_SIMP_TAC[num_closure1];
35792 TYPE_THEN `f 0 ` EXISTS_TAC;
35793 THM_INTRO_TAC[`f 0`] two_endpoint;
35794 FULL_REWRITE_TAC[has_size2];
35795 ASM_CASES_TAC `n =1`;
35796 TYPE_THEN `a` EXISTS_TAC;
35797 IMATCH_MP_TAC EQ_ANTISYM;
35799 TYPE_THEN `E` UNABBREV_TAC;
35800 TYPE_THEN `n` UNABBREV_TAC;
35801 FULL_REWRITE_TAC[IMAGE];
35802 TYPE_THEN `(x' = 0) /\ (x = 0)` SUBAGOAL_TAC;
35803 UND 7 THEN UND 13 THEN ARITH_TAC;
35804 TYPE_THEN `e'` UNABBREV_TAC;
35805 USE 10 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
35807 FULL_REWRITE_TAC[in_pair];
35809 TYPE_THEN `E (f 1)` SUBAGOAL_TAC;
35810 TYPE_THEN `E` UNABBREV_TAC;
35811 REWRITE_TAC[IMAGE];
35812 TYPE_THEN `1` EXISTS_TAC;
35813 UND 11 THEN UND 1 THEN ARITH_TAC;
35815 TYPE_THEN `edge (f 1)` SUBAGOAL_TAC;
35816 FULL_REWRITE_TAC[SUBSET];
35818 TYPE_THEN `adj (f 0 ) (f 1)` SUBAGOAL_TAC;
35819 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`0`;`1`]);
35820 UND 11 THEN UND 1 THEN ARITH_TAC;
35822 THM_INTRO_TAC[`f 0`;`f 1`] edge_inter;
35823 FULL_REWRITE_TAC[INTER;INR eq_sing ];
35825 TYPE_THEN `?r. closure top2 (f 0) (pointI r) /\ ~(r = m)` SUBAGOAL_TAC;
35826 USE 10 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
35827 FULL_REWRITE_TAC[in_pair];
35828 TYPE_THEN `m = a` ASM_CASES_TAC;
35829 TYPE_THEN `m` UNABBREV_TAC;
35830 TYPE_THEN `b` EXISTS_TAC;
35831 TYPE_THEN `a` EXISTS_TAC;
35832 TYPE_THEN `r` EXISTS_TAC;
35833 IMATCH_MP_TAC EQ_ANTISYM;
35835 TYPE_THEN`?j. (j <| n) /\ (e' = f j)` SUBAGOAL_TAC;
35836 TYPE_THEN`E` UNABBREV_TAC;
35837 FULL_REWRITE_TAC[IMAGE];
35838 TYPE_THEN`x` EXISTS_TAC;
35840 TYPE_THEN `e'` UNABBREV_TAC;
35841 PROOF_BY_CONTR_TAC;
35842 TYPE_THEN `adj (f 0) (f j)` SUBAGOAL_TAC;
35843 REWRITE_TAC[adj;EMPTY_EXISTS;INTER ];
35844 TYPE_THEN`pointI r` EXISTS_TAC;
35845 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[` 0`;` j`] );
35847 TYPE_THEN `j = 1` SUBAGOAL_TAC;
35848 UND 0 THEN ARITH_TAC;
35849 TYPE_THEN `j` UNABBREV_TAC;
35850 TSPEC `pointI r` 15;
35852 FULL_REWRITE_TAC[pointI_inj];
35854 TYPE_THEN `e'` UNABBREV_TAC;
35858 TYPE_THEN `!e. (E e ==> ?i. (i <| n) /\ (e = f i))` SUBAGOAL_TAC;
35859 TYPE_THEN `E` UNABBREV_TAC;
35860 FULL_REWRITE_TAC[IMAGE];
35864 REWRITE_TAC[INSERT];
35865 ASM_SIMP_TAC [num_closure0;num_closure1;num_closure2];
35866 PROOF_BY_CONTR_TAC;
35867 FULL_REWRITE_TAC[DE_MORGAN_THM];
35872 FULL_REWRITE_TAC[NOT_IMP];
35873 TYPE_THEN `E e' /\ closure top2 e' (pointI m') /\ ~(e = e')` SUBAGOAL_TAC;
35875 TYPE_THEN `adj e e'` SUBAGOAL_TAC;
35876 REWRITE_TAC[adj;EMPTY_EXISTS;INTER;];
35878 TYPE_THEN `(?i. (i <| n) /\ (e = f i))` SUBAGOAL_TAC;
35879 TYPE_THEN `(?j. (j <| n) /\ (e' = f j))` SUBAGOAL_TAC;
35880 TYPE_THEN `e` UNABBREV_TAC;
35881 TYPE_THEN `e'` UNABBREV_TAC;
35882 TYPE_THEN `(SUC i = j) \/ (SUC j = i)` SUBAGOAL_TAC;
35888 UND 13 THEN REWRITE_TAC[];
35890 IMATCH_MP_TAC EQ_ANTISYM;
35892 TYPE_THEN `?k. (k <| n) /\ (e'' = f k)` SUBAGOAL_TAC;
35893 TYPE_THEN `e''` UNABBREV_TAC;
35894 PROOF_BY_CONTR_TAC;
35895 FULL_REWRITE_TAC[DE_MORGAN_THM];
35896 TYPE_THEN `adj (f i) (f k) /\ adj (f j) (f k)` SUBAGOAL_TAC;
35898 REWRITE_TAC[INTER;EMPTY_EXISTS];
35901 TYPE_THEN `(SUC j = k) \/ (SUC k = j)` SUBAGOAL_TAC;
35903 TYPE_THEN `(SUC i = k) \/ (SUC k = i)` SUBAGOAL_TAC;
35905 UND 29 THEN UND 28 THEN UND 19 THEN ARITH_TAC;
35906 FIRST_ASSUM DISJ_CASES_TAC;
35910 TYPE_THEN `X = {p | p <| n /\ S (f p)}` ABBREV_TAC ;
35911 TYPE_THEN `~(X = EMPTY)` SUBAGOAL_TAC;
35912 FULL_REWRITE_TAC[EMPTY_EXISTS;SUBSET];
35913 TYPE_THEN `E u` SUBAGOAL_TAC;
35914 TYPE_THEN `(?i. (i <| n) /\ (u = f i))` SUBAGOAL_TAC;
35915 TYPE_THEN `u` UNABBREV_TAC;
35916 UNDF `EMPTY` THEN REWRITE_TAC[EMPTY_EXISTS];
35917 TYPE_THEN `i` EXISTS_TAC;
35918 TYPE_THEN `X` UNABBREV_TAC;
35920 TYPE_THEN `!j k. X j /\ (k <| n) /\ ((SUC j = k) \/ (SUC k = j)) ==> (X k)` SUBAGOAL_TAC;
35921 TYPE_THEN `j = k` ASM_CASES_TAC;
35923 TYPE_THEN `S (f j)` SUBAGOAL_TAC;
35924 TYPE_THEN `X` UNABBREV_TAC;
35925 TYPE_THEN `E (f k)` SUBAGOAL_TAC;
35926 TYPE_THEN `E` UNABBREV_TAC;
35927 REWRITE_TAC[IMAGE];
35928 TYPE_THEN `k` EXISTS_TAC;
35930 TYPE_THEN `adj (f j) (f k)` SUBAGOAL_TAC;
35931 TYPE_THEN `X` UNABBREV_TAC;
35933 TYPE_THEN `S (f k)` SUBAGOAL_TAC;
35935 TYPE_THEN `X` UNABBREV_TAC;
35937 TYPE_THEN `(?i. X i /\ (!m. m <| i ==> ~X m))` SUBAGOAL_TAC;
35938 FULL_REWRITE_TAC[EMPTY_EXISTS];
35939 ASM_MESON_TAC[num_WOP];
35940 TYPE_THEN `i = 0` SUBAGOAL_TAC;
35941 PROOF_BY_CONTR_TAC;
35942 TYPE_THEN `?j. SUC j = i` SUBAGOAL_TAC;
35943 TYPE_THEN `i - 1` EXISTS_TAC;
35944 UND 19 THEN ARITH_TAC;
35946 UND 17 THEN DISCH_THEN (THM_INTRO_TAC[]);
35947 UND 20 THEN ARITH_TAC;
35948 UND 17 THEN REWRITE_TAC[];
35949 FIRST_ASSUM IMATCH_MP_TAC ;
35950 TYPE_THEN `i` EXISTS_TAC;
35951 TYPE_THEN `X` UNABBREV_TAC;
35952 UND 17 THEN UND 20 THEN ARITH_TAC;
35953 TYPE_THEN `i` UNABBREV_TAC;
35955 TYPE_THEN `X = { p | p <| n }` SUBAGOAL_TAC;
35956 IMATCH_MP_TAC subset_imp_eq;
35958 TYPE_THEN `X` UNABBREV_TAC;
35959 REWRITE_TAC[SUBSET];
35960 PROOF_BY_CONTR_TAC;
35961 FULL_REWRITE_TAC[EMPTY_EXISTS];
35962 TYPE_THEN `Z = ({p | p <| n} DIFF X)` ABBREV_TAC ;
35963 TYPE_THEN `?n. Z n /\ (!m. m <| n ==> ~Z m)` SUBAGOAL_TAC;
35964 UND 19 THEN MESON_TAC[num_WOP];
35965 TYPE_THEN `Z` UNABBREV_TAC;
35966 FULL_REWRITE_TAC[DIFF];
35968 TYPE_THEN `~(n' = 0)` SUBAGOAL_TAC;
35970 TYPE_THEN `n' - 1 <| n'` SUBAGOAL_TAC;
35971 UND 24 THEN ARITH_TAC;
35972 TYPE_THEN `n' - 1 <| n` SUBAGOAL_TAC;
35973 UND 20 THEN ARITH_TAC;
35975 UND 19 THEN REWRITE_TAC[];
35976 FIRST_ASSUM IMATCH_MP_TAC ;
35977 TYPE_THEN `n' - 1` EXISTS_TAC;
35978 UND 24 THEN ARITH_TAC;
35979 IMATCH_MP_TAC SUBSET_ANTISYM;
35980 REWRITE_TAC[SUBSET];
35981 TYPE_THEN `E` UNABBREV_TAC;
35982 TYPE_THEN `X` UNABBREV_TAC;
35983 USE 20 (REWRITE_RULE[IMAGE]);
35984 USE 19 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
35986 FULL_REWRITE_TAC[];
35991 let rectagon_nonsing = prove_by_refinement(
35992 `!G. rectagon G ==> ~SING G`,
35995 REWRITE_TAC[rectagon;SING];
35996 TYPE_THEN `G` UNABBREV_TAC;
35997 THM_INTRO_TAC [`x`] two_endpoint;
35998 FULL_REWRITE_TAC[SUBSET;INR IN_SING;];
35999 FULL_REWRITE_TAC[has_size2];
36000 USE 6 (ONCE_REWRITE_RULE [FUN_EQ_THM]);
36001 FULL_REWRITE_TAC[in_pair];
36005 THM_INTRO_TAC[`{x}`;`pointI b`] num_closure0;
36006 FULL_REWRITE_TAC[INR IN_SING];
36011 THM_INTRO_TAC[`{x}`;`pointI b`] num_closure2;
36013 FULL_REWRITE_TAC[INR IN_SING];
36018 let rectagon_2 = prove_by_refinement(
36019 `!G S. rectagon G /\ S SUBSET G /\ ~(S = EMPTY) /\
36020 (!m. {0,2} (num_closure S (pointI m))) ==> (S = G)`,
36025 TYPE_THEN `Tx = { A | ~(A = EMPTY) /\ A SUBSET S /\ (!m. {0,2} (num_closure A (pointI m))) }` ABBREV_TAC ;
36026 TYPE_THEN `~(Tx = EMPTY)` SUBAGOAL_TAC;
36027 UND 5 THEN REWRITE_TAC[EMPTY_EXISTS];
36028 TYPE_THEN `S` EXISTS_TAC;
36029 TYPE_THEN `Tx` UNABBREV_TAC;
36030 REWRITE_TAC[SUBSET];
36031 USE 5 (MATCH_MP select_card_min);
36033 TYPE_THEN `z SUBSET G` SUBAGOAL_TAC;
36034 TYPE_THEN `Tx` UNABBREV_TAC;
36035 IMATCH_MP_TAC SUBSET_TRANS;
36038 TYPE_THEN `(z = G) ==> (S = G)` SUBAGOAL_TAC;
36039 TYPE_THEN `Tx` UNABBREV_TAC;
36040 IMATCH_MP_TAC EQ_EXT;
36041 FULL_REWRITE_TAC [ISUBSET];
36043 FIRST_ASSUM IMATCH_MP_TAC ;
36046 IMATCH_MP_TAC rectagon_subset;
36047 TYPE_THEN `segment G` SUBAGOAL_TAC;
36048 IMATCH_MP_TAC rectagon_segment;
36050 REWRITE_TAC[rectagon];
36051 TYPE_THEN `Tx` UNABBREV_TAC;
36053 IMATCH_MP_TAC FINITE_SUBSET;
36054 TYPE_THEN `G` EXISTS_TAC;
36055 FULL_REWRITE_TAC[rectagon];
36057 FULL_REWRITE_TAC[rectagon];
36058 IMATCH_MP_TAC SUBSET_TRANS;
36059 TYPE_THEN `G` EXISTS_TAC;
36061 IMATCH_MP_TAC CARD_SUBSET_LE;
36062 FIRST_ASSUM IMATCH_MP_TAC ;
36064 IMATCH_MP_TAC SUBSET_TRANS;
36069 FULL_REWRITE_TAC[INSERT];
36070 USE 0 (MATCH_MP (TAUT `a \/ b ==> b \/ a`));
36071 FIRST_ASSUM DISJ_CASES_TAC;
36072 THM_INTRO_TAC[`S'`;`z`;`pointI m`] num_closure_mono;
36073 UND 4 THEN UND 5 THEN ARITH_TAC;
36076 TYPE_THEN `~(num_closure S' (pointI m) = 1)` ASM_CASES_TAC;
36077 THM_INTRO_TAC[`S'`;`z`;`pointI m`] num_closure_mono;
36078 UND 5 THEN UND 0 THEN UND 4 THEN ARITH_TAC;
36081 THM_INTRO_TAC[`S'`;`(pointI m)`] num_closure1;
36082 IMATCH_MP_TAC FINITE_SUBSET;
36086 THM_INTRO_TAC[`z`;`pointI m`] num_closure2;
36092 USE 5 (REWRITE_RULE[]);
36093 TYPE_THEN `z e` SUBAGOAL_TAC;
36094 FULL_REWRITE_TAC[ISUBSET];
36095 TYPE_THEN `(e = a) \/ (e = b)` SUBAGOAL_TAC;
36099 TYPE_THEN `?e'. (closure top2 e' (pointI m)) /\ z e' /\ ~(e = e')` SUBAGOAL_TAC;
36100 FIRST_ASSUM DISJ_CASES_TAC;
36101 TYPE_THEN `b` EXISTS_TAC;
36103 TYPE_THEN `a` EXISTS_TAC;
36106 UND 11 THEN DISCH_THEN (THM_INTRO_TAC[`e`;`e'`]);
36107 REWRITE_TAC[adj;INTER;EMPTY_EXISTS;];
36108 TYPE_THEN `pointI m` EXISTS_TAC;
36115 let closure_imp_adj = prove_by_refinement(
36116 `!X Y m. (closure top2 X (pointI m) /\ closure top2 Y (pointI m) /\
36117 ~(X = Y) ==> adj X Y)`,
36121 REWRITE_TAC[INTER;EMPTY_EXISTS];
36126 let inductive_set_endpoint = prove_by_refinement(
36127 `!G S. FINITE G /\ inductive_set G S ==>
36128 (endpoint S SUBSET endpoint G)`,
36131 REWRITE_TAC[inductive_set];
36132 REWRITE_TAC[SUBSET;endpoint];
36133 TYPE_THEN `FINITE S` SUBAGOAL_TAC;
36134 IMATCH_MP_TAC FINITE_SUBSET;
36136 THM_INTRO_TAC[`S`;`pointI x`] num_closure1;
36138 ASM_SIMP_TAC[num_closure1];
36139 TYPE_THEN `e` EXISTS_TAC;
36140 IMATCH_MP_TAC EQ_ANTISYM;
36147 PROOF_BY_CONTR_TAC;
36148 UND 0 THEN DISCH_THEN ( THM_INTRO_TAC[`e`;`e'`]);
36149 IMATCH_MP_TAC closure_imp_adj;
36150 TYPE_THEN `x` EXISTS_TAC;
36153 TYPE_THEN `e'` UNABBREV_TAC;
36155 ASM_MESON_TAC[ISUBSET];
36159 let endpoint_closure = prove_by_refinement(
36160 `!e. (edge e) ==> (endpoint {e} = {m | closure top2 e (pointI m)})`,
36164 IMATCH_MP_TAC EQ_EXT;
36165 REWRITE_TAC[endpoint];
36166 THM_INTRO_TAC[`{e}`;`pointI x`] num_closure1;
36167 REWRITE_TAC[FINITE_SING];
36168 REWRITE_TAC[INR IN_SING];
36169 IMATCH_MP_TAC EQ_ANTISYM;
36171 TYPE_THEN `e = e'` SUBAGOAL_TAC;
36173 TYPE_THEN `e'` UNABBREV_TAC;
36175 TYPE_THEN `e` EXISTS_TAC;
36181 let rectagon_delete = prove_by_refinement(
36182 `!E e. (rectagon E) /\ (E e) ==> (psegment (E DELETE e))`,
36185 REWRITE_TAC[psegment];
36186 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
36188 THM_INTRO_TAC[`E DELETE e`;`E`] rectagon_subset;
36190 IMATCH_MP_TAC rectagon_segment;
36191 REWRITE_TAC[DELETE;SUBSET];
36192 ASM_MESON_TAC[INR DELETE_NON_ELEMENT];
36194 REWRITE_TAC[segment];
36196 FULL_REWRITE_TAC[rectagon];
36197 REWRITE_TAC[FINITE_DELETE];
36200 FULL_REWRITE_TAC[delete_empty];
36201 FULL_REWRITE_TAC[EMPTY_EXISTS];
36202 USE 1 (MATCH_MP rectagon_nonsing);
36203 FULL_REWRITE_TAC[SING];
36207 IMATCH_MP_TAC SUBSET_TRANS;
36208 TYPE_THEN `E` EXISTS_TAC;
36210 REWRITE_TAC[DELETE;SUBSET];
36211 FULL_REWRITE_TAC[rectagon];
36214 THM_INTRO_TAC[`E DELETE e`;`E`;`pointI m`] num_closure_mono;
36215 FULL_REWRITE_TAC[rectagon;DELETE;SUBSET];
36216 FULL_REWRITE_TAC[rectagon];
36217 UND 5 THEN UND 4 THEN (REWRITE_TAC[INSERT]) ;
36219 UND 4 THEN UND 5 THEN ARITH_TAC;
36221 TYPE_THEN `~S e` SUBAGOAL_TAC;
36222 FULL_REWRITE_TAC[SUBSET;DELETE];
36224 TYPE_THEN `(e INSERT S = E) ==> (S = E DELETE e)` SUBAGOAL_TAC;
36225 TYPE_THEN `E` UNABBREV_TAC;
36226 REWRITE_TAC [DELETE_INSERT];
36227 ASM_MESON_TAC[INR DELETE_NON_ELEMENT];
36228 FIRST_ASSUM IMATCH_MP_TAC ;
36230 TYPE_THEN `FINITE (E DELETE e)` SUBAGOAL_TAC;
36231 IMATCH_MP_TAC FINITE_SUBSET;
36232 TYPE_THEN `E` EXISTS_TAC;
36233 FULL_REWRITE_TAC[rectagon];
36234 REWRITE_TAC[DELETE;SUBSET];
36236 THM_INTRO_TAC[`E DELETE e`;`S`] inductive_set_endpoint;
36237 REWRITE_TAC[inductive_set];
36239 IMATCH_MP_TAC rectagon_2;
36241 REWRITE_TAC[INSERT_SUBSET];
36242 UND 6 THEN REWRITE_TAC[SUBSET;DELETE];
36245 FULL_REWRITE_TAC[EQ_EMPTY;INSERT;];
36248 TYPE_THEN `e INSERT S SUBSET E` SUBAGOAL_TAC;
36249 UND 6 THEN REWRITE_TAC[INSERT;DELETE;SUBSET];
36252 THM_INTRO_TAC[`e INSERT S`;`E`;`pointI m`] num_closure_mono;
36253 FULL_REWRITE_TAC[rectagon];
36254 TYPE_THEN `~(num_closure (e INSERT S) (pointI m) = 1)` ASM_CASES_TAC;
36255 TYPE_THEN `S' = e INSERT S` ABBREV_TAC ;
36257 FULL_REWRITE_TAC[INSERT;rectagon];
36259 UND 15 THEN UND 14 THEN UND 13 THEN ARITH_TAC;
36261 PROOF_BY_CONTR_TAC;
36266 TYPE_THEN `!A x. (A SUBSET E) /\ (num_closure A (pointI x) = 1) ==> (num_closure E (pointI x) = 2)` SUBAGOAL_TAC;
36267 FULL_REWRITE_TAC[rectagon];
36269 USE 15 (REWRITE_RULE[INSERT]);
36270 FIRST_ASSUM DISJ_CASES_TAC;
36271 THM_INTRO_TAC[`A`;`E`;`pointI x`] num_closure_mono;
36272 UND 20 THEN UND 19 THEN UND 9 THEN ARITH_TAC;
36274 TYPE_THEN `endpoint (E DELETE e) SUBSET endpoint {e}` SUBAGOAL_TAC;
36275 REWRITE_TAC[SUBSET;endpoint];
36276 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`E DELETE e`;`x`]);
36277 REWRITE_TAC[SUBSET;DELETE];
36278 THM_INTRO_TAC[`E`;`pointI x`] num_closure2;
36279 FULL_REWRITE_TAC[rectagon];
36281 THM_INTRO_TAC[`E DELETE e`;`pointI x`] num_closure1;
36283 USE 17 (REWRITE_RULE[DELETE]);
36284 THM_INTRO_TAC[`{e}`;`pointI x`] num_closure1;
36285 REWRITE_TAC[FINITE_SING];
36286 REWRITE_TAC[INR IN_SING];
36287 TYPE_THEN `e` EXISTS_TAC;
36288 IMATCH_MP_TAC EQ_ANTISYM;
36290 TYPE_THEN `e''` UNABBREV_TAC;
36291 PROOF_BY_CONTR_TAC;
36292 TYPE_THEN `E a /\ closure top2 a (pointI x)` SUBAGOAL_TAC;
36293 TYPE_THEN `E b /\ closure top2 b (pointI x)` SUBAGOAL_TAC;
36295 UND 15 THEN ASM_REWRITE_TAC[];
36296 PROOF_BY_CONTR_TAC ;
36297 USE 15 (REWRITE_RULE[DE_MORGAN_THM]);
36304 TYPE_THEN `e' = b` SUBAGOAL_TAC;
36307 TYPE_THEN `e' = a` SUBAGOAL_TAC;
36309 UND 7 THEN UND 4 THEN UND 16 THEN MESON_TAC[];
36311 TYPE_THEN `endpoint S SUBSET endpoint {e}` SUBAGOAL_TAC;
36312 IMATCH_MP_TAC SUBSET_TRANS;
36317 THM_INTRO_TAC[`S`;`E`] endpoint_even;
36319 ASM_MESON_TAC[rectagon_segment];
36321 UND 12 THEN REWRITE_TAC[INSERT;SUBSET] THEN MESON_TAC[];
36322 THM_INTRO_TAC[`S`;`E`] rectagon_subset;
36323 TYPE_THEN `S` UNABBREV_TAC;
36324 UND 8 THEN REWRITE_TAC[];
36326 TYPE_THEN `X = {S' | ?e. S e /\ (S' = segment_of S e)}` ABBREV_TAC ;
36327 TYPE_THEN `FINITE X` SUBAGOAL_TAC;
36328 THM_INTRO_TAC[`segment_of S`;`S`] FINITE_IMAGE;
36329 IMATCH_MP_TAC FINITE_SUBSET;
36330 TYPE_THEN `E DELETE e` EXISTS_TAC;
36331 TYPE_THEN `X = IMAGE (segment_of S) S` SUBAGOAL_TAC;
36332 IMATCH_MP_TAC EQ_EXT;
36333 TYPE_THEN `X` UNABBREV_TAC;
36334 REWRITE_TAC[IMAGE];
36336 TYPE_THEN `~(X = EMPTY)` SUBAGOAL_TAC;
36337 USE 5 (REWRITE_RULE[EMPTY_EXISTS]);
36338 UND 17 THEN REWRITE_TAC[EMPTY_EXISTS];
36339 TYPE_THEN `segment_of S u` EXISTS_TAC;
36340 TYPE_THEN `X` UNABBREV_TAC;
36343 FULL_REWRITE_TAC[HAS_SIZE];
36345 TYPE_THEN `edge e` SUBAGOAL_TAC;
36346 FULL_REWRITE_TAC[rectagon];
36347 FULL_REWRITE_TAC[ISUBSET];
36348 THM_INTRO_TAC[`e`] endpoint_closure;
36349 THM_INTRO_TAC[`e`] two_endpoint;
36350 FULL_REWRITE_TAC[HAS_SIZE];
36352 TYPE_THEN `endpoint S = endpoint {e}` SUBAGOAL_TAC;
36353 IMATCH_MP_TAC CARD_SUBSET_LE;
36356 IMATCH_MP_TAC (ARITH_RULE `~(CARD X = 0) ==> 2 <= 2 * CARD X`);
36357 TYPE_THEN `X HAS_SIZE 0` SUBAGOAL_TAC;
36358 ASM_REWRITE_TAC[HAS_SIZE];
36359 FULL_REWRITE_TAC[HAS_SIZE_0];
36362 THM_INTRO_TAC[`e INSERT S`;`pointI m`] num_closure1;
36363 IMATCH_MP_TAC FINITE_SUBSET;
36364 TYPE_THEN `E` EXISTS_TAC;
36365 FULL_REWRITE_TAC[rectagon];
36367 USE 24 (REWRITE_RULE[INSERT]);
36368 TYPE_THEN `closure top2 e (pointI m)` ASM_CASES_TAC;
36369 TYPE_THEN `e' = e` SUBAGOAL_TAC;
36372 TYPE_THEN `e'` UNABBREV_TAC;
36373 TYPE_THEN `endpoint S m` SUBAGOAL_TAC;
36375 THM_INTRO_TAC[`S`;`m`]endpoint_edge;
36376 IMATCH_MP_TAC FINITE_SUBSET;
36377 TYPE_THEN `E DELETE e` EXISTS_TAC ;
36378 FULL_REWRITE_TAC[EXISTS_UNIQUE_ALT];
36381 TYPE_THEN `e = e''` SUBAGOAL_TAC;
36383 TYPE_THEN `e''` UNABBREV_TAC;
36389 TYPE_THEN `~endpoint S m` SUBAGOAL_TAC;
36390 UND 26 THEN ASM_REWRITE_TAC[];
36392 USE 26 (REWRITE_RULE[endpoint]);
36393 THM_INTRO_TAC[`S`;`E`;`pointI m`] num_closure_mono;
36394 FULL_REWRITE_TAC[rectagon];
36395 UND 6 THEN REWRITE_TAC[DELETE;SUBSET];
36396 TYPE_THEN `{0,2} (num_closure E (pointI m))` SUBAGOAL_TAC;
36397 FULL_REWRITE_TAC[rectagon];
36398 TYPE_THEN `FINITE S` SUBAGOAL_TAC;
36399 IMATCH_MP_TAC FINITE_SUBSET ;
36400 TYPE_THEN `E DELETE e` EXISTS_TAC;
36401 TYPE_THEN `~(num_closure S (pointI m) = 0)` SUBAGOAL_TAC;
36402 THM_INTRO_TAC[`S`;`pointI m`] num_closure0;
36409 FIRST_ASSUM DISJ_CASES_TAC;
36411 TYPE_THEN `e'` UNABBREV_TAC;
36416 USE 28 (REWRITE_RULE [INSERT]);
36417 USE 28 (MATCH_MP (TAUT `a \/ b ==> b \/ a`));
36418 FIRST_ASSUM DISJ_CASES_TAC;
36419 UND 27 THEN UND 31 THEN UND 30 THEN ARITH_TAC;
36421 TYPE_THEN `num_closure S (pointI m) = 2` SUBAGOAL_TAC;
36422 UND 31 THEN UND 30 THEN UND 26 THEN UND 27 THEN ARITH_TAC;
36429 THM_INTRO_TAC[`S`;`pointI m`] num_closure2;
36431 TYPE_THEN `S a /\ closure top2 a (pointI m)` SUBAGOAL_TAC;
36432 TYPE_THEN `S b /\ closure top2 b (pointI m)` SUBAGOAL_TAC;
36434 TYPE_THEN `e' = a` SUBAGOAL_TAC;
36436 TYPE_THEN `e' =b` SUBAGOAL_TAC;
36438 UND 7 THEN REWRITE_TAC[];
36439 TYPE_THEN `e'` UNABBREV_TAC;
36443 let rectagon_adj = prove_by_refinement(
36444 `!E e f. (rectagon E) /\ E e /\ E f ==>
36446 (?a. endpoint (E DELETE e) a /\ (f = terminal_edge (E DELETE e) a)))`,
36450 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
36451 FULL_REWRITE_TAC[rectagon];
36452 TYPE_THEN `FINITE (E DELETE e)` SUBAGOAL_TAC;
36453 IMATCH_MP_TAC FINITE_SUBSET;
36454 TYPE_THEN `E` EXISTS_TAC;
36455 REWRITE_TAC[DELETE;SUBSET];
36457 IMATCH_MP_TAC EQ_ANTISYM;
36458 IMATCH_MP_TAC (TAUT `A /\ b ==> b /\ A`);
36460 IMATCH_MP_TAC closure_imp_adj;
36461 TYPE_THEN `a` EXISTS_TAC;
36462 TYPE_THEN `f` UNABBREV_TAC;
36463 FULL_REWRITE_TAC[endpoint];
36464 THM_INTRO_TAC[`E DELETE e`;`pointI a`] num_closure1;
36466 USE 5 (REWRITE_RULE[DELETE]);
36467 TYPE_THEN `{0,2} (num_closure E (pointI a))` SUBAGOAL_TAC;
36468 FULL_REWRITE_TAC[rectagon];
36469 USE 7 (REWRITE_RULE[INSERT]);
36470 FIRST_ASSUM DISJ_CASES_TAC;
36471 THM_INTRO_TAC[`E`;`pointI a`] num_closure2;
36473 TYPE_THEN `E a' /\ closure top2 a' (pointI a)` SUBAGOAL_TAC;
36474 TYPE_THEN `E b /\ closure top2 b (pointI a)` SUBAGOAL_TAC;
36476 PROOF_BY_CONTR_TAC;
36478 UND 9 THEN ASM_REWRITE_TAC[];
36479 PROOF_BY_CONTR_TAC;
36480 USE 9(REWRITE_RULE[DE_MORGAN_THM]);
36484 TYPE_THEN `e' = b` SUBAGOAL_TAC;
36486 TYPE_THEN `e'` UNABBREV_TAC;
36488 THM_INTRO_TAC[`E DELETE e`;`a`]terminal_endpoint;
36489 REWRITE_TAC[endpoint];
36490 UND 17 THEN REWRITE_TAC[DELETE] THEN MESON_TAC[];
36492 THM_INTRO_TAC[`E`;`pointI a`] num_closure0;
36496 THM_INTRO_TAC[`e`;`f`] edge_inter;
36497 FULL_REWRITE_TAC[rectagon;ISUBSET];
36498 FULL_REWRITE_TAC[INTER;INR eq_sing];
36499 TYPE_THEN `m` EXISTS_TAC;
36501 REWRITE_TAC[endpoint];
36502 THM_INTRO_TAC[`E DELETE e`;`pointI m`] num_closure1;
36504 TYPE_THEN `f` EXISTS_TAC;
36505 REWRITE_TAC[DELETE];
36506 IMATCH_MP_TAC EQ_ANTISYM;
36507 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
36509 TYPE_THEN `e''` UNABBREV_TAC;
36510 FULL_REWRITE_TAC[adj];
36513 TYPE_THEN `{0, 2} (num_closure E (pointI m))` SUBAGOAL_TAC;
36514 FULL_REWRITE_TAC[rectagon];
36515 FULL_REWRITE_TAC[INSERT];
36516 FIRST_ASSUM DISJ_CASES_TAC;
36517 THM_INTRO_TAC[`E`;`pointI m`]num_closure2;
36519 PROOF_BY_CONTR_TAC;
36528 TYPE_THEN `e'' = a` ASM_CASES_TAC ;
36529 TYPE_THEN `e''` UNABBREV_TAC;
36530 TYPE_THEN `(f = b)` SUBAGOAL_TAC;
36532 TYPE_THEN `f` UNABBREV_TAC;
36533 TYPE_THEN `e = b` SUBAGOAL_TAC;
36535 TYPE_THEN `e` UNABBREV_TAC;
36536 FULL_REWRITE_TAC[adj];
36537 TYPE_THEN `e'' = b` SUBAGOAL_TAC;
36539 TYPE_THEN `e''` UNABBREV_TAC;
36540 TYPE_THEN `f = a` SUBAGOAL_TAC;
36543 TYPE_THEN `f` UNABBREV_TAC ;
36544 FULL_REWRITE_TAC[adj];
36547 THM_INTRO_TAC[`E`;`pointI m`] num_closure0;
36552 THM_INTRO_TAC[`E DELETE e`;`m`;`f`] terminal_unique;
36553 USE 10 (ONCE_REWRITE_RULE [EQ_SYM_EQ]);
36554 ASM_REWRITE_TAC[DELETE];
36555 ASM_MESON_TAC[adj];
36559 let rectagon_delete_end = prove_by_refinement(
36560 `!E e m. rectagon E /\ E e /\ closure top2 e (pointI m) ==>
36561 endpoint (E DELETE e ) m`,
36565 REWRITE_TAC[endpoint];
36566 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
36567 FULL_REWRITE_TAC[rectagon];
36568 TYPE_THEN `FINITE (E DELETE e)` SUBAGOAL_TAC;
36569 IMATCH_MP_TAC FINITE_SUBSET;
36571 REWRITE_TAC[DELETE;SUBSET];
36572 THM_INTRO_TAC[`E DELETE e`;`pointI m`] num_closure1;
36574 REWRITE_TAC[DELETE];
36576 TYPE_THEN `{0,2} (num_closure E (pointI m))` SUBAGOAL_TAC;
36577 FULL_REWRITE_TAC[rectagon];
36578 FULL_REWRITE_TAC[INSERT];
36580 FIRST_ASSUM DISJ_CASES_TAC;
36582 THM_INTRO_TAC[`E`;`pointI m`] num_closure2;
36584 TYPE_THEN `(e = a) \/ (e = b)` SUBAGOAL_TAC;
36586 TYPE_THEN `?c. (E c /\ ~(c = e) /\ closure top2 c (pointI m)) /\ (!e'. E e' /\ closure top2 e' (pointI m) <=> (e' = e) \/ (e' = c))` SUBAGOAL_TAC;
36587 FIRST_ASSUM DISJ_CASES_TAC;
36588 TYPE_THEN `b` EXISTS_TAC;
36590 TYPE_THEN `a` EXISTS_TAC;
36592 TYPE_THEN `c` EXISTS_TAC;
36593 TYPE_THEN `c = e''` ASM_CASES_TAC;
36594 TYPE_THEN `e''` UNABBREV_TAC;
36595 PROOF_BY_CONTR_TAC;
36601 THM_INTRO_TAC[`E`;`pointI m`] num_closure0;
36607 let rectagon_order = prove_by_refinement(
36608 `!E e m. rectagon E /\ E e /\ closure top2 e (pointI m) ==>
36609 (?f. BIJ f { p | p < CARD E } E /\
36610 (f (CARD E - 1) = e) /\ (closure top2 (f 0) (pointI m)) /\
36611 (!i j. (i < CARD E /\ j < CARD E) ==>
36612 (adj (f i) (f j) <=> ((SUC i = j) \/ (SUC j = i) \/
36613 ((i = 0) /\ (j = (CARD E -1))) \/ ((i = CARD E -1) /\ (j = 0))))))`,
36617 THM_INTRO_TAC[`E`;`e`] rectagon_delete;
36618 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
36619 FULL_REWRITE_TAC[rectagon];
36620 TYPE_THEN `FINITE (E DELETE e)` SUBAGOAL_TAC;
36621 IMATCH_MP_TAC FINITE_SUBSET;
36623 REWRITE_TAC[DELETE;SUBSET];
36624 TYPE_THEN `endpoint (E DELETE e) m` SUBAGOAL_TAC;
36625 IMATCH_MP_TAC rectagon_delete_end;
36627 TYPE_THEN `?n. (endpoint (E DELETE e) n) /\ ~(n = m)` SUBAGOAL_TAC;
36628 THM_INTRO_TAC[`E DELETE e`] endpoint_size2;
36629 FULL_REWRITE_TAC[has_size2];
36630 TYPE_THEN `m = a` ASM_CASES_TAC ;
36631 TYPE_THEN `b` EXISTS_TAC;
36632 REWRITE_TAC[INR in_pair];
36633 TYPE_THEN `a` EXISTS_TAC;
36634 REWRITE_TAC[INR in_pair];
36636 THM_INTRO_TAC[`E DELETE e`;`m`;`n`] psegment_order;
36637 THM_INTRO_TAC[`e`;`E`;] CARD_SUC_DELETE;
36638 TYPE_THEN `~(CARD E = 0)` SUBAGOAL_TAC;
36639 TYPE_THEN `E HAS_SIZE 0` SUBAGOAL_TAC;
36640 REWRITE_TAC[HAS_SIZE];
36641 FULL_REWRITE_TAC[HAS_SIZE_0;EQ_EMPTY];
36643 TYPE_THEN `CARD (E DELETE e) = CARD (E) - 1` SUBAGOAL_TAC;
36644 UND 14 THEN UND 13 THEN ARITH_TAC;
36646 TYPE_THEN `g = \ (i:num). if (i < CARD E - 1) then f i else e` ABBREV_TAC ;
36647 TYPE_THEN `(g (CARD E - 1) = e)` SUBAGOAL_TAC;
36648 TYPE_THEN `g` UNABBREV_TAC;
36649 REWRITE_TAC[ARITH_RULE `~(x <| x)`];
36650 TYPE_THEN `(!i. (i < CARD E -| 1) ==> (g i = f i))` SUBAGOAL_TAC;
36651 TYPE_THEN `g` UNABBREV_TAC;
36653 TYPE_THEN `g` EXISTS_TAC;
36655 TYPE_THEN `{p | p < CARD E - 1} UNION {(CARD E - 1)} = {p | p <| CARD E}` SUBAGOAL_TAC;
36656 IMATCH_MP_TAC EQ_EXT;
36657 REWRITE_TAC[UNION;INR IN_SING ];
36658 UND 14 THEN ARITH_TAC;
36664 IMATCH_MP_TAC inj_split;
36666 FULL_REWRITE_TAC[BIJ;INJ];
36667 TYPE_THEN `CARD (E DELETE e)` UNABBREV_TAC;
36669 UND 20 THEN REWRITE_TAC[DELETE] THEN UND 15 THEN MESON_TAC[];
36670 FIRST_ASSUM IMATCH_MP_TAC ;
36671 UND 15 THEN UND 21 THEN UND 22 THEN UND 18 THEN MESON_TAC[];
36673 REWRITE_TAC[INJ;INR IN_SING ];
36675 REWRITE_TAC[IMAGE;INTER;EQ_EMPTY;INR IN_SING ];
36676 TYPE_THEN `x` UNABBREV_TAC ;
36677 TYPE_THEN `x''` UNABBREV_TAC;
36679 TYPE_THEN `g x' = f x'` SUBAGOAL_TAC;
36681 TYPE_THEN `g x'` UNABBREV_TAC;
36682 FULL_REWRITE_TAC[BIJ;INJ];
36683 TYPE_THEN `CARD(E DELETE e)` UNABBREV_TAC;
36684 USE 21(REWRITE_RULE[DELETE]);
36688 USE 19 (REWRITE_RULE[INJ]);
36690 TYPE_THEN `x = e` ASM_CASES_TAC;
36691 TYPE_THEN `CARD E - 1` EXISTS_TAC;
36692 UND 14 THEN ARITH_TAC;
36693 TYPE_THEN `(E DELETE e) x` SUBAGOAL_TAC;
36694 ASM_REWRITE_TAC[DELETE];
36695 FULL_REWRITE_TAC[BIJ;SURJ];
36698 TYPE_THEN `y` EXISTS_TAC;
36700 UND 26 THEN ARITH_TAC;
36702 TYPE_THEN `~(SING E)` SUBAGOAL_TAC;
36703 FULL_REWRITE_TAC[SING];
36704 TYPE_THEN `E` UNABBREV_TAC;
36705 FULL_REWRITE_TAC[INR IN_SING];
36706 TYPE_THEN `x` UNABBREV_TAC;
36707 FULL_REWRITE_TAC[psegment;segment];
36708 FULL_REWRITE_TAC[EMPTY_EXISTS];
36709 UND 22 THEN ASM_REWRITE_TAC[DELETE;INR IN_SING];
36711 TYPE_THEN `~(CARD E = 1)` SUBAGOAL_TAC;
36712 TYPE_THEN `E HAS_SIZE 1` SUBAGOAL_TAC;
36713 ASM_REWRITE_TAC[HAS_SIZE];
36714 ASM_MESON_TAC[CARD_SING_CONV];
36716 TYPE_THEN `0 < CARD E - 1` SUBAGOAL_TAC;
36717 UND 21 THEN UND 14 THEN ARITH_TAC;
36722 THM_INTRO_TAC[`E DELETE e`;`m`]terminal_endpoint;
36724 UND 10 THEN DISCH_THEN (THM_INTRO_TAC[]);
36727 TYPE_THEN `CARD (E DELETE e) - 1 = CARD E - 2` SUBAGOAL_TAC;
36728 UND 23 THEN ARITH_TAC;
36731 TYPE_THEN `!k. endpoint (E DELETE e) k ==> (k = n) \/ (k = m)` SUBAGOAL_TAC;
36732 PROOF_BY_CONTR_TAC;
36733 USE 29 (REWRITE_RULE[DE_MORGAN_THM]);
36734 THM_INTRO_TAC[`E DELETE e`] endpoint_size2;
36735 THM_INTRO_TAC[`endpoint(E DELETE e)`;`n`;`m`;`k`]two_exclusion;
36738 TYPE_THEN `!j. (j <| CARD E - 1) ==> (adj e (g j) <=> (j = 0) \/ (j = CARD E - 2))` SUBAGOAL_TAC;
36739 THM_INTRO_TAC[`E`;`e`;`g j'`] rectagon_adj;
36741 TYPE_THEN `f j'` UNABBREV_TAC;
36742 USE 19 (REWRITE_RULE[BIJ;SURJ]);
36743 FIRST_ASSUM IMATCH_MP_TAC ;
36744 UND 29 THEN ARITH_TAC;
36746 IMATCH_MP_TAC EQ_ANTISYM;
36748 UND 18 THEN DISCH_THEN (THM_INTRO_TAC[`j'`]);
36749 TYPE_THEN `g j'` UNABBREV_TAC;
36752 FIRST_ASSUM DISJ_CASES_TAC ;
36753 TYPE_THEN `a` UNABBREV_TAC;
36755 TYPE_THEN `f j' = f (CARD E -| 2)` SUBAGOAL_TAC;
36756 USE 12(REWRITE_RULE[BIJ;INJ]);
36757 FIRST_ASSUM IMATCH_MP_TAC ;
36758 UND 29 THEN UND 23 THEN ARITH_TAC;
36759 TYPE_THEN `a` UNABBREV_TAC;
36761 TYPE_THEN `f j' = f 0` SUBAGOAL_TAC;
36762 USE 12 (REWRITE_RULE[BIJ;INJ]);
36763 FIRST_ASSUM IMATCH_MP_TAC ;
36766 FIRST_ASSUM DISJ_CASES_TAC;
36768 THM_INTRO_TAC[`E`;`e`;`f 0`] rectagon_adj;
36769 TYPE_THEN `terminal_edge (E DELETE e) m` UNABBREV_TAC;
36771 USE 19 (REWRITE_RULE[BIJ;SURJ]);
36773 FIRST_ASSUM IMATCH_MP_TAC ;
36774 UND 23 THEN ARITH_TAC;
36778 THM_INTRO_TAC[`E`;`e`;`f (CARD E - 2)`] rectagon_adj;
36779 TYPE_THEN `terminal_edge (E DELETE e) n` UNABBREV_TAC;
36780 UND 18 THEN DISCH_THEN (THM_INTRO_TAC[`CARD E -2`]);
36781 UND 23 THEN ARITH_TAC;
36783 USE 19 (REWRITE_RULE[BIJ;SURJ]);
36784 FIRST_ASSUM IMATCH_MP_TAC ;
36785 UND 23 THEN ARITH_TAC;
36787 TYPE_THEN `n` EXISTS_TAC;
36790 TYPE_THEN `i = CARD E - 1` ASM_CASES_TAC;
36792 TYPE_THEN `j = CARD E - 1` ASM_CASES_TAC;
36795 UND 32 THEN UND 23 THEN ARITH_TAC;
36796 UND 29 THEN DISCH_THEN (THM_INTRO_TAC[`j`]);
36797 UND 31 THEN UND 24 THEN ARITH_TAC;
36798 IMATCH_MP_TAC EQ_ANTISYM;
36800 FIRST_ASSUM DISJ_CASES_TAC;
36801 TYPE_THEN `j` UNABBREV_TAC;
36804 UND 23 THEN ARITH_TAC;
36805 UND 32 THEN REP_CASES_TAC;
36806 TYPE_THEN `j` UNABBREV_TAC;
36807 UND 24 THEN ARITH_TAC;
36809 UND 32 THEN UND 23 THEN ARITH_TAC;
36811 TYPE_THEN `j = CARD E - 1` ASM_CASES_TAC;
36813 ONCE_REWRITE_TAC [adj_symm];
36814 UND 29 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
36815 UND 30 THEN UND 25 THEN ARITH_TAC;
36816 IMATCH_MP_TAC EQ_ANTISYM;
36818 FIRST_ASSUM DISJ_CASES_TAC ;
36819 UND 23 THEN ARITH_TAC;
36820 UND 32 THEN REP_CASES_TAC;
36821 UND 32 THEN UND 23 THEN ARITH_TAC;
36822 TYPE_THEN `i` UNABBREV_TAC;
36823 PROOF_BY_CONTR_TAC;
36824 UND 25 THEN ARITH_TAC;
36826 TYPE_THEN `i < CARD E - 1 /\ j < CARD E - 1` SUBAGOAL_TAC;
36827 UND 31 THEN UND 30 THEN UND 24 THEN UND 25 THEN ARITH_TAC;
36828 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
36834 let order_imp_psegment_shift = prove_by_refinement(
36836 INJ f { p | m <= p /\ p < n} edge /\
36838 (! i j. m <= i /\ i < n /\ m <= j /\ j < n ==>
36839 (adj (f i) (f j) <=> (SUC i = j) \/ (SUC j = i))) ==>
36840 psegment (IMAGE f {p | m <= p /\ p < n})`,
36844 TYPE_THEN `g = \ (i: num). f (i + m)` ABBREV_TAC ;
36845 TYPE_THEN `IMAGE f {p | m <=| p /\ p < n} = IMAGE g {p | p < n - m}` SUBAGOAL_TAC;
36846 REWRITE_TAC[IMAGE];
36847 IMATCH_MP_TAC EQ_EXT;
36848 IMATCH_MP_TAC EQ_ANTISYM;
36850 TYPE_THEN `x` UNABBREV_TAC;
36851 TYPE_THEN `g` UNABBREV_TAC;
36852 TYPE_THEN `x' -| m` EXISTS_TAC;
36854 UND 5 THEN UND 6 THEN ARITH_TAC;
36856 UND 6 THEN ARITH_TAC;
36857 TYPE_THEN `x` UNABBREV_TAC;
36858 TYPE_THEN `g` UNABBREV_TAC;
36859 TYPE_THEN `x' +| m` EXISTS_TAC;
36860 UND 5 THEN UND 1 THEN ARITH_TAC;
36861 IMATCH_MP_TAC order_imp_psegment;
36866 TYPE_THEN`g`UNABBREV_TAC;
36867 FULL_REWRITE_TAC[INJ];
36868 FIRST_ASSUM IMATCH_MP_TAC ;
36869 UND 5 THEN UND 1 THEN ARITH_TAC;
36870 TYPE_THEN `g` UNABBREV_TAC;
36871 IMATCH_MP_TAC (ARITH_RULE `((x +| m) = (y + m)) ==> (x = y)`);
36872 FULL_REWRITE_TAC[INJ];
36873 FIRST_ASSUM IMATCH_MP_TAC ;
36874 UND 6 THEN UND 7 THEN UND 1 THEN ARITH_TAC;
36877 UND 1 THEN ARITH_TAC;
36878 TYPE_THEN `g` UNABBREV_TAC;
36879 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`i +| m`;`j +| m`]);
36880 UND 6 THEN UND 7 THEN UND 1 THEN ARITH_TAC;
36881 REWRITE_TAC[ARITH_RULE `(SUC(i + m) = (j +| m)) <=> (SUC i = j)`];
36885 let cls = jordan_def
36886 `cls E = {m | ?e. E e /\ closure top2 e (pointI m)}`;;
36888 let cls_edge = prove_by_refinement(
36889 `!e. (cls {e} = {m | closure top2 e (pointI m)})`,
36892 REWRITE_TAC[cls;INR IN_SING ;];
36893 IMATCH_MP_TAC EQ_EXT;
36898 let cls_inj_lemma_v = prove_by_refinement(
36899 `!m n. (cls {(v_edge m)} = cls {(v_edge n)}) ==> (m = n)`,
36902 REWRITE_TAC[cls_edge;INR IN_SING;];
36903 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
36904 USE 0 (REWRITE_RULE[INR IN_SING]);
36905 FULL_REWRITE_TAC[v_edge_closure;vc_edge;UNION;cell_clauses;INR IN_SING ;plus_e12;PAIR_SPLIT];
36909 TYPE_THEN `FST n` UNABBREV_TAC;
36912 TSPEC `(FST m, SND n)` 0;
36915 UND 0 THEN UND 1 THEN INT_ARITH_TAC;
36919 let cls_inj_lemma_h = prove_by_refinement(
36920 `!m n. (cls {(h_edge m)} = cls {(h_edge n)}) ==> (m = n)`,
36923 REWRITE_TAC[cls_edge;INR IN_SING;];
36924 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
36925 USE 0 (REWRITE_RULE[INR IN_SING]);
36926 FULL_REWRITE_TAC[h_edge_closure;hc_edge;UNION;cell_clauses;INR IN_SING ;plus_e12;PAIR_SPLIT];
36927 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
36931 TYPE_THEN `SND n` UNABBREV_TAC;
36934 TSPEC `(FST n, SND m)` 0;
36937 UND 0 THEN UND 1 THEN INT_ARITH_TAC;
36941 let cls_inj_lemma_hv = prove_by_refinement(
36942 `!m n. ~(cls {(h_edge m)} = cls {(v_edge n)})` ,
36945 REWRITE_TAC[cls_edge;];
36946 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
36947 USE 0 (REWRITE_RULE[INR IN_SING]);
36948 FULL_REWRITE_TAC[v_edge_closure;vc_edge;h_edge_closure;hc_edge;UNION;cell_clauses;INR IN_SING ;plus_e12;PAIR_SPLIT];
36951 TSPEC `(FST n, SND n +: &:1)` 1;
36954 TYPE_THEN `SND n = SND m` SUBAGOAL_TAC;
36956 TYPE_THEN `SND m` UNABBREV_TAC;
36957 UND 1 THEN INT_ARITH_TAC;
36961 let cls_inj = prove_by_refinement(
36962 `!e f . (edge e /\ edge f /\ (cls {e} = cls {f}) ==> (e = f))`,
36966 JOIN 1 2 THEN FULL_REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
36967 UND 1 THEN REP_CASES_TAC THEN REWR 0 THEN REWRITE_TAC[v_edge_inj;h_edge_inj];
36968 IMATCH_MP_TAC cls_inj_lemma_v;
36969 ASM_MESON_TAC[cls_inj_lemma_hv];
36970 ASM_MESON_TAC[cls_inj_lemma_hv];
36971 IMATCH_MP_TAC cls_inj_lemma_h;
36975 let adjv = jordan_def
36976 `adjv e f = @m. (closure top2 e (pointI m)) /\
36977 (closure top2 f (pointI m))` ;;
36979 let adjv_adj = prove_by_refinement(
36980 `!e f. edge e /\ edge f /\ adj e f ==>
36981 closure top2 e (pointI (adjv e f))`,
36986 THM_INTRO_TAC[`e`;`f`] edge_inter;
36987 FULL_REWRITE_TAC [INTER;INR eq_sing;];
36992 let adjv_adj2 = prove_by_refinement(
36993 `!e f. edge e /\ edge f /\ adj e f ==>
36994 closure top2 f (pointI (adjv e f))`,
36999 THM_INTRO_TAC[`e`;`f`] edge_inter;
37000 FULL_REWRITE_TAC [INTER;INR eq_sing;];
37005 let has_size2_pair = prove_by_refinement(
37006 `!(X:A->bool) a b. (X HAS_SIZE 2) /\ X a /\ X b /\ ~(a = b) ==>
37011 ONCE_REWRITE_TAC[EQ_SYM_EQ];
37012 IMATCH_MP_TAC CARD_SUBSET_EQ;
37013 FULL_REWRITE_TAC[HAS_SIZE];
37014 REWRITE_TAC[SUBSET;INR in_pair];
37015 ASM_MESON_TAC[pair_size_2;HAS_SIZE];
37019 let adjv_unique = prove_by_refinement(
37020 `!e f n. edge e /\ edge f /\ adj e f /\ closure top2 e (pointI n) /\
37021 closure top2 f (pointI n) ==> (n = adjv e f)`,
37026 PROOF_BY_CONTR_TAC;
37027 THM_INTRO_TAC[`e`] two_endpoint;
37028 THM_INTRO_TAC[`f`] two_endpoint;
37029 THM_INTRO_TAC[ `{m | closure top2 f (pointI m)}`;`n`;`t`] has_size2_pair;
37031 THM_INTRO_TAC[ `{m | closure top2 e (pointI m)}`;`n`;`t`] has_size2_pair;
37033 TYPE_THEN `cls {e} = cls {f}` SUBAGOAL_TAC;
37034 REWRITE_TAC[cls_edge;INR IN_SING ];
37035 THM_INTRO_TAC[`e`;`f`] cls_inj;
37036 TYPE_THEN`f` UNABBREV_TAC;
37037 FULL_REWRITE_TAC[adj];
37043 let adjv_symm = prove_by_refinement(
37044 `!e f. edge e /\ edge f /\ adj e f ==>
37045 (adjv f e = adjv e f)`,
37049 IMATCH_MP_TAC adjv_unique;
37050 THM_INTRO_TAC[`f`;`e`] adjv_adj;
37051 ASM_MESON_TAC[adj_symm];
37052 THM_INTRO_TAC[`f`;`e`] adjv_adj2;
37053 ASM_MESON_TAC[adj_symm];
37057 let adjv_segment = prove_by_refinement(
37058 `!E e f. segment E /\ E e /\ E f /\ adj e f ==>
37059 ({C| E C /\ closure top2 C (pointI (adjv e f))} = {e,f} ) `,
37063 IMATCH_MP_TAC has_size2_pair;
37064 TYPE_THEN `~(e = f)` SUBAGOAL_TAC;
37065 FULL_REWRITE_TAC[adj];
37068 TYPE_THEN `edge e /\ edge f` SUBAGOAL_TAC;
37069 FULL_REWRITE_TAC[segment;ISUBSET];
37071 TYPE_THEN `closure top2 e (pointI (adjv e f))` SUBAGOAL_TAC;
37072 IMATCH_MP_TAC adjv_adj;
37073 TYPE_THEN `closure top2 f (pointI (adjv e f))` SUBAGOAL_TAC;
37074 IMATCH_MP_TAC adjv_adj2;
37076 TYPE_THEN `{0,1,2} (num_closure E (pointI (adjv e f)))` SUBAGOAL_TAC;
37077 FULL_REWRITE_TAC[segment];
37078 FULL_REWRITE_TAC[INSERT];
37079 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
37080 FULL_REWRITE_TAC[segment];
37081 UND 9 THEN REP_CASES_TAC;
37082 THM_INTRO_TAC[`E`;`pointI (adjv e f)`] num_closure_size;
37085 THM_INTRO_TAC[`E`;`pointI (adjv e f)`] num_closure1;
37093 THM_INTRO_TAC[`E`;`pointI (adjv e f)`] num_closure0;
37100 let num_closure_elt = prove_by_refinement(
37101 `!S m. (0 <| num_closure S m) ==> (?e. S e /\ closure top2 e m)`,
37104 REWRITE_TAC[num_closure];
37105 TYPE_THEN `~({C | S C /\ closure top2 C m} = EMPTY)` SUBAGOAL_TAC;
37107 FULL_REWRITE_TAC[CARD_CLAUSES];
37108 UND 0 THEN ARITH_TAC;
37109 FULL_REWRITE_TAC[EMPTY_EXISTS];
37114 (* I shouldn't need three minor variations of the same
37115 thing here, but here they are *)
37117 let rectagon_subset_endpoint = prove_by_refinement(
37118 `!E S k. rectagon E /\ S SUBSET E /\ (0 <| num_closure S (pointI k)) /\
37119 (0 <| num_closure (E DIFF S) (pointI k)) ==>
37124 REWRITE_TAC[endpoint];
37125 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
37126 FULL_REWRITE_TAC[rectagon];
37127 THM_INTRO_TAC[`S`;`E`;`pointI k`] num_closure_mono;
37128 TYPE_THEN `{0,2} (num_closure E (pointI k))` SUBAGOAL_TAC;
37129 FULL_REWRITE_TAC[rectagon];
37130 FULL_REWRITE_TAC[INSERT];
37132 FIRST_ASSUM DISJ_CASES_TAC ;
37133 PROOF_BY_CONTR_TAC;
37134 TYPE_THEN `num_closure S (pointI k) = 2` SUBAGOAL_TAC;
37136 UND 8 THEN UND 1 THEN UND 5 THEN ARITH_TAC;
37137 TYPE_THEN `{C | S C /\ closure top2 C (pointI k)} = {C | E C /\ closure top2 C (pointI k)}` SUBAGOAL_TAC;
37138 IMATCH_MP_TAC CARD_SUBSET_EQ;
37139 USE 9 (REWRITE_RULE[num_closure]);
37140 USE 7 (REWRITE_RULE[num_closure]);
37142 IMATCH_MP_TAC FINITE_SUBSET;
37144 REWRITE_TAC[SUBSET;];
37145 REWRITE_TAC[SUBSET;];
37146 FULL_REWRITE_TAC[ISUBSET];
37148 USE 0 (REWRITE_RULE[num_closure]);
37149 USE 0 (MATCH_MP (ARITH_RULE `0 <| CARD X ==> ~(CARD X = 0)`));
37150 TYPE_THEN `{C | (E DIFF S) C /\ closure top2 C (pointI k)} = EMPTY ` SUBAGOAL_TAC;
37151 REWRITE_TAC[EQ_EMPTY ];
37152 USE 12 (REWRITE_RULE[DIFF]);
37153 USE 10 (ONCE_REWRITE_RULE [FUN_EQ_THM]);
37156 UND 0 THEN ASM_REWRITE_TAC[];
37157 REWRITE_TAC[CARD_CLAUSES];
37158 UND 7 THEN UND 5 THEN UND 1 THEN ARITH_TAC;
37162 let psegment_subset_endpoint = prove_by_refinement(
37163 `!E S k. psegment E /\ S SUBSET E /\ (0 <| num_closure S (pointI k)) /\
37164 (0 <| num_closure (E DIFF S) (pointI k)) ==>
37169 REWRITE_TAC[endpoint];
37170 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
37171 FULL_REWRITE_TAC[psegment;segment];
37172 THM_INTRO_TAC[`S`;`E`;`pointI k`] num_closure_mono;
37173 TYPE_THEN `{0,1,2} (num_closure E (pointI k))` SUBAGOAL_TAC;
37174 FULL_REWRITE_TAC[psegment;segment];
37175 FULL_REWRITE_TAC[INSERT];
37177 FULL_REWRITE_TAC[DISJ_ACI];
37178 FIRST_ASSUM DISJ_CASES_TAC ;
37179 PROOF_BY_CONTR_TAC;
37180 TYPE_THEN `num_closure S (pointI k) = 2` SUBAGOAL_TAC;
37182 UND 8 THEN UND 1 THEN UND 5 THEN ARITH_TAC;
37183 TYPE_THEN `{C | S C /\ closure top2 C (pointI k)} = {C | E C /\ closure top2 C (pointI k)}` SUBAGOAL_TAC;
37184 IMATCH_MP_TAC CARD_SUBSET_EQ;
37185 USE 9 (REWRITE_RULE[num_closure]);
37186 USE 7 (REWRITE_RULE[num_closure]);
37188 IMATCH_MP_TAC FINITE_SUBSET;
37190 REWRITE_TAC[SUBSET;];
37191 REWRITE_TAC[SUBSET;];
37192 FULL_REWRITE_TAC[ISUBSET];
37194 USE 0 (REWRITE_RULE[num_closure]);
37195 USE 0 (MATCH_MP (ARITH_RULE `0 <| CARD X ==> ~(CARD X = 0)`));
37196 TYPE_THEN `{C | (E DIFF S) C /\ closure top2 C (pointI k)} = EMPTY ` SUBAGOAL_TAC;
37197 REWRITE_TAC[EQ_EMPTY ];
37198 USE 12 (REWRITE_RULE[DIFF]);
37199 USE 10 (ONCE_REWRITE_RULE [FUN_EQ_THM]);
37202 UND 0 THEN ASM_REWRITE_TAC[];
37203 REWRITE_TAC[CARD_CLAUSES];
37206 FIRST_ASSUM DISJ_CASES_TAC;
37207 THM_INTRO_TAC[`E`;`pointI k`] num_closure1;
37209 USE 0 (MATCH_MP num_closure_elt);
37210 FULL_REWRITE_TAC[DIFF];
37211 USE 1 (MATCH_MP num_closure_elt);
37215 FULL_REWRITE_TAC[ISUBSET];
37218 UND 6 THEN UND 5 THEN UND 1 THEN ARITH_TAC;
37223 let num_closure_pos = prove_by_refinement(
37225 FINITE G /\ (?e. G e /\ closure top2 e (pointI m)) ==>
37226 (0 <| (num_closure G (pointI m)))`,
37230 PROOF_BY_CONTR_TAC ;
37231 TYPE_THEN `num_closure G (pointI m) = 0` SUBAGOAL_TAC;
37232 UND 3 THEN ARITH_TAC;
37233 THM_INTRO_TAC[`G`;`pointI m`] num_closure0;
37239 let cut_rectagon = prove_by_refinement(
37240 `!E m n. (rectagon E) /\ (0 < num_closure E (pointI m)) /\
37241 (0 < num_closure E (pointI n)) /\ ~(m = n) ==>
37242 (?A B. psegment A /\ psegment B /\ (E = A UNION B) /\
37243 (A INTER B = EMPTY) /\ (endpoint A = {m,n}) /\
37244 (endpoint B = {m,n}) /\
37245 (!k. (0 < num_closure A (pointI k)) /\
37246 (0 < num_closure B (pointI k)) ==> (k = m) \/ (k = n) ))
37252 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
37253 FULL_REWRITE_TAC[rectagon];
37254 THM_INTRO_TAC[`E`;`pointI m`] num_closure_size;
37255 TYPE_THEN `~({C | E C /\ closure top2 C (pointI m)} = EMPTY)` SUBAGOAL_TAC;
37257 FULL_REWRITE_TAC[HAS_SIZE];
37258 USE 6 (AP_TERM `CARD:(((num->real)->bool)->bool)->num`);
37259 USE 6 (REWRITE_RULE[CARD_CLAUSES]);
37260 (**** Changed by JRH because of new ARITH_RULE's inability to handle alpha equivs
37261 UND 6 THEN UND 5 THEN UND 2 THEN ARITH_TAC;
37263 UND 6 THEN UND 5 THEN UND 2 THEN REWRITE_TAC[ARITH_RULE `0 < x ==> (y = x) ==> (0 = y) ==> F`];
37264 FULL_REWRITE_TAC[EMPTY_EXISTS];
37266 THM_INTRO_TAC[`E`;`u`;`m`] rectagon_order;
37267 TYPE_THEN `!n. (0 <| num_closure E (pointI n)) ==> (num_closure E (pointI n) = 2)` SUBAGOAL_TAC ;
37268 TYPE_THEN `{0,2} (num_closure E (pointI n'))` SUBAGOAL_TAC;
37269 FULL_REWRITE_TAC[rectagon];
37270 FULL_REWRITE_TAC[INSERT];
37271 FIRST_ASSUM DISJ_CASES_TAC;
37272 UND 14 THEN UND 12 THEN ARITH_TAC;
37273 TYPE_THEN `u` UNABBREV_TAC;
37275 TYPE_THEN `0 < CARD E - 1` SUBAGOAL_TAC;
37276 PROOF_BY_CONTR_TAC;
37277 TYPE_THEN `num_closure E (pointI m) = 2` SUBAGOAL_TAC;
37278 THM_INTRO_TAC[`E`;`pointI m`] num_closure;
37280 THM_INTRO_TAC[`{C | E C /\ closure top2 C (pointI m)}`;`E`] CARD_SUBSET;
37281 REWRITE_TAC[SUBSET];
37284 UND 15 THEN UND 10 THEN ARITH_TAC;
37286 TYPE_THEN `!m. (closure top2 (f 0) (pointI m)) /\ (closure top2 (f (CARD E - 1)) (pointI m)) ==> (m = adjv (f 0) (f (CARD E -| 1)))` SUBAGOAL_TAC;
37287 IMATCH_MP_TAC adjv_unique;
37288 FULL_REWRITE_TAC[BIJ;INJ;rectagon;ISUBSET ];
37290 FIRST_ASSUM IMATCH_MP_TAC ;
37291 FIRST_ASSUM IMATCH_MP_TAC ;
37292 UND 10 THEN ARITH_TAC;
37293 REWRITE_TAC[adj;EMPTY_EXISTS;INTER;];
37295 TYPE_THEN `0 = (CARD E -| 1)` SUBAGOAL_TAC;
37296 FIRST_ASSUM IMATCH_MP_TAC ;
37297 UND 10 THEN ARITH_TAC;
37298 UND 22 THEN UND 10 THEN ARITH_TAC;
37299 TYPE_THEN `pointI m'` EXISTS_TAC;
37301 TYPE_THEN `num_closure E (pointI n) = 2` SUBAGOAL_TAC;
37302 THM_INTRO_TAC[`E`;`pointI n`] num_closure2;
37304 TYPE_THEN `E a /\ closure top2 a (pointI n)` SUBAGOAL_TAC;
37305 TYPE_THEN `E b /\ closure top2 b (pointI n)` SUBAGOAL_TAC;
37306 TYPE_THEN `?i. (i < CARD E) /\ (f i = a)` SUBAGOAL_TAC;
37307 FULL_REWRITE_TAC[BIJ;SURJ];
37308 TYPE_THEN `a` UNABBREV_TAC;
37309 TYPE_THEN `?j. (j < CARD E) /\ (f j = b)` SUBAGOAL_TAC;
37310 FULL_REWRITE_TAC[BIJ;SURJ];
37311 TYPE_THEN `b` UNABBREV_TAC;
37313 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
37315 TYPE_THEN `adj (f i) (f j)` SUBAGOAL_TAC THEN REWRITE_TAC[adj];
37316 REWRITE_TAC[INTER;EMPTY_EXISTS ];
37320 TYPE_THEN `edge (f i)` SUBAGOAL_TAC;
37321 FULL_REWRITE_TAC[rectagon;ISUBSET];
37322 TYPE_THEN `edge (f j)` SUBAGOAL_TAC;
37323 FULL_REWRITE_TAC[rectagon;ISUBSET];
37324 TYPE_THEN `?k. (k < CARD E -| 1) /\ (n = adjv (f k) (f (SUC k)))` SUBAGOAL_TAC;
37325 FIRST_ASSUM DISJ_CASES_TAC;
37326 TYPE_THEN `i` EXISTS_TAC;
37329 UND 27 THEN UND 23 THEN ARITH_TAC;
37330 IMATCH_MP_TAC adjv_unique;
37331 FIRST_ASSUM DISJ_CASES_TAC;
37332 TYPE_THEN `j` EXISTS_TAC;
37335 UND 28 THEN UND 22 THEN ARITH_TAC;
37336 IMATCH_MP_TAC adjv_unique;
37337 USE 24 (ONCE_REWRITE_RULE[adj_symm]);
37339 FIRST_ASSUM DISJ_CASES_TAC;
37340 TYPE_THEN `i` UNABBREV_TAC;
37341 TYPE_THEN `j` UNABBREV_TAC;
37343 UND 13 THEN DISCH_THEN (THM_INTRO_TAC[`m`]);
37344 UND 29 THEN DISCH_THEN (THM_INTRO_TAC[`n`]);
37345 PROOF_BY_CONTR_TAC;
37346 UND 29 THEN UND 13 THEN UND 0 THEN MESON_TAC[];
37347 TYPE_THEN `i` UNABBREV_TAC;
37348 TYPE_THEN `j` UNABBREV_TAC;
37350 UND 13 THEN DISCH_THEN (THM_INTRO_TAC[`m`]);
37351 UND 29 THEN DISCH_THEN (THM_INTRO_TAC[`n`]);
37352 PROOF_BY_CONTR_TAC;
37353 UND 29 THEN UND 13 THEN UND 0 THEN MESON_TAC[];
37355 TYPE_THEN `A = IMAGE f {p | p <| SUC(k)}` ABBREV_TAC ;
37356 TYPE_THEN `B = IMAGE f {p | SUC(k) <=| p /\ p < CARD E}` ABBREV_TAC ;
37357 TYPE_THEN `A` EXISTS_TAC;
37358 TYPE_THEN `B` EXISTS_TAC;
37359 (* -D , now prove properties *)
37374 TYPE_THEN `A` UNABBREV_TAC;
37375 IMATCH_MP_TAC order_imp_psegment;
37376 REWRITE_TAC[ARITH_RULE `0 <| SUC k`];
37379 FULL_REWRITE_TAC[BIJ;INJ];
37380 TYPE_THEN `!x. E x ==> edge x` SUBAGOAL_TAC;
37381 FULL_REWRITE_TAC[rectagon;ISUBSET];
37383 FIRST_ASSUM IMATCH_MP_TAC ;
37384 FIRST_ASSUM IMATCH_MP_TAC ;
37385 UND 17 THEN UND 28 THEN ARITH_TAC;
37386 FIRST_ASSUM IMATCH_MP_TAC ;
37387 UND 18 THEN UND 19 THEN UND 28 THEN ARITH_TAC;
37389 UND 21 THEN DISCH_THEN ( THM_INTRO_TAC[`i`;`j`]);
37390 UND 8 THEN UND 15 THEN UND 28 THEN ARITH_TAC;
37391 TYPE_THEN `~(j = CARD E -| 1)` SUBAGOAL_TAC;
37392 UND 18 THEN UND 8 THEN UND 28 THEN ARITH_TAC;
37393 TYPE_THEN `~(i = CARD E -| 1)` SUBAGOAL_TAC;
37394 UND 19 THEN UND 15 THEN UND 28 THEN ARITH_TAC;
37397 TYPE_THEN `B` UNABBREV_TAC;
37398 IMATCH_MP_TAC order_imp_psegment_shift;
37400 FULL_REWRITE_TAC[BIJ;INJ];
37401 TYPE_THEN `!x. E x ==> edge x` SUBAGOAL_TAC;
37402 FULL_REWRITE_TAC[rectagon;ISUBSET];
37404 FIRST_ASSUM IMATCH_MP_TAC ;
37405 FIRST_ASSUM IMATCH_MP_TAC ;
37407 UND 28 THEN ARITH_TAC;
37409 UND 21 THEN DISCH_THEN ( THM_INTRO_TAC[`i`;`j`]);
37410 TYPE_THEN `~(j = 0)` SUBAGOAL_TAC;
37411 UND 21 THEN UND 17 THEN ARITH_TAC;
37412 TYPE_THEN `~(i = 0)` SUBAGOAL_TAC;
37413 UND 22 THEN UND 19 THEN ARITH_TAC;
37416 TYPE_THEN `(IMAGE f {p | p <| CARD E} = E)` SUBAGOAL_TAC;
37417 IMATCH_MP_TAC bij_imp_image;
37418 TYPE_THEN `A` UNABBREV_TAC;
37419 TYPE_THEN `B` UNABBREV_TAC;
37420 REWRITE_TAC[GSYM IMAGE_UNION];
37421 TYPE_THEN `cE = CARD E` ABBREV_TAC ;
37422 UND 16 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t]);
37424 IMATCH_MP_TAC EQ_EXT;
37425 REWRITE_TAC[UNION];
37426 UND 28 THEN ARITH_TAC;
37429 TYPE_THEN `A` UNABBREV_TAC;
37430 TYPE_THEN `B` UNABBREV_TAC ;
37431 REWRITE_TAC[IMAGE];
37432 PROOF_BY_CONTR_TAC ;
37433 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
37434 TYPE_THEN `u'` UNABBREV_TAC;
37435 TYPE_THEN `x = x'` SUBAGOAL_TAC;
37436 FULL_REWRITE_TAC[BIJ;INJ];
37437 FIRST_ASSUM IMATCH_MP_TAC ;
37438 UND 22 THEN UND 28 THEN ARITH_TAC;
37439 UND 20 THEN UND 19 THEN UND 22 THEN ARITH_TAC;
37441 TYPE_THEN `E DIFF A = B` SUBAGOAL_TAC;
37442 UND 17 THEN SET_TAC[UNION;DIFF;INTER;EMPTY];
37443 TYPE_THEN `E DIFF B = A` SUBAGOAL_TAC;
37444 UND 17 THEN SET_TAC[UNION;DIFF;INTER;EMPTY];
37445 (* - finite A ,B *)
37446 TYPE_THEN `FINITE A` SUBAGOAL_TAC;
37447 IMATCH_MP_TAC FINITE_SUBSET;
37448 TYPE_THEN `E` EXISTS_TAC;
37449 REWRITE_TAC[SUBSET;UNION];
37450 TYPE_THEN `FINITE B` SUBAGOAL_TAC;
37451 IMATCH_MP_TAC FINITE_SUBSET;
37452 TYPE_THEN `E` EXISTS_TAC;
37453 REWRITE_TAC[SUBSET;UNION];
37455 TYPE_THEN `edge (f k) /\ edge (f (SUC k)) /\ adj (f k) (f (SUC k))` SUBAGOAL_TAC;
37456 FULL_REWRITE_TAC[rectagon;ISUBSET];
37459 FIRST_ASSUM IMATCH_MP_TAC ;
37460 USE 11 (REWRITE_RULE[BIJ;SURJ]);
37461 FIRST_ASSUM IMATCH_MP_TAC ;
37462 UND 28 THEN ARITH_TAC;
37464 FIRST_ASSUM IMATCH_MP_TAC ;
37465 USE 11 (REWRITE_RULE[BIJ;SURJ]);
37466 FIRST_ASSUM IMATCH_MP_TAC ;
37467 UND 28 THEN ARITH_TAC;
37468 UND 21 THEN DISCH_THEN (THM_INTRO_TAC[`k`;`SUC k`]);
37469 UND 28 THEN ARITH_TAC;
37471 TYPE_THEN `0 <| num_closure A (pointI n)` SUBAGOAL_TAC;
37472 IMATCH_MP_TAC num_closure_pos;
37473 TYPE_THEN `f k` EXISTS_TAC;
37474 TYPE_THEN `A` UNABBREV_TAC;
37476 REWRITE_TAC[IMAGE];
37477 TYPE_THEN `k` EXISTS_TAC;
37479 IMATCH_MP_TAC adjv_adj;
37481 TYPE_THEN `0 <| num_closure B (pointI n)` SUBAGOAL_TAC;
37482 IMATCH_MP_TAC num_closure_pos;
37483 TYPE_THEN `f (SUC k)` EXISTS_TAC;
37484 TYPE_THEN `B` UNABBREV_TAC;
37486 REWRITE_TAC[IMAGE];
37487 TYPE_THEN `SUC k` EXISTS_TAC;
37488 UND 28 THEN ARITH_TAC;
37489 IMATCH_MP_TAC adjv_adj2;
37491 TYPE_THEN `0 <| num_closure A (pointI m)` SUBAGOAL_TAC;
37492 IMATCH_MP_TAC num_closure_pos;
37493 TYPE_THEN `f 0` EXISTS_TAC;
37494 TYPE_THEN `A` UNABBREV_TAC;
37495 REWRITE_TAC[IMAGE];
37496 TYPE_THEN `0` EXISTS_TAC;
37499 TYPE_THEN `0 <| num_closure B (pointI m)` SUBAGOAL_TAC;
37500 IMATCH_MP_TAC num_closure_pos;
37502 TYPE_THEN `f (CARD E -| 1)` EXISTS_TAC;
37503 TYPE_THEN `B` UNABBREV_TAC;
37504 REWRITE_TAC[IMAGE];
37505 TYPE_THEN `CARD E -| 1` EXISTS_TAC;
37506 UND 28 THEN ARITH_TAC;
37509 IMATCH_MP_TAC has_size2_pair;
37512 IMATCH_MP_TAC endpoint_size2;
37514 IMATCH_MP_TAC rectagon_subset_endpoint;
37516 ASM_REWRITE_TAC[SUBSET;UNION];
37518 IMATCH_MP_TAC rectagon_subset_endpoint;
37520 ASM_REWRITE_TAC[SUBSET;UNION];
37521 TYPE_THEN `n` UNABBREV_TAC;
37522 UND 34 THEN UND 27 THEN UND 0 THEN MESON_TAC[];
37525 IMATCH_MP_TAC has_size2_pair;
37528 IMATCH_MP_TAC endpoint_size2;
37530 IMATCH_MP_TAC rectagon_subset_endpoint;
37532 ASM_REWRITE_TAC[SUBSET;UNION];
37534 IMATCH_MP_TAC rectagon_subset_endpoint;
37536 ASM_REWRITE_TAC[SUBSET;UNION];
37537 TYPE_THEN `n` UNABBREV_TAC;
37538 UND 35 THEN UND 27 THEN UND 0 THEN MESON_TAC[];
37540 THM_INTRO_TAC[`E`;`A`;`k'`] rectagon_subset_endpoint;
37541 ASM_REWRITE_TAC[SUBSET;UNION];
37543 USE 38 (REWRITE_RULE[INR in_pair]);
37544 UND 38 THEN MESON_TAC[];
37549 (* ------------------------------------------------------------------ *)
37551 (* ------------------------------------------------------------------ *)
37553 (* 2 - connected *)
37556 (* -------------- MOVE TO TACTICS, *)
37557 (* proves ineqs of the form a + (&:0)*c <= b.
37558 This handles ineqs such as a <=: a + &:(SUC n) that
37559 INT_ARITH_TAC can't do. *)
37561 let int_le_mp = prove_by_refinement(
37562 `!a b c. (a +: c = b) /\ (&:0 <=: c) ==> (a + (&:0)*c <=: b)`,
37569 (* rewrites assumptions as 0 <= A, breaks 0 <= A + B into 2,
37570 then breaks 0 <= A*B into 2, and tries rewriting and INT_ARITH_TAC *)
37572 let int_le_tac = RULE_ASSUM_TAC (ONCE_REWRITE_RULE [GSYM INT_SUB_LE]) THEN
37573 IMATCH_MP_TAC int_le_mp THEN
37574 CONJ_TAC THENL [TRY INT_ARITH_TAC;ALL_TAC] THEN
37575 ASM_REWRITE_TAC[INT_POS] THEN
37576 REPEAT (IMATCH_MP_TAC INT_LE_ADD THEN CONJ_TAC THEN
37577 ASM_REWRITE_TAC[INT_POS]) THEN
37578 REPEAT (IMATCH_MP_TAC INT_LE_MUL THEN CONJ_TAC THEN
37579 ASM_REWRITE_TAC[INT_POS]) THEN
37580 ASM_REWRITE_TAC[INT_POS] THEN
37581 TRY INT_ARITH_TAC;;
37584 let clean_int_le_tac = FULL_REWRITE_TAC[INT_MUL_LZERO;INT_ADD_RID];;
37586 let test_case_int_le_tac = prove_by_refinement(
37587 `!a b n. a +: &:(SUC n) <= b ==> a <= b`,
37590 (* INT_ARITH_TAC fails *)
37592 TYPE_THEN `a + (&:0)*((b - (a +: &:(SUC n))) + (&:(SUC n))) <=: b` SUBAGOAL_TAC;
37601 (* -------------- *)
37603 let segment_end = jordan_def `segment_end S a b <=>
37604 psegment S /\ (endpoint S = {a,b})`;;
37606 let conn = jordan_def `conn E <=> (!a b.
37607 (cls E a /\ cls E b /\ ~(a = b) ==>
37608 (?S. (S SUBSET E /\ segment_end S a b))))`;;
37610 let conn2 = jordan_def `conn2 E <=> (FINITE E) /\
37611 (2 <=| CARD E) /\ (!a b c. cls E a /\ cls E b /\
37612 ~(a = b) /\ ~(b = c) /\ ~(a = c) ==>
37613 (?S. (S SUBSET E /\ segment_end S a b /\ ~(cls S c))))`;;
37615 let segment_end_symm = prove_by_refinement(
37616 `!S a b. (segment_end S a b = segment_end S b a)`,
37619 REWRITE_TAC[segment_end];
37620 TYPE_THEN `{a,b} = {b,a}` SUBAGOAL_TAC;
37621 IMATCH_MP_TAC EQ_EXT;
37622 REWRITE_TAC[INR in_pair];
37627 let segment_end_disj = prove_by_refinement(
37628 `!S a b. segment_end S a b ==> ~(a = b)`,
37631 REWRITE_TAC[segment_end];
37632 THM_INTRO_TAC[`S`] endpoint_size2;
37633 USE 3 (REWRITE_RULE[has_size2]);
37634 TYPE_THEN `endpoint S` UNABBREV_TAC;
37635 USE 1 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
37636 FULL_REWRITE_TAC[INR in_pair];
37646 let cut_psegment = prove_by_refinement(
37647 `!E a b c. segment_end E a b /\ cls E c /\ ~(c = a) /\ ~(c = b) ==>
37648 (?A B. (E = (A UNION B)) /\ (A INTER B = EMPTY) /\
37649 (cls A INTER cls B = {c}) /\
37650 segment_end A a c /\ segment_end B c b)`,
37654 TYPE_THEN `~(a = b)` SUBAGOAL_TAC;
37655 THM_INTRO_TAC[`E`;`a`;`b`] segment_end_disj;
37658 FULL_REWRITE_TAC[segment_end];
37659 FULL_REWRITE_TAC[cls];
37660 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
37661 FULL_REWRITE_TAC[psegment;segment];
37662 REWRITE_TAC[INR eq_sing;INTER;EQ_EMPTY ];
37663 REWRITE_TAC[CONJ_ACI];
37665 THM_INTRO_TAC[`E`;`a`;`b`] psegment_order;
37666 REWRITE_TAC[INR in_pair];
37667 TYPE_THEN `num_closure E (pointI c) = 2` SUBAGOAL_TAC;
37668 TYPE_THEN `{0,1,2} (num_closure E (pointI c))` SUBAGOAL_TAC;
37669 FULL_REWRITE_TAC[psegment;segment];
37670 FULL_REWRITE_TAC[INSERT;DISJ_ACI];
37671 FIRST_ASSUM DISJ_CASES_TAC;
37672 FIRST_ASSUM DISJ_CASES_TAC;
37674 TYPE_THEN `endpoint E c` SUBAGOAL_TAC;
37675 REWRITE_TAC[endpoint];
37676 TYPE_THEN `endpoint E` UNABBREV_TAC;
37678 THM_INTRO_TAC[`E`;`pointI c`] num_closure0;
37683 TYPE_THEN `?k. (k < CARD E -| 1) /\ (c = adjv (f k) (f (SUC k)))` SUBAGOAL_TAC;
37684 THM_INTRO_TAC[`E`;`pointI c`] num_closure2;
37686 TYPE_THEN `E a' /\ closure top2 a' (pointI c)` SUBAGOAL_TAC;
37687 TYPE_THEN `?i'. (i' <| CARD E) /\ ( f i' = a')` SUBAGOAL_TAC;
37688 FULL_REWRITE_TAC[BIJ;SURJ];
37689 TYPE_THEN `a'` UNABBREV_TAC;
37690 TYPE_THEN `E b' /\ closure top2 b' (pointI c)` SUBAGOAL_TAC;
37691 TYPE_THEN `?j'. (j' <| CARD E) /\ ( f j' = b')` SUBAGOAL_TAC;
37692 FULL_REWRITE_TAC[BIJ;SURJ];
37693 TYPE_THEN `b'` UNABBREV_TAC;
37694 UND 8 THEN DISCH_THEN ( THM_INTRO_TAC[`i'`;`j'`]);
37696 TYPE_THEN `adj (f i') (f j')` SUBAGOAL_TAC;
37697 IMATCH_MP_TAC closure_imp_adj;
37700 FIRST_ASSUM DISJ_CASES_TAC;
37701 TYPE_THEN `i'` EXISTS_TAC;
37703 UND 22 THEN UND 21 THEN ARITH_TAC;
37704 IMATCH_MP_TAC adjv_unique;
37705 FULL_REWRITE_TAC[psegment;segment;ISUBSET];
37706 TYPE_THEN `j'` EXISTS_TAC;
37708 UND 22 THEN UND 18 THEN ARITH_TAC;
37709 IMATCH_MP_TAC adjv_unique;
37710 USE 20 (ONCE_REWRITE_RULE[adj_symm]);
37711 FULL_REWRITE_TAC[psegment;segment;ISUBSET];
37713 TYPE_THEN `c` UNABBREV_TAC;
37714 TYPE_THEN `A = IMAGE f { p | p <| SUC k}` ABBREV_TAC ;
37715 TYPE_THEN `B = IMAGE f { p | SUC k <=| p /\ p < CARD E}` ABBREV_TAC ;
37716 TYPE_THEN `A` EXISTS_TAC;
37717 TYPE_THEN `B` EXISTS_TAC;
37718 (* - now prove properties *)
37719 TYPE_THEN `psegment A` SUBAGOAL_TAC;
37720 TYPE_THEN `A` UNABBREV_TAC;
37721 IMATCH_MP_TAC order_imp_psegment;
37723 FULL_REWRITE_TAC[BIJ;INJ];
37724 TYPE_THEN `!x. E x ==> edge x` SUBAGOAL_TAC;
37725 FULL_REWRITE_TAC[psegment;segment;ISUBSET];
37727 FIRST_ASSUM IMATCH_MP_TAC ;
37728 FIRST_ASSUM IMATCH_MP_TAC ;
37729 UND 18 THEN UND 14 THEN ARITH_TAC;
37730 FIRST_ASSUM IMATCH_MP_TAC ;
37731 UND 19 THEN UND 20 THEN UND 14 THEN ARITH_TAC;
37734 FIRST_ASSUM IMATCH_MP_TAC ;
37735 UND 13 THEN UND 16 THEN UND 14 THEN ARITH_TAC;
37737 TYPE_THEN `psegment B` SUBAGOAL_TAC;
37738 TYPE_THEN `B` UNABBREV_TAC;
37739 IMATCH_MP_TAC order_imp_psegment_shift;
37741 FULL_REWRITE_TAC[BIJ;INJ];
37742 TYPE_THEN `!x. E x ==> edge x` SUBAGOAL_TAC;
37743 FULL_REWRITE_TAC[psegment;segment;ISUBSET];
37745 FIRST_ASSUM IMATCH_MP_TAC ;
37746 FIRST_ASSUM IMATCH_MP_TAC ;
37748 UND 14 THEN ARITH_TAC;
37749 FIRST_ASSUM IMATCH_MP_TAC ;
37752 TYPE_THEN `A` UNABBREV_TAC;
37753 TYPE_THEN `B` UNABBREV_TAC;
37754 FULL_REWRITE_TAC[IMAGE];
37755 TYPE_THEN`x` UNABBREV_TAC;
37756 TYPE_THEN `x' = x''` SUBAGOAL_TAC;
37757 FULL_REWRITE_TAC[BIJ;INJ];
37758 FIRST_ASSUM IMATCH_MP_TAC ;
37759 UND 15 THEN UND 14 THEN ARITH_TAC;
37760 TYPE_THEN `x''` UNABBREV_TAC;
37761 UND 15 THEN UND 20 THEN ARITH_TAC;
37763 TYPE_THEN `!x. E x ==> edge x` SUBAGOAL_TAC;
37764 FULL_REWRITE_TAC[psegment;segment;ISUBSET];
37766 TYPE_THEN `edge (f k) /\ edge (f (SUC k)) /\ adj (f k) (f (SUC k))` SUBAGOAL_TAC;
37768 FIRST_ASSUM IMATCH_MP_TAC ;
37769 FULL_REWRITE_TAC[BIJ;SURJ];
37770 FIRST_ASSUM IMATCH_MP_TAC ;
37771 UND 14 THEN ARITH_TAC;
37773 FIRST_ASSUM IMATCH_MP_TAC ;
37774 FULL_REWRITE_TAC[BIJ;SURJ];
37775 FIRST_ASSUM IMATCH_MP_TAC ;
37776 UND 14 THEN ARITH_TAC;
37777 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[`k`;`SUC k`]);
37778 UND 14 THEN ARITH_TAC;
37780 TYPE_THEN `(?e. A e /\ closure top2 e (pointI (adjv (f k) (f (SUC k)))))` SUBAGOAL_TAC;
37781 TYPE_THEN `f k` EXISTS_TAC;
37782 TYPE_THEN `A` UNABBREV_TAC;
37784 REWRITE_TAC[IMAGE];
37785 TYPE_THEN `k` EXISTS_TAC;
37787 IMATCH_MP_TAC adjv_adj;
37789 TYPE_THEN `(?e. B e /\ closure top2 e (pointI (adjv (f k) (f (SUC k)))))` SUBAGOAL_TAC;
37790 TYPE_THEN `f (SUC k)` EXISTS_TAC;
37791 TYPE_THEN `B` UNABBREV_TAC;
37793 REWRITE_TAC[IMAGE];
37794 TYPE_THEN `SUC k` EXISTS_TAC;
37795 UND 14 THEN ARITH_TAC;
37796 IMATCH_MP_TAC adjv_adj2;
37798 TYPE_THEN `IMAGE f {p | p <| CARD E} = E` SUBAGOAL_TAC;
37799 IMATCH_MP_TAC bij_imp_image;
37801 TYPE_THEN `A UNION B = E` SUBAGOAL_TAC;
37802 TYPE_THEN `A` UNABBREV_TAC;
37803 TYPE_THEN `B` UNABBREV_TAC;
37804 REWRITE_TAC[GSYM IMAGE_UNION];
37805 TYPE_THEN `cE = CARD E` ABBREV_TAC ;
37806 UND 27 THEN (DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t])) THEN AP_TERM_TAC;
37807 IMATCH_MP_TAC EQ_EXT;
37808 REWRITE_TAC[UNION];
37809 UND 14 THEN ARITH_TAC;
37811 TYPE_THEN `FINITE A` SUBAGOAL_TAC;
37812 IMATCH_MP_TAC FINITE_SUBSET;
37813 TYPE_THEN `E` EXISTS_TAC;
37815 REWRITE_TAC[SUBSET;UNION];
37816 TYPE_THEN `FINITE B` SUBAGOAL_TAC;
37817 IMATCH_MP_TAC FINITE_SUBSET;
37818 TYPE_THEN `E` EXISTS_TAC;
37820 REWRITE_TAC[SUBSET;UNION];
37822 TYPE_THEN `E DIFF A = B` SUBAGOAL_TAC;
37824 IMATCH_MP_TAC EQ_EXT;
37825 REWRITE_TAC[UNION;DIFF];
37826 UND 18 THEN MESON_TAC[];
37828 TYPE_THEN `E DIFF B = A` SUBAGOAL_TAC;
37830 IMATCH_MP_TAC EQ_EXT;
37831 REWRITE_TAC[UNION;DIFF];
37832 UND 18 THEN MESON_TAC[];
37834 TYPE_THEN `endpoint A (adjv (f k) (f (SUC k)))` SUBAGOAL_TAC;
37835 IMATCH_MP_TAC psegment_subset_endpoint;
37839 REWRITE_TAC[SUBSET;UNION];
37840 REWRITE_TAC[ARITH_RULE `(0 <| x) <=> ~(x = 0)`];
37842 THM_INTRO_TAC[`A`;`(pointI (adjv (f k) (f (SUC k))))`] num_closure0;
37845 THM_INTRO_TAC[`B`;`(pointI (adjv (f k) (f (SUC k))))`] num_closure0;
37849 TYPE_THEN `endpoint B (adjv (f k) (f (SUC k)))` SUBAGOAL_TAC;
37850 IMATCH_MP_TAC psegment_subset_endpoint;
37854 REWRITE_TAC[SUBSET;UNION];
37855 REWRITE_TAC[ARITH_RULE `(0 <| x) <=> ~(x = 0)`];
37857 THM_INTRO_TAC[`B`;`(pointI (adjv (f k) (f (SUC k))))`] num_closure0;
37860 THM_INTRO_TAC[`A`;`(pointI (adjv (f k) (f (SUC k))))`] num_closure0;
37864 TYPE_THEN `endpoint A a` SUBAGOAL_TAC;
37865 REWRITE_TAC[endpoint];
37866 TYPE_THEN `endpoint E a` SUBAGOAL_TAC;
37867 REWRITE_TAC[INR in_pair];
37868 THM_INTRO_TAC[`A`;`E`;`pointI a`] num_closure_mono;
37870 REWRITE_TAC[SUBSET;UNION];
37871 USE 35 (REWRITE_RULE[endpoint]);
37873 USE 36 (REWRITE_RULE[ARITH_RULE `(x <=| 1) <=> (x = 1) \/ (x = 0)`]);
37874 FIRST_ASSUM DISJ_CASES_TAC;
37875 THM_INTRO_TAC[`A`;`pointI a`] num_closure0;
37879 UND 38 THEN DISCH_THEN (THM_INTRO_TAC[]);
37880 TYPE_THEN`A` UNABBREV_TAC;
37881 REWRITE_TAC[IMAGE];
37882 TYPE_THEN `0` EXISTS_TAC;
37884 THM_INTRO_TAC[`E`;`a`] terminal_endpoint;
37885 REWRITE_TAC[INR in_pair];
37886 UND 39 THEN ASM_REWRITE_TAC[];
37888 TYPE_THEN `endpoint B b` SUBAGOAL_TAC;
37889 REWRITE_TAC[endpoint];
37890 TYPE_THEN `endpoint E b` SUBAGOAL_TAC;
37891 REWRITE_TAC[INR in_pair];
37892 THM_INTRO_TAC[`B`;`E`;`pointI b`] num_closure_mono;
37894 REWRITE_TAC[SUBSET;UNION];
37895 USE 36 (REWRITE_RULE[endpoint]);
37897 USE 37 (REWRITE_RULE[ARITH_RULE `(x <=| 1) <=> (x = 1) \/ (x = 0)`]);
37898 FIRST_ASSUM DISJ_CASES_TAC;
37899 THM_INTRO_TAC[`B`;`pointI b`] num_closure0;
37901 TSPEC `f (CARD E -| 1)` 39 ;
37902 UND 39 THEN DISCH_THEN (THM_INTRO_TAC[]);
37903 TYPE_THEN`B` UNABBREV_TAC;
37904 REWRITE_TAC[IMAGE];
37905 TYPE_THEN `CARD E -| 1` EXISTS_TAC;
37906 UND 14 THEN ARITH_TAC;
37907 THM_INTRO_TAC[`E`;`b`] terminal_endpoint;
37908 REWRITE_TAC[INR in_pair];
37909 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[]);
37910 UND 14 THEN ARITH_TAC;
37911 UND 39 THEN ASM_REWRITE_TAC[];
37913 TYPE_THEN `endpoint A = {a, (adjv (f k) (f (SUC k)))}` SUBAGOAL_TAC;
37914 IMATCH_MP_TAC has_size2_pair;
37915 IMATCH_MP_TAC endpoint_size2;
37916 TYPE_THEN `endpoint B = {(adjv (f k) (f (SUC k))), b}` SUBAGOAL_TAC;
37917 IMATCH_MP_TAC has_size2_pair;
37918 IMATCH_MP_TAC endpoint_size2;
37922 TYPE_THEN `endpoint A u` SUBAGOAL_TAC;
37923 IMATCH_MP_TAC psegment_subset_endpoint;
37927 REWRITE_TAC[SUBSET;UNION];
37929 IMATCH_MP_TAC num_closure_pos;
37931 IMATCH_MP_TAC num_closure_pos;
37932 TYPE_THEN `e''''` EXISTS_TAC ;
37934 TYPE_THEN `endpoint B u` SUBAGOAL_TAC;
37935 IMATCH_MP_TAC psegment_subset_endpoint;
37939 REWRITE_TAC[SUBSET;UNION];
37941 IMATCH_MP_TAC num_closure_pos;
37942 TYPE_THEN `e''''` EXISTS_TAC ;
37943 IMATCH_MP_TAC num_closure_pos;
37944 TYPE_THEN `e'''` EXISTS_TAC ;
37945 TYPE_THEN `endpoint A` UNABBREV_TAC;
37946 TYPE_THEN `endpoint B` UNABBREV_TAC;
37947 FULL_REWRITE_TAC[INR in_pair];
37948 FIRST_ASSUM DISJ_CASES_TAC;
37949 TYPE_THEN `u` UNABBREV_TAC;
37953 TYPE_THEN `e'` EXISTS_TAC;
37954 TYPE_THEN `e''` EXISTS_TAC;
37958 let segment_end_inj = prove_by_refinement(
37959 `!S a b c. (segment_end S a b /\ segment_end S a c) ==> (b = c)`,
37963 THM_INTRO_TAC[`S`;`a`;`b`] segment_end_disj;
37964 THM_INTRO_TAC[`S`;`a`;`c`] segment_end_disj;
37965 FULL_REWRITE_TAC[segment_end];
37966 TYPE_THEN `endpoint S` UNABBREV_TAC;
37967 USE 0 (ONCE_REWRITE_RULE [FUN_EQ_THM]);
37969 FULL_REWRITE_TAC[INR in_pair];
37974 let segment_end_finite = prove_by_refinement(
37975 `!S a b. segment_end S a b ==> FINITE S`,
37978 REWRITE_TAC[segment_end;psegment;segment];
37982 let segment_superset_endpoint = prove_by_refinement(
37983 `!E S k. segment E /\ S SUBSET E /\ (endpoint S k) /\
37984 (num_closure (E DIFF S) (pointI k) = 0) ==>
37988 REWRITE_TAC[endpoint];
37989 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
37990 FULL_REWRITE_TAC[segment];
37991 ASM_SIMP_TAC[num_closure1];
37992 TYPE_THEN `FINITE S` SUBAGOAL_TAC;
37993 IMATCH_MP_TAC FINITE_SUBSET;
37995 THM_INTRO_TAC[`S`;`pointI k`] num_closure1;
37997 TYPE_THEN `e` EXISTS_TAC;
37998 TYPE_THEN `S e /\ closure top2 e (pointI k)` SUBAGOAL_TAC;
37999 TYPE_THEN `S e'` ASM_CASES_TAC;
38000 FULL_REWRITE_TAC[ISUBSET];
38002 THM_INTRO_TAC[`S`;`pointI k`] num_closure0;
38004 FULL_REWRITE_TAC[ARITH_RULE `~(1=0)`];
38005 TYPE_THEN `~(e = e')` SUBAGOAL_TAC;
38008 USE 0 (REWRITE_RULE[ARITH_RULE `(x = 0) <=> ~(0 <| x)`]);
38009 UND 0 THEN REWRITE_TAC[];
38010 IMATCH_MP_TAC num_closure_pos;
38012 IMATCH_MP_TAC FINITE_SUBSET;
38013 TYPE_THEN `E` EXISTS_TAC;
38014 REWRITE_TAC[DIFF;SUBSET];
38015 TYPE_THEN `e'` EXISTS_TAC;
38020 let segment_end_union_lemma = prove_by_refinement(
38021 `!A B a b c. segment_end A a b /\ segment_end B b c /\
38022 (A INTER B = EMPTY) /\ (cls A INTER cls B = {b}) ==>
38023 segment_end (A UNION B) a c `,
38028 THM_INTRO_TAC[`A`;`a`;`b`] segment_end_disj;
38029 THM_INTRO_TAC[`B`;`b`;`c`] segment_end_disj;
38030 FULL_REWRITE_TAC[cls;segment_end];
38031 TYPE_THEN `segment (A UNION B) /\ (endpoint (A UNION B) = {a,c}) ==> psegment (A UNION B) /\ (endpoint (A UNION B) = {a, c})` SUBAGOAL_TAC;
38032 IMATCH_MP_TAC endpoint_psegment;
38033 TYPE_THEN `a` EXISTS_TAC;
38034 REWRITE_TAC[INR in_pair];
38035 FIRST_ASSUM IMATCH_MP_TAC ;
38038 IMATCH_MP_TAC segment_union;
38039 TYPE_THEN `b` EXISTS_TAC;
38040 REWRITE_TAC[INR in_pair];
38042 FULL_REWRITE_TAC[psegment];
38044 FULL_REWRITE_TAC[psegment];
38045 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
38046 FULL_REWRITE_TAC[INR IN_SING;INTER;];
38048 ASM_MESON_TAC[num_closure_elt];
38050 TYPE_THEN `FINITE A` SUBAGOAL_TAC;
38051 FULL_REWRITE_TAC[psegment;segment];
38052 TYPE_THEN `FINITE B` SUBAGOAL_TAC;
38053 FULL_REWRITE_TAC[psegment;segment];
38054 TYPE_THEN `FINITE (A UNION B)` SUBAGOAL_TAC;
38055 REWRITE_TAC[FINITE_UNION];
38057 TYPE_THEN `endpoint (A UNION B) a` SUBAGOAL_TAC;
38058 IMATCH_MP_TAC segment_superset_endpoint;
38059 TYPE_THEN `A` EXISTS_TAC;
38061 REWRITE_TAC[SUBSET;UNION ];
38062 REWRITE_TAC[INR in_pair];
38063 TYPE_THEN `(A UNION B) DIFF A = B` SUBAGOAL_TAC;
38064 UND 1 THEN SET_TAC[UNION;DIFF;INTER;EMPTY];
38065 ASM_SIMP_TAC[num_closure0];
38066 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
38067 USE 0 (REWRITE_RULE[INTER;INR IN_SING]);
38069 TYPE_THEN `(?e. A e /\ closure top2 e (pointI a))` SUBAGOAL_TAC;
38070 TYPE_THEN `terminal_edge A a` EXISTS_TAC;
38071 TYPE_THEN `endpoint A a` SUBAGOAL_TAC;
38072 REWRITE_TAC[INR in_pair];
38073 IMATCH_MP_TAC terminal_endpoint;
38075 TYPE_THEN `psegment (A UNION B)` SUBAGOAL_TAC;
38076 ASM_MESON_TAC[endpoint_psegment];
38077 IMATCH_MP_TAC has_size2_pair;
38079 TYPE_THEN `endpoint (A UNION B) c` SUBAGOAL_TAC;
38080 IMATCH_MP_TAC segment_superset_endpoint;
38081 TYPE_THEN `B` EXISTS_TAC;
38083 REWRITE_TAC[SUBSET;UNION ];
38084 REWRITE_TAC[INR in_pair];
38085 TYPE_THEN `(A UNION B) DIFF B = A` SUBAGOAL_TAC;
38086 UND 1 THEN SET_TAC[UNION;DIFF;INTER;EMPTY];
38087 ASM_SIMP_TAC[num_closure0];
38088 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
38089 USE 0 (REWRITE_RULE[INTER;INR IN_SING]);
38091 TYPE_THEN `(?e. B e /\ closure top2 e (pointI c))` SUBAGOAL_TAC;
38092 TYPE_THEN `terminal_edge B c` EXISTS_TAC;
38093 TYPE_THEN `endpoint B c` SUBAGOAL_TAC;
38094 REWRITE_TAC[INR in_pair];
38095 IMATCH_MP_TAC terminal_endpoint;
38099 IMATCH_MP_TAC endpoint_size2;
38101 TYPE_THEN`a` UNABBREV_TAC;
38102 TYPE_THEN `endpoint B c /\ endpoint A c` SUBAGOAL_TAC;
38103 REWRITE_TAC[INR in_pair];
38104 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
38105 USE 0 (REWRITE_RULE[INTER;INR IN_SING]);
38107 TYPE_THEN `(?e. A e /\ closure top2 e (pointI c))` SUBAGOAL_TAC;
38108 TYPE_THEN `terminal_edge A c` EXISTS_TAC;
38109 IMATCH_MP_TAC terminal_endpoint;
38110 TYPE_THEN `(?e. B e /\ closure top2 e (pointI c))` SUBAGOAL_TAC;
38111 TYPE_THEN `terminal_edge B c` EXISTS_TAC;
38112 IMATCH_MP_TAC terminal_endpoint;
38118 let cls_subset = prove_by_refinement(
38119 `!A B. A SUBSET B ==> cls A SUBSET cls B`,
38123 REWRITE_TAC[SUBSET];
38124 TYPE_THEN `e` EXISTS_TAC;
38125 ASM_MESON_TAC[ISUBSET];
38129 let segment_end_union = prove_by_refinement(
38130 `!A B a b c. segment_end A a b /\ segment_end B b c /\
38131 (cls A INTER cls B = {b}) ==>
38132 segment_end (A UNION B) a c`,
38136 IMATCH_MP_TAC segment_end_union_lemma;
38137 TYPE_THEN `b` EXISTS_TAC;
38138 PROOF_BY_CONTR_TAC;
38139 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER ];
38140 TYPE_THEN `edge u` SUBAGOAL_TAC;
38141 FULL_REWRITE_TAC[segment_end;psegment;segment;ISUBSET];
38142 TYPE_THEN `(cls {u} ) HAS_SIZE 2` SUBAGOAL_TAC;
38143 REWRITE_TAC[cls_edge];
38144 IMATCH_MP_TAC two_endpoint;
38145 FULL_REWRITE_TAC[has_size2];
38146 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
38147 USE 0 (REWRITE_RULE[INR IN_SING ]);
38151 TYPE_THEN `cls {u} a' /\ cls {u} b'` SUBAGOAL_TAC;
38152 REWRITE_TAC[INR in_pair];
38154 TYPE_THEN `cls {u} SUBSET cls A` SUBAGOAL_TAC;
38155 IMATCH_MP_TAC cls_subset;
38156 REWRITE_TAC[SUBSET;INR IN_SING];
38157 TYPE_THEN `cls {u} SUBSET cls B` SUBAGOAL_TAC;
38158 IMATCH_MP_TAC cls_subset;
38159 REWRITE_TAC[SUBSET;INR IN_SING];
38160 FULL_REWRITE_TAC[ISUBSET];
38166 let segment_end_cls = prove_by_refinement(
38167 `!A a b. segment_end A a b ==> cls A a`,
38170 REWRITE_TAC[cls;segment_end];
38171 TYPE_THEN `terminal_edge A a` EXISTS_TAC;
38172 IMATCH_MP_TAC terminal_endpoint;
38173 FULL_REWRITE_TAC[INR in_pair;psegment;segment];
38177 let segment_end_cls2 = prove_by_refinement(
38178 `!A a b. segment_end A a b ==> cls A b`,
38181 REWRITE_TAC[cls;segment_end];
38182 TYPE_THEN `terminal_edge A b` EXISTS_TAC;
38183 IMATCH_MP_TAC terminal_endpoint;
38184 FULL_REWRITE_TAC[INR in_pair;psegment;segment];
38188 let card_subset_lt = prove_by_refinement(
38189 `!(a:A->bool) b. a SUBSET b /\ ~(a = b) /\ FINITE b ==>
38190 (CARD a < CARD b)`,
38194 IMATCH_MP_TAC (ARITH_RULE (`x <=| y /\ ~( x = y) ==> (x < y)`));
38196 IMATCH_MP_TAC CARD_SUBSET;
38197 UND 1 THEN REWRITE_TAC[];
38198 IMATCH_MP_TAC CARD_SUBSET_EQ;
38202 let segment_end_trans = prove_by_refinement(
38203 `!R S a b c. segment_end R a b /\ segment_end S b c /\ ~(a = c) ==>
38204 (?U. segment_end U a c /\ (U SUBSET (R UNION S)))`,
38208 TYPE_THEN`SS = { (U,V,b') | segment_end U a b' /\ segment_end V b' c /\ (U SUBSET (R UNION S) /\ V SUBSET (R UNION S) ) }` ABBREV_TAC ;
38209 TYPE_THEN `~(SS = EMPTY)` SUBAGOAL_TAC;
38210 UND 4 THEN REWRITE_TAC[EMPTY_EXISTS];
38211 TYPE_THEN `(R,S,b)` EXISTS_TAC;
38212 TYPE_THEN `SS` UNABBREV_TAC;
38213 REWRITE_TAC[PAIR_SPLIT];
38214 CONV_TAC (dropq_conv "U");
38215 CONV_TAC (dropq_conv "V");
38216 TYPE_THEN `b` EXISTS_TAC;
38217 REWRITE_TAC[SUBSET;UNION];
38219 TYPE_THEN `FINITE R` SUBAGOAL_TAC;
38220 IMATCH_MP_TAC segment_end_finite;
38222 TYPE_THEN `FINITE S` SUBAGOAL_TAC;
38223 IMATCH_MP_TAC segment_end_finite;
38225 TYPE_THEN `FINITE (R UNION S)` SUBAGOAL_TAC;
38226 ASM_REWRITE_TAC[FINITE_UNION];
38228 TYPE_THEN `f = (\ ((U,V,b):((((num->real)->bool)->bool)#((((num->real)->bool)->bool)#(int#int))) ). (CARD U) + (CARD V))` ABBREV_TAC ;
38229 THM_INTRO_TAC[`SS`;`f`] select_image_num_min;
38232 TYPE_THEN `?Um Vm bm. z = (Um,Vm,bm)` SUBAGOAL_TAC ;
38233 REWRITE_TAC[PAIR_SPLIT];
38235 TYPE_THEN `z` UNABBREV_TAC;
38236 TYPE_THEN `!U' V' b''. (SS (U',V',b'') ==> f (Um,Vm,bm) <=| f (U',V',b''))` SUBAGOAL_TAC;
38238 TYPE_THEN `SS` UNABBREV_TAC;
38241 USE 3 (ONCE_REWRITE_RULE[PAIR_SPLIT]);
38243 TYPE_THEN `U` UNABBREV_TAC;
38244 USE 3 (ONCE_REWRITE_RULE[PAIR_SPLIT]);
38246 TYPE_THEN `V` UNABBREV_TAC;
38247 TYPE_THEN `b'` UNABBREV_TAC;
38249 TYPE_THEN `! U V b'. f (U,V,b') = CARD U +| CARD V` SUBAGOAL_TAC;
38255 USE 4 (ONCE_REWRITE_RULE[PAIR_SPLIT]);
38257 USE 3 (CONV_RULE (dropq_conv "U"));
38258 USE 3 (ONCE_REWRITE_RULE[PAIR_SPLIT]);
38260 USE 3 (CONV_RULE (dropq_conv "V"));
38261 USE 3 (CONV_RULE (dropq_conv "b''"));
38263 TYPE_THEN `FINITE Vm` SUBAGOAL_TAC;
38264 IMATCH_MP_TAC FINITE_SUBSET;
38266 TYPE_THEN `FINITE Um` SUBAGOAL_TAC;
38267 IMATCH_MP_TAC FINITE_SUBSET;
38270 THM_INTRO_TAC[`S`;`b`;`c`] segment_end_disj;
38271 THM_INTRO_TAC[`R`;`a`;`b`] segment_end_disj;
38272 TYPE_THEN `cls Vm a` ASM_CASES_TAC;
38273 THM_INTRO_TAC[`Vm`;`bm`;`c`;`a`] cut_psegment;
38274 THM_INTRO_TAC[`Um`;`a`;`bm`] segment_end_disj;
38275 TYPE_THEN `B` EXISTS_TAC;
38276 IMATCH_MP_TAC SUBSET_TRANS;
38277 TYPE_THEN `Vm` EXISTS_TAC;
38278 REWRITE_TAC[SUBSET;UNION];
38279 TYPE_THEN `cls Um c` ASM_CASES_TAC;
38280 THM_INTRO_TAC[`Um`;`a`;`bm`;`c`] cut_psegment;
38281 THM_INTRO_TAC[`Vm`;`bm`;`c`] segment_end_disj;
38282 TYPE_THEN `A` EXISTS_TAC;
38283 IMATCH_MP_TAC SUBSET_TRANS;
38284 TYPE_THEN `Um` EXISTS_TAC;
38285 REWRITE_TAC[SUBSET;UNION];
38287 TYPE_THEN `Um UNION Vm` EXISTS_TAC;
38288 IMATCH_MP_TAC (TAUT ` a /\ b ==> b /\ a`);
38290 REWRITE_TAC[union_subset];
38292 IMATCH_MP_TAC segment_end_union;
38293 TYPE_THEN `bm` EXISTS_TAC;
38294 REWRITE_TAC[INTER;eq_sing];
38295 TYPE_THEN `cls Um bm /\ cls Vm bm` SUBAGOAL_TAC;
38296 ASM_MESON_TAC[segment_end_cls;segment_end_cls2];
38298 PROOF_BY_CONTR_TAC;
38300 TYPE_THEN `~(u = a)` SUBAGOAL_TAC;
38302 TYPE_THEN `~(u = c)` SUBAGOAL_TAC;
38304 THM_INTRO_TAC[`Vm`;`bm`;`c`;`u`] cut_psegment;
38305 THM_INTRO_TAC[`Um`;`a`;`bm`;`u`] cut_psegment;
38306 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`A'`;`B`;`u`]);
38308 IMATCH_MP_TAC SUBSET_TRANS;
38309 TYPE_THEN `Um` EXISTS_TAC;
38310 REWRITE_TAC[SUBSET;UNION];
38311 IMATCH_MP_TAC SUBSET_TRANS;
38312 TYPE_THEN `Vm` EXISTS_TAC;
38313 REWRITE_TAC[SUBSET;UNION];
38315 TYPE_THEN `FINITE A'` SUBAGOAL_TAC;
38316 IMATCH_MP_TAC FINITE_SUBSET;
38317 TYPE_THEN `Um` EXISTS_TAC;
38318 REWRITE_TAC[SUBSET;UNION];
38319 TYPE_THEN `FINITE B` SUBAGOAL_TAC;
38320 IMATCH_MP_TAC FINITE_SUBSET;
38321 TYPE_THEN `Vm` EXISTS_TAC;
38322 REWRITE_TAC[SUBSET;UNION];
38325 TYPE_THEN `CARD A' < CARD Um` SUBAGOAL_TAC;
38326 IMATCH_MP_TAC card_subset_lt;
38329 REWRITE_TAC[SUBSET;UNION];
38330 TYPE_THEN `B' = EMPTY` SUBAGOAL_TAC;
38331 FULL_REWRITE_TAC[UNION;INTER;EQ_EMPTY];
38332 USE 37(ONCE_REWRITE_RULE[FUN_EQ_THM]);
38334 FULL_REWRITE_TAC[];
38336 TYPE_THEN`B'` UNABBREV_TAC;
38337 FULL_REWRITE_TAC[segment_end;segment;psegment];
38340 TYPE_THEN `CARD B < CARD Vm` SUBAGOAL_TAC;
38341 IMATCH_MP_TAC card_subset_lt;
38344 REWRITE_TAC[SUBSET;UNION];
38345 TYPE_THEN `A = EMPTY` SUBAGOAL_TAC;
38346 FULL_REWRITE_TAC[UNION;INTER;EQ_EMPTY];
38347 USE 38(ONCE_REWRITE_RULE[FUN_EQ_THM]);
38349 FULL_REWRITE_TAC[];
38351 TYPE_THEN`A` UNABBREV_TAC;
38352 FULL_REWRITE_TAC[segment_end;segment;psegment];
38354 UND 38 THEN UND 37 THEN UND 3 THEN ARITH_TAC;
38358 let cls_union = prove_by_refinement(
38359 `!A B. cls(A UNION B) = cls A UNION cls B`,
38362 REWRITE_TAC[cls;UNION ];
38363 IMATCH_MP_TAC EQ_EXT;
38368 let conn_union = prove_by_refinement(
38369 `!E E'. conn E /\ conn E' /\ ~(cls E INTER cls E' = EMPTY) ==>
38370 conn (E UNION E')`,
38374 REWRITE_TAC[conn;cls_union];
38375 RULE_ASSUM_TAC (REWRITE_RULE[UNION]);
38376 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
38377 TYPE_THEN `!E E' a b u. ~(a = b) /\ ~cls E b /\ ~cls E' a /\ cls E a /\ cls E' b /\ (conn E) /\ (conn E') /\ cls E u /\ cls E' u ==> (?S. S SUBSET (E UNION E') /\ segment_end S a b)` SUBAGOAL_TAC;
38378 FULL_REWRITE_TAC[conn];
38379 UND 10 THEN DISCH_THEN (THM_INTRO_TAC[`a'`;`u'`]);
38381 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`u'`;`b'`]);
38383 THM_INTRO_TAC[`S`;`S'`;`a'`;`u'`;`b'`] segment_end_trans;
38384 TYPE_THEN `U` EXISTS_TAC;
38385 IMATCH_MP_TAC SUBSET_TRANS;
38386 TYPE_THEN `S UNION S'` EXISTS_TAC;
38387 IMATCH_MP_TAC subset_union_pair;
38389 TYPE_THEN `cls E a /\ cls E b` ASM_CASES_TAC;
38390 USE 2 (REWRITE_RULE[conn]);
38391 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[`a`;`b`]);
38392 TYPE_THEN `S` EXISTS_TAC;
38393 UND 10 THEN REWRITE_TAC[SUBSET;UNION];
38395 TYPE_THEN `cls E' a /\ cls E' b` ASM_CASES_TAC;
38396 USE 1 (REWRITE_RULE[conn]);
38397 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`a`;`b`]);
38398 TYPE_THEN `S` EXISTS_TAC;
38399 UND 11 THEN REWRITE_TAC[SUBSET;UNION];
38401 TYPE_THEN `cls E a /\ cls E' b` ASM_CASES_TAC;
38404 UND 7 THEN DISCH_THEN (THM_INTRO_TAC[`E`;`E'`;`a`;`b`;`u`]);
38406 TYPE_THEN `cls E' a /\ cls E b` ASM_CASES_TAC;
38409 UND 7 THEN DISCH_THEN (THM_INTRO_TAC[`E'`;`E`;`a`;`b`;`u`]);
38410 TYPE_THEN `S` EXISTS_TAC;
38411 UND 13 THEN REWRITE_TAC[SUBSET;UNION];
38417 let cls_empty = prove_by_refinement(
38418 `cls EMPTY = EMPTY `,
38421 IMATCH_MP_TAC EQ_EXT;
38426 let finite_cls = prove_by_refinement(
38427 `!E. FINITE E ==> (E SUBSET edge ==> FINITE (cls E))`,
38430 IMATCH_MP_TAC FINITE_INDUCT_STRONG;
38431 REWRITE_TAC[cls_empty;FINITE_RULES ];
38432 IMATCH_MP_TAC FINITE_SUBSET;
38433 TYPE_THEN `cls (E UNION {x})` EXISTS_TAC;
38435 REWRITE_TAC[cls_union;FINITE_UNION;];
38437 TYPE_THEN `edge x /\ E SUBSET edge` SUBAGOAL_TAC;
38438 FULL_REWRITE_TAC[INSERT;SUBSET];
38440 REWRITE_TAC[cls_edge];
38441 USE 5 (MATCH_MP two_endpoint);
38442 FULL_REWRITE_TAC[HAS_SIZE];
38444 IMATCH_MP_TAC cls_subset;
38445 REWRITE_TAC[INSERT;SUBSET;INR IN_SING;UNION ];
38449 let infinite_int = prove_by_refinement(
38450 `INFINITE (UNIV:int->bool)`,
38453 IMATCH_MP_TAC infinite_subset;
38454 TYPE_THEN `IMAGE (&:) UNIV` EXISTS_TAC;
38455 THM_INTRO_TAC[`(&:)`] INFINITE_IMAGE_INJ;
38456 ASM_MESON_TAC[INT_OF_NUM_EQ];
38457 TSPEC `UNIV:num->bool` 0;
38458 FIRST_ASSUM IMATCH_MP_TAC ;
38459 REWRITE_TAC[num_INFINITE];
38463 let infinite_intpair = prove_by_refinement(
38464 `INFINITE (UNIV:int#int->bool)`,
38467 IMATCH_MP_TAC infinite_subset;
38468 TYPE_THEN `IMAGE (\ (i:int) . (i,&:0)) UNIV` EXISTS_TAC;
38469 THM_INTRO_TAC[`(\ (i:int) . (i,&:0))`] INFINITE_IMAGE_INJ;
38470 FULL_REWRITE_TAC[PAIR_SPLIT];
38471 FIRST_ASSUM IMATCH_MP_TAC ;
38472 REWRITE_TAC[infinite_int];
38476 let not_cls_exists = prove_by_refinement(
38477 `!E. ?c. (FINITE E /\ E SUBSET edge) ==> ~cls E c`,
38482 THM_INTRO_TAC[`E`] finite_cls;
38483 FULL_REWRITE_TAC[cls];
38484 TYPE_THEN `INFINITE (UNIV DIFF {m | ?e. E e /\ closure top2 e (pointI m)})` SUBAGOAL_TAC;
38485 IMATCH_MP_TAC INFINITE_DIFF_FINITE;
38486 REWRITE_TAC[infinite_intpair];
38488 USE 3 (MATCH_MP INFINITE_NONEMPTY);
38489 USE 3 (REWRITE_RULE[EMPTY_EXISTS;DIFF]);
38494 let conn2_imp_conn = prove_by_refinement(
38495 `!E. (E SUBSET edge ) /\ conn2 E ==> conn E`,
38498 REWRITE_TAC[conn;conn2];
38499 THM_INTRO_TAC[`E`] finite_cls;
38500 THM_INTRO_TAC[`E`] not_cls_exists;
38501 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[]);
38502 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`a`;`b`;`c`]);
38508 let has_size1 = prove_by_refinement(
38509 `!(X:A -> bool). X HAS_SIZE 1 <=> SING X`,
38513 IMATCH_MP_TAC EQ_ANTISYM;
38514 ASM_REWRITE_TAC[CARD_SING_CONV];
38515 FULL_REWRITE_TAC[SING];
38516 REWRITE_TAC[sing_has_size1];
38520 let card_gt_3 = prove_by_refinement(
38521 `!(X:A->bool). FINITE X ==> ( 3 <= CARD X <=>
38522 (?a b c. X a /\ X b /\ X c /\ ~(a = b) /\ ~(a = c) /\ ~( b = c)))`,
38525 FULL_REWRITE_TAC[ARITH_RULE `(3 <= x) <=> ~(x = 0) /\ ~(x = 1) /\ ~(x = 2)`];
38526 IMATCH_MP_TAC EQ_ANTISYM;
38528 TYPE_THEN `~(X HAS_SIZE 0)` SUBAGOAL_TAC;
38529 ASM_MESON_TAC[HAS_SIZE];
38530 FULL_REWRITE_TAC[HAS_SIZE_0 ;EMPTY_EXISTS ];
38531 TYPE_THEN `~(X HAS_SIZE 1) /\ ~(X HAS_SIZE 2)` SUBAGOAL_TAC;
38532 ASM_MESON_TAC[HAS_SIZE];
38533 FULL_REWRITE_TAC[has_size1 ;SING;has_size2;INR eq_sing ];
38534 TYPE_THEN `?v. (X v /\ ~(v = u))` SUBAGOAL_TAC;
38536 TYPE_THEN `u` EXISTS_TAC;
38537 TYPE_THEN `v` EXISTS_TAC;
38542 USE 5 (REWRITE_RULE[DE_MORGAN_THM]);
38544 USE 5 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
38546 FULL_REWRITE_TAC[INR in_pair];
38547 TYPE_THEN `x` EXISTS_TAC;
38550 TYPE_THEN `~(X HAS_SIZE 0) /\ ~(X HAS_SIZE 1) /\ ~(X HAS_SIZE 2) ==> ~(CARD X = 0) /\ ~(CARD X = 1) /\ ~(CARD X = 2)` SUBAGOAL_TAC;
38551 FULL_REWRITE_TAC[HAS_SIZE];
38553 FIRST_ASSUM IMATCH_MP_TAC ;
38555 REWRITE_TAC[HAS_SIZE_0;has_size1;SING;EMPTY_EXISTS ];
38557 TYPE_THEN `a` EXISTS_TAC;
38559 TYPE_THEN `X` UNABBREV_TAC;
38560 FULL_REWRITE_TAC[INR IN_SING];
38562 THM_INTRO_TAC[`X`;`a`;`b`;`c`] two_exclusion;
38567 let card_has_subset = prove_by_refinement(
38568 `!(A:A->bool) n. FINITE A /\ (n <= CARD A) ==>
38569 (?B. B SUBSET A /\ (B HAS_SIZE n))`,
38573 TYPE_THEN `A HAS_SIZE CARD A` SUBAGOAL_TAC;
38574 REWRITE_TAC[HAS_SIZE];
38575 FULL_REWRITE_TAC[has_size_bij];
38576 TYPE_THEN `IMAGE f {m | m <| n}` EXISTS_TAC;
38578 FULL_REWRITE_TAC[IMAGE;SUBSET;BIJ;SURJ];
38579 FIRST_ASSUM IMATCH_MP_TAC ;
38580 UND 3 THEN UND 0 THEN ARITH_TAC;
38581 TYPE_THEN `f` EXISTS_TAC;
38582 IMATCH_MP_TAC inj_bij;
38583 FULL_REWRITE_TAC[INJ;BIJ;];
38584 FIRST_ASSUM IMATCH_MP_TAC ;
38585 UND 3 THEN UND 4 THEN UND 0 THEN ARITH_TAC;
38589 let cls_edge_size2 = prove_by_refinement(
38590 `!e. (edge e) ==> (cls {e} HAS_SIZE 2)`,
38593 REWRITE_TAC[cls_edge];
38594 IMATCH_MP_TAC two_endpoint;
38598 let conn2_cls3 = prove_by_refinement(
38599 `!E. (E SUBSET edge) /\ conn2 E ==> (3 <= CARD (cls E))`,
38603 THM_INTRO_TAC[`E`] finite_cls;
38604 FULL_REWRITE_TAC[conn2];
38605 ASM_SIMP_TAC[card_gt_3];
38606 FULL_REWRITE_TAC[conn2];
38607 THM_INTRO_TAC[`E`;`2`] card_has_subset;
38608 FULL_REWRITE_TAC[has_size2];
38609 TYPE_THEN `B` UNABBREV_TAC;
38610 USE 6(REWRITE_RULE[SUBSET;INR in_pair]);
38611 TYPE_THEN `E b` SUBAGOAL_TAC ;
38612 FIRST_ASSUM IMATCH_MP_TAC ;
38613 TYPE_THEN `E a` SUBAGOAL_TAC;
38614 FIRST_ASSUM IMATCH_MP_TAC ;
38616 USE 2(REWRITE_RULE[SUBSET]);
38617 TYPE_THEN `edge a /\ edge b` SUBAGOAL_TAC;
38619 TYPE_THEN `cls {a} HAS_SIZE 2 /\ cls {b} HAS_SIZE 2` SUBAGOAL_TAC;
38620 ASM_MESON_TAC[cls_edge_size2];
38621 FULL_REWRITE_TAC[has_size2];
38624 TYPE_THEN `cls {a} SUBSET cls E` SUBAGOAL_TAC;
38625 IMATCH_MP_TAC cls_subset;
38626 REWRITE_TAC[SUBSET;INR IN_SING];
38627 TYPE_THEN `cls {b} SUBSET cls E` SUBAGOAL_TAC;
38628 IMATCH_MP_TAC cls_subset;
38629 REWRITE_TAC[SUBSET;INR IN_SING];
38631 TYPE_THEN `cls E a' /\ cls E b' /\ cls E a'' /\ cls E b''` SUBAGOAL_TAC;
38636 FULL_REWRITE_TAC[SUBSET;INR in_pair];
38639 TYPE_THEN `a'` EXISTS_TAC;
38640 TYPE_THEN `b'` EXISTS_TAC;
38642 TYPE_THEN `~(cls {a} = cls {b})` SUBAGOAL_TAC;
38643 THM_INTRO_TAC[`a`;`b`] cls_inj;
38646 TYPE_THEN `cls {b} a''` ASM_CASES_TAC;
38648 FULL_REWRITE_TAC[INR in_pair ];
38649 TYPE_THEN `b''` EXISTS_TAC;
38651 TYPE_THEN `b''` UNABBREV_TAC;
38652 FIRST_ASSUM DISJ_CASES_TAC;
38653 TYPE_THEN `a''` UNABBREV_TAC;
38654 TYPE_THEN `cls {b}` UNABBREV_TAC;
38655 TYPE_THEN `cls {a}` UNABBREV_TAC;
38656 UND 21 THEN REWRITE_TAC[];
38657 IMATCH_MP_TAC EQ_EXT;
38658 REWRITE_TAC[INSERT];
38660 TYPE_THEN `a''` UNABBREV_TAC;
38662 TYPE_THEN `b''` UNABBREV_TAC;
38663 FIRST_ASSUM DISJ_CASES_TAC ;
38664 TYPE_THEN `a''` UNABBREV_TAC;
38665 TYPE_THEN `a''` UNABBREV_TAC;
38666 TYPE_THEN `cls {b}` UNABBREV_TAC;
38667 TYPE_THEN `cls {a}` UNABBREV_TAC;
38669 TYPE_THEN `a''` EXISTS_TAC;
38671 FULL_REWRITE_TAC[INR in_pair];
38672 UND 22 THEN MESON_TAC[];
38676 let has_size2_subset_ne = prove_by_refinement(
38677 `!X (a:A) b. X HAS_SIZE 2 /\ {a,b} SUBSET X /\ ~(a = b) ==>
38682 ONCE_REWRITE_TAC [EQ_SYM_EQ];
38683 IMATCH_MP_TAC CARD_SUBSET_EQ;
38684 THM_INTRO_TAC[`a`;`b`] pair_size_2;
38686 FULL_REWRITE_TAC[HAS_SIZE];
38690 let segment_end_sing = prove_by_refinement(
38691 `!a b e. closure top2 e (pointI a) /\ closure top2 e (pointI b) /\
38692 ~(a = b) /\ (edge e) ==> segment_end {e} a b`,
38695 REWRITE_TAC[segment_end];
38697 IMATCH_MP_TAC psegment_edge;
38699 IMATCH_MP_TAC has_size2_subset_ne;
38701 IMATCH_MP_TAC endpoint_size2;
38702 IMATCH_MP_TAC psegment_edge;
38704 REWRITE_TAC[endpoint;SUBSET];
38705 FULL_REWRITE_TAC[INR in_pair];
38706 THM_INTRO_TAC[`{e}`;`pointI x`] num_closure1;
38707 REWRITE_TAC[FINITE_SING];
38709 TYPE_THEN `e` EXISTS_TAC;
38710 REWRITE_TAC[INR IN_SING];
38715 let conn2_no1 = prove_by_refinement(
38716 `!E. (E SUBSET edge) /\ conn2 E ==>
38717 (!m. ~(num_closure E (pointI m) = 1))`,
38721 TYPE_THEN `FINITE E` SUBAGOAL_TAC ;
38722 FULL_REWRITE_TAC[conn2];
38723 TYPE_THEN `?e. E e /\ closure top2 e (pointI m)` SUBAGOAL_TAC;
38724 THM_INTRO_TAC[`E`;`pointI m`] num_closure1;
38727 THM_INTRO_TAC[`e`] cls_edge_size2;
38728 ASM_MESON_TAC[ISUBSET];
38729 TYPE_THEN `?n. closure top2 e (pointI n) /\ ~(n = m)` SUBAGOAL_TAC;
38730 FULL_REWRITE_TAC[has_size2];
38732 TYPE_THEN `cls {e} m` SUBAGOAL_TAC;
38733 REWRITE_TAC[cls;INR IN_SING ];
38737 FULL_REWRITE_TAC[INR in_pair];
38738 FIRST_ASSUM DISJ_CASES_TAC ;
38739 TYPE_THEN `a` EXISTS_TAC;
38740 TYPE_THEN `cls{e} a` SUBAGOAL_TAC;
38741 REWRITE_TAC[INSERT];
38742 FULL_REWRITE_TAC[cls;INR IN_SING ];
38744 TYPE_THEN `b` EXISTS_TAC;
38745 TYPE_THEN `cls{e} b` SUBAGOAL_TAC;
38746 FULL_REWRITE_TAC[INR in_pair;cls; INR IN_SING];
38747 FULL_REWRITE_TAC[cls;INR IN_SING];
38749 TYPE_THEN `edge e` SUBAGOAL_TAC;
38750 FULL_REWRITE_TAC[SUBSET];
38752 TYPE_THEN`?c. cls E c /\ ~(c = m) /\ ~(c = n)` SUBAGOAL_TAC;
38753 THM_INTRO_TAC[`E`] conn2_cls3;
38754 THM_INTRO_TAC[`E`] finite_cls;
38755 THM_INTRO_TAC[`cls E`] card_gt_3;
38757 TYPE_THEN `~(a = m) /\ ~(a = n)` ASM_CASES_TAC;
38758 TYPE_THEN `a` EXISTS_TAC;
38759 TYPE_THEN `~(b = m) /\ ~(b = n)` ASM_CASES_TAC;
38760 TYPE_THEN `b` EXISTS_TAC;
38761 TYPE_THEN `~(c = m) /\ ~(c = n)` ASM_CASES_TAC;
38762 TYPE_THEN `c` EXISTS_TAC;
38763 FULL_REWRITE_TAC[DE_MORGAN_THM];
38766 FULL_REWRITE_TAC[conn2];
38767 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`m`;`c`;`n`]);
38771 TYPE_THEN `cls {e} n` SUBAGOAL_TAC;
38772 REWRITE_TAC[cls;INR IN_SING ];
38775 TYPE_THEN `~S e` SUBAGOAL_TAC;
38776 TYPE_THEN `cls {e} SUBSET cls S` SUBAGOAL_TAC;
38777 IMATCH_MP_TAC cls_subset;
38778 REWRITE_TAC[SUBSET;INR IN_SING];
38779 FULL_REWRITE_TAC[SUBSET];
38782 THM_INTRO_TAC[`S`;`m`] terminal_endpoint;
38783 FULL_REWRITE_TAC[segment_end];
38784 FULL_REWRITE_TAC[psegment;segment;INR in_pair];
38785 THM_INTRO_TAC[`E`;`pointI m`] num_closure1;
38789 TYPE_THEN `e = e'` SUBAGOAL_TAC;
38791 TYPE_THEN `e'` UNABBREV_TAC;
38792 TSPEC `(terminal_edge S m)` 22;
38795 TYPE_THEN `E (terminal_edge S m)` SUBAGOAL_TAC;
38796 FULL_REWRITE_TAC[ISUBSET];
38798 TYPE_THEN `e` UNABBREV_TAC;
38803 let conn2_union = prove_by_refinement(
38804 `!A B. (A SUBSET edge) /\ (B SUBSET edge) /\ (conn2 A) /\ (conn2 B) /\
38805 (?a b. ~(a = b) /\ ({a,b} SUBSET (cls A INTER cls B))) ==>
38806 (conn2 (A UNION B))`,
38810 REWRITE_TAC[conn2];
38811 TYPE_THEN `FINITE A /\ FINITE B` SUBAGOAL_TAC;
38812 FULL_REWRITE_TAC[conn2];
38814 REWRITE_TAC[FINITE_UNION];
38817 IMATCH_MP_TAC LE_TRANS;
38818 TYPE_THEN `CARD A` EXISTS_TAC;
38819 FULL_REWRITE_TAC[conn2];
38820 IMATCH_MP_TAC CARD_SUBSET;
38821 REWRITE_TAC[SUBSET;UNION];
38823 TYPE_THEN `cls A a' /\ cls A b'` ASM_CASES_TAC;
38824 FULL_REWRITE_TAC[conn2];
38825 UND 18 THEN DISCH_THEN (THM_INTRO_TAC[`a'`;`b'`;`c`]);
38826 TYPE_THEN`S` EXISTS_TAC;
38827 UND 22 THEN REWRITE_TAC[SUBSET;UNION];
38829 TYPE_THEN `cls B a' /\ cls B b'` ASM_CASES_TAC;
38830 FULL_REWRITE_TAC[conn2];
38831 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[`a'`;`b'`;`c`]);
38832 TYPE_THEN`S` EXISTS_TAC;
38833 UND 23 THEN REWRITE_TAC[SUBSET;UNION];
38835 TYPE_THEN `?d. cls A d /\ cls B d /\ ~(c = d)` SUBAGOAL_TAC;
38836 TYPE_THEN `c = a` ASM_CASES_TAC;
38837 TYPE_THEN `c` UNABBREV_TAC;
38838 TYPE_THEN `b` EXISTS_TAC;
38839 FULL_REWRITE_TAC[SUBSET;INTER;INR in_pair];
38841 TYPE_THEN `a` EXISTS_TAC;
38842 FULL_REWRITE_TAC[SUBSET;INTER;INR in_pair];
38845 TYPE_THEN `!m n. cls A m /\ ~cls B m /\ ~cls A n /\ cls B n /\ ~(m = n) /\ ~(m = c) /\ ~(n = c) ==> (?S. S SUBSET A UNION B /\ segment_end S m n /\ ~cls S c)` SUBAGOAL_TAC;
38846 FULL_REWRITE_TAC[conn2];
38847 UND 28 THEN DISCH_THEN (THM_INTRO_TAC[`m`;`d`;`c`]);
38849 TYPE_THEN `m` UNABBREV_TAC;
38851 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[`d`;`n`;`c`]);
38853 THM_INTRO_TAC[`S`;`S'`;`m`;`d`;`n`] segment_end_trans;
38854 TYPE_THEN `U` EXISTS_TAC;
38856 IMATCH_MP_TAC SUBSET_TRANS;
38857 TYPE_THEN `S UNION S'` EXISTS_TAC ;
38858 IMATCH_MP_TAC subset_union_pair;
38859 TYPE_THEN `cls U SUBSET cls (S UNION S')` SUBAGOAL_TAC;
38860 IMATCH_MP_TAC cls_subset;
38861 FULL_REWRITE_TAC[cls_union ];
38862 FULL_REWRITE_TAC[ISUBSET];
38864 USE 37 (REWRITE_RULE[UNION]);
38867 FULL_REWRITE_TAC[DE_MORGAN_THM];
38868 FULL_REWRITE_TAC[cls_union ];
38869 USE 12(REWRITE_RULE[UNION]);
38870 USE 13 (REWRITE_RULE[UNION]);
38871 FIRST_ASSUM DISJ_CASES_TAC;
38875 UND 20 THEN DISCH_THEN (THM_INTRO_TAC[`a'`;`b'`]);
38880 UND 20 THEN DISCH_THEN (THM_INTRO_TAC[`b'`;`a'`]);
38881 TYPE_THEN `S` EXISTS_TAC;
38882 ONCE_REWRITE_TAC[segment_end_symm];
38886 let cut_rectagon_cls = prove_by_refinement(
38887 `!E m n. rectagon E /\ ~(m = n) /\ cls E m /\ cls E n ==>
38888 (?A B. segment_end A m n /\ segment_end B m n /\
38889 (E = A UNION B) /\ (A INTER B = EMPTY) /\
38890 (cls A INTER cls B = {m,n}))`,
38893 REWRITE_TAC[segment_end;cls;];
38894 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
38895 FULL_REWRITE_TAC[rectagon;segment;psegment];
38896 THM_INTRO_TAC[`E`;`m`;`n`] cut_rectagon;
38898 IMATCH_MP_TAC num_closure_pos;
38900 IMATCH_MP_TAC num_closure_pos;
38902 TYPE_THEN `A` EXISTS_TAC;
38903 TYPE_THEN `B` EXISTS_TAC;
38905 IMATCH_MP_TAC EQ_EXT;
38906 REWRITE_TAC[INTER;INR in_pair];
38907 IMATCH_MP_TAC EQ_ANTISYM;
38909 IMATCH_MP_TAC (TAUT `a \/ b ==> b \/ a`);
38910 FIRST_ASSUM IMATCH_MP_TAC ;
38912 IMATCH_MP_TAC num_closure_pos;
38913 ASM_MESON_TAC[psegment;segment];
38914 IMATCH_MP_TAC num_closure_pos;
38915 ASM_MESON_TAC[psegment;segment];
38917 TYPE_THEN `FINITE A` SUBAGOAL_TAC;
38918 IMATCH_MP_TAC FINITE_SUBSET;
38919 TYPE_THEN `E` EXISTS_TAC;
38920 REWRITE_TAC[SUBSET;UNION];
38921 TYPE_THEN `FINITE B` SUBAGOAL_TAC;
38922 IMATCH_MP_TAC FINITE_SUBSET;
38923 TYPE_THEN `E` EXISTS_TAC;
38924 REWRITE_TAC[SUBSET;UNION];
38926 TYPE_THEN `endpoint A m /\ endpoint A n /\ endpoint B m /\ endpoint B n` SUBAGOAL_TAC;
38927 REWRITE_TAC[INR in_pair];
38929 FIRST_ASSUM DISJ_CASES_TAC;
38931 TYPE_THEN `terminal_edge A n` EXISTS_TAC;
38932 IMATCH_MP_TAC terminal_endpoint;
38933 TYPE_THEN `terminal_edge B n` EXISTS_TAC;
38934 IMATCH_MP_TAC terminal_endpoint;
38936 TYPE_THEN `terminal_edge A m` EXISTS_TAC;
38937 IMATCH_MP_TAC terminal_endpoint;
38938 TYPE_THEN `terminal_edge B m` EXISTS_TAC;
38939 IMATCH_MP_TAC terminal_endpoint;
38943 let conn2_rectagon = prove_by_refinement(
38944 `!E. rectagon E ==> conn2 E`,
38947 FULL_REWRITE_TAC[conn2];
38949 FULL_REWRITE_TAC[rectagon];
38951 THM_INTRO_TAC[`E`] rectagon_h_edge;
38952 THM_INTRO_TAC[`E`] rectagon_v_edge;
38953 TYPE_THEN `~(h_edge m = v_edge m')` SUBAGOAL_TAC;
38954 ASM_MESON_TAC[hv_edgeV2];
38955 TYPE_THEN `CARD {(h_edge m),(v_edge m')} <= CARD E` SUBAGOAL_TAC;
38956 IMATCH_MP_TAC CARD_SUBSET;
38957 REWRITE_TAC[SUBSET;INR in_pair];
38959 TYPE_THEN `{(h_edge m),(v_edge m')} HAS_SIZE 2` SUBAGOAL_TAC;
38960 IMATCH_MP_TAC pair_size_2;
38962 FULL_REWRITE_TAC[HAS_SIZE];
38965 THM_INTRO_TAC[`E`;`a`;`b`] cut_rectagon_cls;
38966 TYPE_THEN `~cls A c` ASM_CASES_TAC;
38967 TYPE_THEN `A` EXISTS_TAC;
38968 REWRITE_TAC[SUBSET;UNION];
38971 TYPE_THEN `~cls B c ` SUBAGOAL_TAC;
38972 USE 8 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
38974 FULL_REWRITE_TAC[INTER;INR in_pair];
38977 TYPE_THEN `B` EXISTS_TAC;
38978 REWRITE_TAC[SUBSET;UNION];
38982 let rectangle_grid = jordan_def
38983 `rectangle_grid p q = { e |
38984 (?m. (e = h_edge m) /\ FST p <= FST m /\ (FST m +: &:1 <=: FST q) /\
38985 SND p <= SND m /\ SND m <=: SND q) \/
38986 (?m. (e = v_edge m) /\ FST p <= FST m /\ FST m <= FST q /\
38987 SND p <= SND m /\ SND m +: &:1 <=: SND q) }`;;
38989 let rectangle_grid_h = prove_by_refinement(
38990 `!p q m. rectangle_grid p q (h_edge m) <=>
38991 (FST p <=: FST m) /\ (FST m +: &:1 <=: FST q) /\
38992 (SND p <=: SND m) /\ (SND m <=: SND q)`,
38995 REWRITE_TAC[rectangle_grid];
38996 REWRITE_TAC[cell_clauses;];
39001 let rectangle_grid_v = prove_by_refinement(
39002 `!p q m. rectangle_grid p q (v_edge m) <=>
39003 (FST p <= FST m /\ FST m <= FST q /\
39004 SND p <= SND m /\ SND m +: &:1 <=: SND q)`,
39007 REWRITE_TAC[rectangle_grid];
39008 REWRITE_TAC[cell_clauses;];
39013 let rectangle_grid_edge = prove_by_refinement(
39014 `!p q. rectangle_grid p q SUBSET edge`,
39017 REWRITE_TAC[SUBSET;rectangle_grid;edge];
39022 let rectangle_grid_sq = prove_by_refinement(
39023 `!p. (rectangle_grid p (FST p +: &:1, SND p +: &:1)) =
39024 {(h_edge p), (h_edge (up p)), (v_edge p), (v_edge (right p))}`,
39028 TYPE_THEN `E = rectangle_grid p (FST p +: &:1, SND p +: &:1)` ABBREV_TAC ;
39029 IMATCH_MP_TAC EQ_EXT;
39030 REWRITE_TAC[INSERT];
39031 IMATCH_MP_TAC EQ_ANTISYM;
39033 TYPE_THEN `edge x` SUBAGOAL_TAC;
39034 TYPE_THEN `E` UNABBREV_TAC;
39035 ASM_MESON_TAC[rectangle_grid_edge;ISUBSET];
39037 FULL_REWRITE_TAC[edge];
39038 FIRST_ASSUM DISJ_CASES_TAC ;
39039 TYPE_THEN `x` UNABBREV_TAC;
39040 TYPE_THEN `E` UNABBREV_TAC;
39041 FULL_REWRITE_TAC[rectangle_grid_v;PAIR_SPLIT];
39042 REWRITE_TAC[cell_clauses];
39043 REWRITE_TAC[PAIR_SPLIT;right ];
39044 UND 0 THEN UND 1 THEN UND 3 THEN UND 4 THEN INT_ARITH_TAC;
39045 TYPE_THEN `x` UNABBREV_TAC;
39046 TYPE_THEN `E` UNABBREV_TAC;
39047 FULL_REWRITE_TAC[rectangle_grid_h;PAIR_SPLIT];
39048 REWRITE_TAC[cell_clauses];
39049 REWRITE_TAC[PAIR_SPLIT;up ];
39050 UND 0 THEN UND 1 THEN UND 3 THEN UND 4 THEN INT_ARITH_TAC;
39052 TYPE_THEN `E` UNABBREV_TAC;
39053 UND 1 THEN REP_CASES_TAC THEN ASM_REWRITE_TAC[rectangle_grid_v;rectangle_grid_h;up;right ;] THEN INT_ARITH_TAC;
39057 let rectangle_grid_sq_cls = prove_by_refinement(
39058 `!p. cls (rectangle_grid p (FST p +: &:1, SND p +: &:1)) =
39059 {(p),(right p),(up p), (up (right p))}`,
39064 IMATCH_MP_TAC EQ_EXT;
39065 REWRITE_TAC[rectangle_grid_sq];
39066 REWRITE_TAC[INSERT];
39067 IMATCH_MP_TAC EQ_ANTISYM;
39070 FULL_REWRITE_TAC[right ;up;];
39071 UND 1 THEN REP_CASES_TAC THEN (TYPE_THEN `e` UNABBREV_TAC) THEN FULL_REWRITE_TAC[v_edge_closure;h_edge_closure;vc_edge;hc_edge;UNION;INR IN_SING;plus_e12;pointI_inj;cell_clauses;] THEN ASM_MESON_TAC[];
39073 FULL_REWRITE_TAC[right ;up;];
39074 TYPE_THEN `closure top2 (h_edge p) (pointI x) \/ closure top2 (h_edge (FST p,SND p +: &:1)) (pointI x)` SUBAGOAL_TAC;
39075 UND 0 THEN REP_CASES_TAC THEN (TYPE_THEN`x` UNABBREV_TAC) THEN FULL_REWRITE_TAC[v_edge_closure;h_edge_closure;vc_edge;hc_edge;UNION;INR IN_SING;plus_e12;pointI_inj;cell_clauses;];
39076 FIRST_ASSUM DISJ_CASES_TAC;
39083 let segment_end_union_rectagon = prove_by_refinement(
39084 `!A B m p. segment_end A m p /\ segment_end B m p /\
39085 (A INTER B = EMPTY) /\ (cls A INTER cls B = {m,p}) ==>
39086 (rectagon (A UNION B))`,
39090 THM_INTRO_TAC[`A`;`m`;`p`] segment_end_disj;
39091 IMATCH_MP_TAC segment_union2;
39092 TYPE_THEN `m` EXISTS_TAC;
39093 TYPE_THEN `p` EXISTS_TAC;
39094 FULL_REWRITE_TAC[segment_end;INR in_pair];
39095 REWRITE_TAC[INR in_pair];
39096 FULL_REWRITE_TAC[psegment];
39099 IMATCH_MP_TAC EQ_ANTISYM;
39101 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
39103 USE 0 (REWRITE_RULE[INR in_pair;INTER;cls]);
39104 IMATCH_MP_TAC (TAUT `a \/ b ==> b \/ a`);
39107 USE 10 (MATCH_MP num_closure_elt);
39109 USE 9 (MATCH_MP num_closure_elt);
39112 TYPE_THEN `FINITE A` SUBAGOAL_TAC;
39113 FULL_REWRITE_TAC[segment];
39114 TYPE_THEN `FINITE B` SUBAGOAL_TAC;
39115 FULL_REWRITE_TAC[segment];
39116 TYPE_THEN `endpoint B m /\ endpoint B p /\ endpoint A m /\ endpoint A p` SUBAGOAL_TAC;
39117 REWRITE_TAC[INR in_pair];
39119 IMATCH_MP_TAC num_closure_pos;
39120 FIRST_ASSUM DISJ_CASES_TAC;
39121 THM_INTRO_TAC[`A`;`m`] terminal_endpoint;
39123 THM_INTRO_TAC[`A`;`p`] terminal_endpoint;
39125 IMATCH_MP_TAC num_closure_pos;
39126 FIRST_ASSUM DISJ_CASES_TAC;
39127 THM_INTRO_TAC[`B`;`m`] terminal_endpoint;
39129 THM_INTRO_TAC[`B`;`p`] terminal_endpoint;
39134 let cls_h = prove_by_refinement(
39135 `!m. (cls {(h_edge m)} = {m, (right m)})`,
39139 IMATCH_MP_TAC EQ_EXT;
39140 REWRITE_TAC[INR in_pair;INR IN_SING;];
39141 CONV_TAC (dropq_conv "e");
39142 REWRITE_TAC[edge_h;edge_v;v_edge_closure;h_edge_closure;right ;up; vc_edge;hc_edge;UNION;plus_e12; INR IN_SING; PAIR_SPLIT;cell_clauses;];
39147 let cls_v = prove_by_refinement(
39148 `!m. (cls {(v_edge m)} = {m, (up m)})`,
39152 IMATCH_MP_TAC EQ_EXT;
39153 REWRITE_TAC[INR in_pair;INR IN_SING;];
39154 CONV_TAC (dropq_conv "e");
39155 REWRITE_TAC[edge_h;edge_v;v_edge_closure;h_edge_closure;right ;up; vc_edge;hc_edge;UNION;plus_e12; INR IN_SING; PAIR_SPLIT;cell_clauses;];
39160 let rectagon_rectangle_grid_sq = prove_by_refinement(
39161 `!p. rectagon ((rectangle_grid p (FST p +: &:1, SND p +: &:1)))`,
39165 TYPE_THEN `E = rectagon (rectangle_grid p (FST p +: &:1,SND p +: &:1))` ABBREV_TAC ;
39166 TYPE_THEN `segment_end {(h_edge p)} p (right p) /\ segment_end {(v_edge p)} p (up p) /\ segment_end { (h_edge (up p)) } (up p) (right (up p)) /\ segment_end {(v_edge (right p))} (right p) (right (up p))` SUBAGOAL_TAC;
39167 (REPEAT CONJ_TAC) THEN IMATCH_MP_TAC segment_end_sing THEN REWRITE_TAC[edge_h;edge_v;v_edge_closure;h_edge_closure;right ;up; vc_edge;hc_edge; UNION ;plus_e12; INR IN_SING; PAIR_SPLIT ] THEN INT_ARITH_TAC ;
39169 THM_INTRO_TAC[`{(h_edge p)}`;`{(v_edge (right p))}`;`p`;`right p`;`right (up p)`] segment_end_union;
39170 THM_INTRO_TAC[`p`] cls_h;
39171 THM_INTRO_TAC[`right p`] cls_v;
39172 IMATCH_MP_TAC EQ_EXT;
39173 REWRITE_TAC[INTER;INR IN_SING;];
39174 REWRITE_TAC[INR in_pair;right ;up; PAIR_SPLIT ];
39177 THM_INTRO_TAC[`{(v_edge p)}`;`{(h_edge (up p))}`;`p`;`up p`;`right (up p)`] segment_end_union;
39178 THM_INTRO_TAC[`p`] cls_v;
39179 THM_INTRO_TAC[`up p`] cls_h;
39180 IMATCH_MP_TAC EQ_EXT;
39181 REWRITE_TAC[INTER;INR IN_SING;];
39182 REWRITE_TAC[INR in_pair;right ;up; PAIR_SPLIT ];
39185 THM_INTRO_TAC[`{(v_edge p)} UNION {(h_edge (up p))}`;`{(h_edge p)} UNION {(v_edge (right p))}`;`p`;`right (up p)`] segment_end_union_rectagon;
39187 PROOF_BY_CONTR_TAC;
39188 FULL_REWRITE_TAC[EMPTY_EXISTS];
39189 USE 7(REWRITE_RULE[INTER;UNION;INR IN_SING]);
39190 FIRST_ASSUM DISJ_CASES_TAC;
39191 TYPE_THEN `u` UNABBREV_TAC;
39192 FULL_REWRITE_TAC[cell_clauses;up;PAIR_SPLIT ];
39193 UND 8 THEN INT_ARITH_TAC;
39194 TYPE_THEN `u` UNABBREV_TAC;
39195 FULL_REWRITE_TAC[cell_clauses;up; right ;PAIR_SPLIT ];
39196 UND 8 THEN INT_ARITH_TAC;
39197 REWRITE_TAC[cls_h;cls_v;cls_union];
39198 IMATCH_MP_TAC EQ_EXT;
39199 REWRITE_TAC[up; right ; INTER; UNION;];
39200 REWRITE_TAC[INR in_pair];
39201 REWRITE_TAC[PAIR_SPLIT];
39202 TYPE_THEN `FST x = FST p` ASM_CASES_TAC;
39203 REWRITE_TAC[INT_ARITH `~(FST p = FST p +: &:1)`];
39207 TYPE_THEN `E` UNABBREV_TAC;
39208 REWRITE_TAC[rectangle_grid_sq];
39209 TYPE_THEN `{(h_edge p), (h_edge (up p)), (v_edge p),( v_edge (right p))} = (({(v_edge p)} UNION {(h_edge (up p))}) UNION {(h_edge p)} UNION {(v_edge (right p))})` SUBAGOAL_TAC;
39210 IMATCH_MP_TAC EQ_EXT;
39211 REWRITE_TAC[UNION];
39212 REWRITE_TAC[INR IN_SING];
39213 REWRITE_TAC[INSERT];
39219 let conn2_union_edge = prove_by_refinement(
39220 `!A B. A SUBSET edge /\ B SUBSET edge /\ conn2 A /\ conn2 B /\
39221 (~(A INTER B = EMPTY)) ==> conn2 (A UNION B)`,
39225 IMATCH_MP_TAC conn2_union;
39226 USE 0 (REWRITE_RULE [EMPTY_EXISTS;INTER;]);
39227 TYPE_THEN `edge u` SUBAGOAL_TAC;
39228 ASM_MESON_TAC[ISUBSET];
39229 USE 6 (MATCH_MP cls_edge_size2);
39230 FULL_REWRITE_TAC[has_size2];
39231 TYPE_THEN `a` EXISTS_TAC;
39232 TYPE_THEN `b` EXISTS_TAC;
39234 REWRITE_TAC[SUBSET_INTER];
39236 IMATCH_MP_TAC cls_subset;
39237 ASM_REWRITE_TAC[SUBSET;INR IN_SING];
39238 IMATCH_MP_TAC cls_subset;
39239 ASM_REWRITE_TAC[SUBSET;INR IN_SING];
39243 let rectangle_grid_h_conn2 = prove_by_refinement(
39244 `!n p. conn2 (rectangle_grid p (FST p +: &:(SUC n), SND p +: &:1))`,
39248 REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] ;
39249 IMATCH_MP_TAC conn2_rectagon;
39250 REWRITE_TAC[rectagon_rectangle_grid_sq];
39252 TYPE_THEN `rectangle_grid p (FST p +: &:(SUC (SUC n)),SND p +: &:1) = rectangle_grid p (FST p +: &:(SUC n),SND p +: &:1) UNION rectangle_grid (FST p +: &:(SUC n),SND p) (FST p +: &:(SUC (SUC n)),SND p +: &:1)` SUBAGOAL_TAC;
39253 IMATCH_MP_TAC EQ_EXT;
39254 REWRITE_TAC[UNION];
39256 IMATCH_MP_TAC EQ_ANTISYM;
39258 TYPE_THEN `edge x` SUBAGOAL_TAC;
39259 ASM_MESON_TAC[rectangle_grid_edge;ISUBSET];
39260 FULL_REWRITE_TAC [edge];
39261 FIRST_ASSUM DISJ_CASES_TAC;
39262 TYPE_THEN `x` UNABBREV_TAC;
39263 FULL_REWRITE_TAC[rectangle_grid_v];
39264 UND 4 THEN UND 5 THEN INT_ARITH_TAC;
39265 TYPE_THEN `x` UNABBREV_TAC;
39266 FULL_REWRITE_TAC[rectangle_grid_h];
39267 UND 4 THEN UND 5 THEN INT_ARITH_TAC;
39269 TYPE_THEN `edge x` SUBAGOAL_TAC;
39270 ASM_MESON_TAC[rectangle_grid_edge;ISUBSET];
39271 FULL_REWRITE_TAC [edge];
39272 FIRST_ASSUM DISJ_CASES_TAC;
39273 TYPE_THEN `x` UNABBREV_TAC;
39274 FULL_REWRITE_TAC[rectangle_grid_v];
39275 FIRST_ASSUM DISJ_CASES_TAC;
39276 FULL_REWRITE_TAC[GSYM INT_OF_NUM_SUC];
39277 UND 5 THEN INT_ARITH_TAC;
39278 TYPE_THEN `(FST p +: (&:0)*((FST m - (FST p + &:(SUC n))) + (&:(SUC n))) <= FST m)` SUBAGOAL_TAC;
39281 TYPE_THEN `x` UNABBREV_TAC;
39282 FULL_REWRITE_TAC[rectangle_grid_h];
39283 FIRST_ASSUM DISJ_CASES_TAC;
39284 FULL_REWRITE_TAC[GSYM INT_OF_NUM_SUC];
39285 UND 5 THEN INT_ARITH_TAC;
39286 TYPE_THEN `(FST p +: (&:0)*((FST m - (FST p + &:(SUC n))) + (&:(SUC n))) <= FST m)` SUBAGOAL_TAC;
39290 IMATCH_MP_TAC conn2_union_edge;
39291 REWRITE_TAC[rectangle_grid_edge];
39293 IMATCH_MP_TAC conn2_rectagon;
39294 THM_INTRO_TAC[`FST p +: &:(SUC n),SND p`] rectagon_rectangle_grid_sq;
39295 TYPE_THEN `(FST p +: &:(SUC (SUC n)),SND p +: &:1) = (FST (FST p +: &:(SUC n),SND p) +: &:1, SND (FST p +: &:(SUC n),SND p) +: &:1)` SUBAGOAL_TAC;
39296 REWRITE_TAC[PAIR_SPLIT;GSYM INT_OF_NUM_SUC];
39299 UND 2 THEN REWRITE_TAC[EMPTY_EXISTS;INTER;];
39300 TYPE_THEN `v_edge (FST p +: &:(SUC n),SND p)` EXISTS_TAC;
39301 REWRITE_TAC[rectangle_grid_v];
39302 REPEAT CONJ_TAC THEN (TRY INT_ARITH_TAC);
39303 TYPE_THEN `FST p + (&:0)*(&:(SUC n)) <=: FST p + &: (SUC n)` SUBAGOAL_TAC;
39306 REWRITE_TAC[GSYM INT_OF_NUM_SUC];
39311 let rectangle_grid_conn2 = prove_by_refinement(
39313 (rectangle_grid p (FST p +: &:(SUC n),SND p +: &:(SUC m)))`,
39317 REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] ;
39318 REWRITE_TAC[rectangle_grid_h_conn2];
39320 TYPE_THEN `rectangle_grid p (FST p +: &:(SUC n),SND p +: &:(SUC (SUC m))) = rectangle_grid p (FST p +: &:(SUC n),SND p +: &:(SUC m)) UNION rectangle_grid (FST p ,SND p + &:(SUC m)) (FST p +: &:(SUC n),SND p +: &:(SUC (SUC m)))` SUBAGOAL_TAC;
39321 IMATCH_MP_TAC EQ_EXT;
39322 REWRITE_TAC[UNION];
39324 IMATCH_MP_TAC EQ_ANTISYM;
39326 TYPE_THEN `edge x` SUBAGOAL_TAC;
39327 ASM_MESON_TAC[rectangle_grid_edge;ISUBSET];
39328 FULL_REWRITE_TAC [edge];
39329 FIRST_ASSUM DISJ_CASES_TAC;
39330 TYPE_THEN `x` UNABBREV_TAC;
39331 FULL_REWRITE_TAC[rectangle_grid_v];
39332 UND 1 THEN UND 3 THEN INT_ARITH_TAC;
39333 TYPE_THEN `x` UNABBREV_TAC;
39334 FULL_REWRITE_TAC[rectangle_grid_h];
39335 UND 1 THEN UND 3 THEN INT_ARITH_TAC;
39337 TYPE_THEN `edge x` SUBAGOAL_TAC;
39338 ASM_MESON_TAC[rectangle_grid_edge;ISUBSET];
39339 FULL_REWRITE_TAC [edge];
39340 FIRST_ASSUM DISJ_CASES_TAC;
39341 TYPE_THEN `x` UNABBREV_TAC;
39342 FULL_REWRITE_TAC[rectangle_grid_v];
39343 FIRST_ASSUM DISJ_CASES_TAC;
39344 FULL_REWRITE_TAC[GSYM INT_OF_NUM_SUC];
39345 UND 3 THEN INT_ARITH_TAC;
39346 TYPE_THEN `(SND p +: (&:0)*((SND m' - (SND p + &:(SUC m))) + (&:(SUC m))) <= SND m')` SUBAGOAL_TAC;
39350 TYPE_THEN `x` UNABBREV_TAC;
39351 FULL_REWRITE_TAC[rectangle_grid_h];
39352 FIRST_ASSUM DISJ_CASES_TAC;
39353 FULL_REWRITE_TAC[GSYM INT_OF_NUM_SUC];
39354 UND 3 THEN INT_ARITH_TAC;
39355 TYPE_THEN `(SND p +: (&:0)*((SND m' - (SND p + &:(SUC m))) + (&:(SUC m))) <= SND m')` SUBAGOAL_TAC;
39359 IMATCH_MP_TAC conn2_union_edge;
39360 REWRITE_TAC[rectangle_grid_edge];
39362 THM_INTRO_TAC[`n`;`(FST p,SND p +: &:(SUC m))` ] rectangle_grid_h_conn2;
39363 TYPE_THEN `(FST p +: &:(SUC n),SND p +: &:(SUC (SUC m))) = (FST (FST p,SND p +: &:(SUC m)) +: &:(SUC n), SND (FST p,SND p +: &:(SUC m)) +: &:1)` SUBAGOAL_TAC;
39364 REWRITE_TAC[GSYM INT_OF_NUM_SUC;PAIR_SPLIT ];
39368 UND 2 THEN REWRITE_TAC[EMPTY_EXISTS;INTER;];
39369 TYPE_THEN `h_edge (FST p ,SND p + &:(SUC m))` EXISTS_TAC;
39370 REWRITE_TAC[rectangle_grid_h];
39371 REPEAT CONJ_TAC THEN (TRY (IMATCH_MP_TAC INT_LE_LADD_IMP)) THEN (REWRITE_TAC[INT_OF_NUM_LE;INT_LE_ADDR ]) THEN (TRY INT_ARITH_TAC) THEN (TRY ARITH_TAC);
39375 let conn2_has_rectagon = prove_by_refinement(
39376 `!E. (E SUBSET edge) /\ (conn2 E) ==> (?B. (B SUBSET E) /\ rectagon B)`,
39380 TYPE_THEN `?e. E e` SUBAGOAL_TAC;
39381 FULL_REWRITE_TAC[conn2];
39382 THM_INTRO_TAC[`E`;`1`] card_has_subset;
39383 UND 2 THEN ARITH_TAC;
39384 FULL_REWRITE_TAC[has_size1;SING ];
39385 TYPE_THEN `B` UNABBREV_TAC;
39386 FULL_REWRITE_TAC[SUBSET;INR IN_SING];
39389 TYPE_THEN `edge e` SUBAGOAL_TAC;
39390 ASM_MESON_TAC[ISUBSET];
39391 USE 3 (MATCH_MP cls_edge_size2);
39392 FULL_REWRITE_TAC[has_size2];
39394 TYPE_THEN `2 <=| num_closure E (pointI a)` SUBAGOAL_TAC;
39395 IMATCH_MP_TAC (ARITH_RULE `~(x = 0) /\ ~(x = 1) ==> 2 <= x`);
39397 THM_INTRO_TAC[`E`;`pointI a`] num_closure0;
39398 FULL_REWRITE_TAC[conn2];
39400 TYPE_THEN `cls {e} a` SUBAGOAL_TAC;
39401 REWRITE_TAC[INR in_pair];
39402 FULL_REWRITE_TAC[cls;INR IN_SING ];
39404 ASM_MESON_TAC[conn2_no1];
39405 FULL_REWRITE_TAC[num_closure];
39406 THM_INTRO_TAC[`{C | E C /\ closure top2 C (pointI a)}`;`2`] card_has_subset;
39407 IMATCH_MP_TAC FINITE_SUBSET;
39408 TYPE_THEN `E` EXISTS_TAC;
39409 FULL_REWRITE_TAC[conn2];
39410 REWRITE_TAC[SUBSET];
39411 FULL_REWRITE_TAC[has_size2];
39412 TYPE_THEN `B` UNABBREV_TAC;
39413 USE 7(REWRITE_RULE[SUBSET;INR in_pair ]);
39415 TYPE_THEN `?e' . (E e' /\ closure top2 e' (pointI a) /\ ~(e = e'))` SUBAGOAL_TAC;
39416 TYPE_THEN `e = a'` ASM_CASES_TAC;
39417 TYPE_THEN `b'` EXISTS_TAC;
39418 TYPE_THEN `a'` UNABBREV_TAC;
39421 TYPE_THEN `a'` EXISTS_TAC;
39424 TYPE_THEN`?c. (cls {e'} = {a,c}) /\ ~(c = a) ` SUBAGOAL_TAC;
39425 TYPE_THEN `edge e'` SUBAGOAL_TAC;
39426 ASM_MESON_TAC[ISUBSET];
39427 USE 11 (MATCH_MP cls_edge_size2);
39428 FULL_REWRITE_TAC[has_size2];
39430 TYPE_THEN `cls{e'} a` SUBAGOAL_TAC;
39431 REWRITE_TAC[cls;INR IN_SING ];
39433 TYPE_THEN `cls {e'}` UNABBREV_TAC;
39434 FULL_REWRITE_TAC[INR in_pair];
39435 FIRST_ASSUM DISJ_CASES_TAC;
39436 TYPE_THEN `b''` UNABBREV_TAC;
39437 TYPE_THEN `a''` EXISTS_TAC;
39438 IMATCH_MP_TAC EQ_EXT;
39439 REWRITE_TAC[INR in_pair];
39441 TYPE_THEN `a''` UNABBREV_TAC;
39442 TYPE_THEN `b''` EXISTS_TAC;
39445 TYPE_THEN `~(c = b)` SUBAGOAL_TAC;
39446 TYPE_THEN`c` UNABBREV_TAC;
39447 TYPE_THEN `cls{e} = cls{e'}` SUBAGOAL_TAC;
39448 ASM_MESON_TAC[cls_inj;ISUBSET];
39450 TYPE_THEN `?S. S SUBSET E /\ segment_end S b c /\ ~cls S a` SUBAGOAL_TAC;
39451 FULL_REWRITE_TAC[conn2];
39452 FIRST_ASSUM IMATCH_MP_TAC ;
39453 TYPE_THEN `cls {e} b /\ cls {e'} c` SUBAGOAL_TAC;
39454 REWRITE_TAC[INR in_pair];
39457 TYPE_THEN `cls {e} SUBSET cls E /\ cls {e'} SUBSET cls E` SUBAGOAL_TAC;
39458 CONJ_TAC THEN IMATCH_MP_TAC cls_subset THEN REWRITE_TAC[SUBSET;INR IN_SING];
39459 ASM_MESON_TAC[ISUBSET];
39461 THM_INTRO_TAC[`b`;`a`;`e`] segment_end_sing;
39462 TYPE_THEN `cls {e} a /\ cls {e} b` SUBAGOAL_TAC;
39463 REWRITE_TAC[INR in_pair];
39464 FULL_REWRITE_TAC[cls;INR IN_SING ];
39465 ASM_MESON_TAC[ISUBSET];
39466 THM_INTRO_TAC[`a`;`c`;`e'`] segment_end_sing;
39467 TYPE_THEN `cls {e'} a /\ cls {e'} c` SUBAGOAL_TAC;
39468 REWRITE_TAC[INR in_pair];
39469 FULL_REWRITE_TAC[cls;INR IN_SING ];
39470 ASM_MESON_TAC[ISUBSET];
39472 THM_INTRO_TAC[`{e}`;`{e'}`;`b`;`a`;`c`] segment_end_union;
39473 IMATCH_MP_TAC EQ_EXT;
39474 REWRITE_TAC[INTER;INR in_pair;INR IN_SING];
39477 THM_INTRO_TAC[`S`;`{e} UNION {e'}`;`b`;`c`] segment_end_union_rectagon;
39478 REWRITE_TAC[cls_union; UNION_OVER_INTER; EMPTY_UNION; ];
39480 REWRITE_TAC[EQ_EMPTY;INTER ;INR IN_SING ];
39482 TYPE_THEN `x` UNABBREV_TAC;
39484 TYPE_THEN `cls {e} SUBSET cls S` SUBAGOAL_TAC;
39485 IMATCH_MP_TAC cls_subset;
39486 ASM_MESON_TAC[ISUBSET;INR IN_SING];
39487 USE 20 (REWRITE_RULE[SUBSET]);
39489 TYPE_THEN `cls {e}` UNABBREV_TAC;
39490 FULL_REWRITE_TAC[INR in_pair];
39493 TYPE_THEN `cls {e'} SUBSET cls S` SUBAGOAL_TAC;
39494 IMATCH_MP_TAC cls_subset;
39495 ASM_MESON_TAC[ISUBSET;INR IN_SING];
39496 USE 22 (REWRITE_RULE[SUBSET]);
39498 TYPE_THEN `cls {e'}` UNABBREV_TAC;
39499 FULL_REWRITE_TAC[INR in_pair];
39502 REWRITE_TAC[GSYM UNION_OVER_INTER];
39503 IMATCH_MP_TAC SUBSET_ANTISYM;
39505 REWRITE_TAC[INTER;UNION;SUBSET;INR in_pair];
39506 TYPE_THEN `((x = c) \/ (x = b)) \/ (x = a)` SUBAGOAL_TAC;
39508 FIRST_ASSUM DISJ_CASES_TAC;
39511 REWRITE_TAC[INTER;UNION;SUBSET;INR in_pair];
39512 TYPE_THEN `cls S b /\ cls S c` SUBAGOAL_TAC;
39513 ASM_MESON_TAC[segment_end_cls2;segment_end_cls];
39515 TYPE_THEN `(S UNION {e} UNION {e'})` EXISTS_TAC;
39516 REWRITE_TAC[union_subset];
39517 REWRITE_TAC[SUBSET;INR IN_SING];
39521 (* ------------------------------------------------------------------ *)
39523 (* ------------------------------------------------------------------ *)
39526 (* 1.0.6 rectagon components *)
39528 (* redo some results from E that USE the segment hypothesis *)
39530 let curve_cell_h_ver2 = prove_by_refinement(
39531 `!G n. (curve_cell G (h_edge n) = G (h_edge n))`,
39536 REWRITE_TAC[curve_cell;UNION ; eq_sing;INR IN_SING; h_edge_pointI];
39541 let curve_cell_v_ver2 = prove_by_refinement(
39542 `!G n. (curve_cell G (v_edge n) = G (v_edge n))`,
39546 REWRITE_TAC[curve_cell;UNION ; eq_sing;INR IN_SING; v_edge_pointI];
39550 let curve_closure_ver2 = prove_by_refinement(
39551 `!G. (FINITE G) /\ (G SUBSET edge) ==>
39552 (closure top2 (UNIONS G) = (UNIONS (curve_cell G)))`,
39556 ASSUME_TAC top2_top;
39557 IMATCH_MP_TAC SUBSET_ANTISYM;
39559 ASM_SIMP_TAC[closure_unions];
39560 REWRITE_TAC[IMAGE;INR IN_UNIONS;SUBSET ];
39561 TYPE_THEN `edge x'` SUBGOAL_TAC;
39562 ASM_MESON_TAC[ISUBSET];
39563 FULL_REWRITE_TAC [edge];
39564 FIRST_ASSUM DISJ_CASES_TAC;
39565 TYPE_THEN `x'` UNABBREV_TAC;
39566 TYPE_THEN `t` UNABBREV_TAC;
39567 FULL_REWRITE_TAC [v_edge_closure;vc_edge;UNION ;INR IN_SING ];
39568 UND 3 THEN REP_CASES_TAC;
39569 TYPE_THEN `v_edge m` EXISTS_TAC;
39570 ASM_SIMP_TAC [curve_cell_v_ver2];
39571 TYPE_THEN `{(pointI m)}` EXISTS_TAC;
39573 ASM_SIMP_TAC [curve_cell_point];
39574 REWRITE_TAC[INR IN_SING];
39576 REWRITE_TAC [v_edge_closure;vc_edge;UNION;plus_e12;INR IN_SING ];
39577 TYPE_THEN `{(pointI (FST m,SND m +: &:1))}` EXISTS_TAC;
39578 ASM_SIMP_TAC [curve_cell_point];
39579 REWRITE_TAC[INR IN_SING;plus_e12];
39580 TYPE_THEN `v_edge m` EXISTS_TAC;
39581 REWRITE_TAC [v_edge_closure;vc_edge;UNION;plus_e12;INR IN_SING ];
39582 (* dt2 , down to 2 goals *)
39583 TYPE_THEN `x'` UNABBREV_TAC;
39584 TYPE_THEN `t` UNABBREV_TAC;
39585 FULL_REWRITE_TAC [h_edge_closure;hc_edge;UNION;INR IN_SING];
39586 UND 3 THEN REP_CASES_TAC;
39587 TYPE_THEN `h_edge m` EXISTS_TAC;
39588 ASM_SIMP_TAC[curve_cell_h_ver2];
39589 TYPE_THEN `{(pointI m)}` EXISTS_TAC;
39590 ASM_SIMP_TAC[curve_cell_point ;INR IN_SING ];
39591 TYPE_THEN `h_edge m` EXISTS_TAC;
39592 FULL_REWRITE_TAC [h_edge_closure;hc_edge;UNION;INR IN_SING];
39593 TYPE_THEN `{x}` EXISTS_TAC;
39594 ASM_REWRITE_TAC[INR IN_SING];
39595 ASM_SIMP_TAC[curve_cell_point ;INR IN_SING;plus_e12 ];
39596 TYPE_THEN `h_edge m` EXISTS_TAC;
39597 FULL_REWRITE_TAC [h_edge_closure;hc_edge;UNION;INR IN_SING;plus_e12];
39599 REWRITE_TAC[curve_cell; UNIONS_UNION; union_subset];
39600 ASM_SIMP_TAC[closure_unions];
39602 REWRITE_TAC[SUBSET;IMAGE;UNIONS];
39604 CONV_TAC (dropq_conv "u");
39606 TYPE_THEN `u` EXISTS_TAC;
39607 ASM_MESON_TAC[subset_closure;ISUBSET ];
39609 TYPE_THEN `A = UNIONS (IMAGE (closure top2) G)` ABBREV_TAC ;
39610 REWRITE_TAC[UNIONS;SUBSET ];
39611 TYPE_THEN `u` UNABBREV_TAC;
39612 FULL_REWRITE_TAC [INR IN_SING];
39617 let curve_cell_h_inter_ver2 = prove_by_refinement(
39618 `!G m. (FINITE G) /\ (G SUBSET edge) ==>
39619 (((h_edge m) INTER (UNIONS (curve_cell G)) = {}) <=>
39620 (~(G (h_edge m))))`,
39624 ONCE_REWRITE_TAC [GSYM curve_cell_h_ver2];
39625 IMATCH_MP_TAC cell_inter;
39626 ASM_REWRITE_TAC [cell_rules;curve_cell_cell];
39627 ASM_MESON_TAC[segment;curve_cell_cell];
39631 let curve_cell_v_inter_ver2 = prove_by_refinement(
39632 `!G m. (FINITE G) /\ (G SUBSET edge) ==>
39633 (((v_edge m) INTER (UNIONS (curve_cell G)) = {}) <=>
39634 (~(G (v_edge m))))`,
39638 ONCE_REWRITE_TAC [GSYM curve_cell_v_ver2];
39639 IMATCH_MP_TAC cell_inter;
39640 ASM_REWRITE_TAC [cell_rules;curve_cell_cell];
39641 ASM_MESON_TAC[segment;curve_cell_cell];
39645 let curve_cell_squ_ver2 = prove_by_refinement(
39646 `!G m. (FINITE G) /\ (G SUBSET edge) ==> ~curve_cell G (squ m)`,
39649 REWRITE_TAC[curve_cell;UNION ;eq_sing;square_pointI; segment];
39650 FULL_REWRITE_TAC [SUBSET; edge];
39652 USE 0(REWRITE_RULE[square_v_edgeV2;square_h_edgeV2;cell_clauses]);
39656 let curve_cell_squ_inter_ver2 = prove_by_refinement(
39657 `!G m. (FINITE G) /\ (G SUBSET edge) ==>
39658 (((squ m) INTER (UNIONS (curve_cell G)) = {}))`,
39662 TYPE_THEN `cell (squ m)` SUBGOAL_TAC;
39663 REWRITE_TAC[cell_rules];
39664 TYPE_THEN `(curve_cell G SUBSET cell)` SUBGOAL_TAC;
39665 ASM_MESON_TAC[curve_cell_cell;segment];
39666 ASM_SIMP_TAC [cell_inter];
39667 ASM_MESON_TAC [curve_cell_squ_ver2];
39671 let curve_point_unions_ver2 = prove_by_refinement(
39672 `!G m. (FINITE G) /\ (G SUBSET edge) ==>
39673 (UNIONS (curve_cell G) (pointI m) = curve_cell G {(pointI m)})`,
39677 TYPE_THEN `UNIONS (curve_cell G) (pointI m) <=> ~({(pointI m)} INTER (UNIONS (curve_cell G)) = EMPTY )` SUBGOAL_TAC;
39678 REWRITE_TAC[REWRITE_RULE[not_eq] single_inter];
39679 REWRITE_TAC [not_eq];
39680 IMATCH_MP_TAC cell_inter;
39681 ASM_MESON_TAC[cell_rules;curve_cell_cell];
39685 let curve_cell_not_point_ver2 = prove_by_refinement(
39686 `!G m. (FINITE G) /\ (G SUBSET edge) ==> ((curve_cell G {(pointI m)} <=>
39687 ~(num_closure G (pointI m) = 0)))`,
39691 ASM_SIMP_TAC[curve_cell_point;num_closure0];
39696 let curve_closed_ver2 = prove_by_refinement(
39697 `!G. (FINITE G) /\ (G SUBSET edge) ==>
39698 (closed_ top2 (UNIONS (curve_cell G)))`,
39702 ASM_SIMP_TAC[GSYM curve_closure_ver2];
39703 IMATCH_MP_TAC closure_closed;
39704 REWRITE_TAC[top2_top];
39705 IMATCH_MP_TAC UNIONS_SUBSET;
39706 FULL_REWRITE_TAC [SUBSET;top2_unions;edge; ];
39707 ASM_MESON_TAC[REWRITE_RULE[SUBSET] h_edge_euclid;REWRITE_RULE[SUBSET] v_edge_euclid];
39711 let ctop_top2_ver2 = prove_by_refinement(
39712 `!G A. (FINITE G) /\ (G SUBSET edge) /\ ctop G A ==> top2 A`,
39715 REWRITE_TAC[ctop;induced_top;IMAGE ;];
39716 TYPE_THEN `U = top_of_metric(euclid 2,d_euclid)` ABBREV_TAC ;
39717 TYPE_THEN `euclid 2 = UNIONS U` SUBGOAL_TAC;
39718 TYPE_THEN `U` UNABBREV_TAC;
39719 ASM_MESON_TAC[top_of_metric_unions;metric_euclid];
39720 IMATCH_MP_TAC top_inter;
39721 ASM_REWRITE_TAC[top2_top;];
39722 ASM_SIMP_TAC[GSYM curve_closure_ver2;top2];
39723 IMATCH_MP_TAC (REWRITE_RULE[open_DEF] closed_open);
39724 IMATCH_MP_TAC closure_closed;
39726 TYPE_THEN `U` UNABBREV_TAC;
39727 ASM_MESON_TAC[top_of_metric_top;metric_euclid];
39730 IMATCH_MP_TAC UNIONS_SUBSET;
39731 FULL_REWRITE_TAC [edge;ISUBSET;];
39734 FIRST_ASSUM DISJ_CASES_TAC;
39735 ASM_MESON_TAC[ (REWRITE_RULE[ISUBSET;] v_edge_euclid)];
39736 ASM_MESON_TAC [(REWRITE_RULE[ISUBSET;] h_edge_euclid)];
39740 let convex_connected_ver2 = prove_by_refinement(
39741 `!G Z. (FINITE G) /\ (G SUBSET edge) /\ convex Z /\
39742 (Z SUBSET (UNIONS (ctop G))) ==>
39743 (connected (ctop G) Z)`,
39747 REWRITE_TAC[connected];
39751 PROOF_BY_CONTR_TAC;
39752 USE 8 (REWRITE_RULE[DE_MORGAN_THM;SUBSET ]);
39755 TYPE_THEN `Z x /\ Z x'` SUBGOAL_TAC;
39757 TYPE_THEN `mk_segment x x' SUBSET A UNION B` SUBGOAL_TAC;
39758 FULL_REWRITE_TAC [convex];
39759 ASM_MESON_TAC[ISUBSET];
39760 TYPE_THEN `connected (top_of_metric(euclid 2,d_euclid)) (mk_segment x x')` SUBGOAL_TAC;
39761 IMATCH_MP_TAC connected_mk_segment;
39762 USE 3(REWRITE_RULE[ctop_unions;SUBSET;DIFF;]);
39764 FULL_REWRITE_TAC [connected];
39765 TYPEL_THEN [`A`;`B`] (USE 13 o ISPECL);
39767 TYPE_THEN `top_of_metric (euclid 2,d_euclid) A /\ top_of_metric (euclid 2,d_euclid) B` SUBGOAL_TAC;
39768 REWRITE_TAC[GSYM top2];
39769 ASM_MESON_TAC[ctop_top2_ver2;top2];
39770 UND 13 THEN ASM_REWRITE_TAC[];
39771 FIRST_ASSUM DISJ_CASES_TAC;
39773 UND 9 THEN REWRITE_TAC[];
39774 UND 8 THEN ASM_REWRITE_TAC[];
39775 PROOF_BY_CONTR_TAC;
39776 ASM_MESON_TAC[mk_segment_end;ISUBSET];
39777 ASM_MESON_TAC [mk_segment_end;ISUBSET ];
39781 let convex_component_ver2 = prove_by_refinement(
39782 `!G Z x. (FINITE G) /\ (G SUBSET edge) /\ convex Z /\
39783 (Z SUBSET (UNIONS (ctop G))) /\
39784 (~(Z INTER (component (ctop G) x ) = EMPTY)) ==>
39785 (Z SUBSET (component (ctop G) x)) `,
39789 TYPE_THEN `connected (ctop G) Z` SUBGOAL_TAC;
39790 ASM_SIMP_TAC[convex_connected_ver2];
39791 USE 4(REWRITE_RULE[EMPTY_EXISTS;INTER ]);
39792 USE 4(MATCH_MP component_replace);
39793 IMATCH_MP_TAC connected_component;
39797 let unions_cell_of_ver2 = prove_by_refinement(
39798 `!G x. ((FINITE G) /\ (G SUBSET edge) ==>
39799 (UNIONS (cell_of (component (ctop G) x)) =
39800 component (ctop G) x))`,
39804 IMATCH_MP_TAC SUBSET_ANTISYM;
39805 REWRITE_TAC [UNIONS;SUBSET;cell_of];
39807 TYPE_THEN `(euclid 2 x')` SUBGOAL_TAC;
39808 UND 2 THEN REWRITE_TAC[component_DEF ;connected;SUBSET ;ctop_unions;DIFF ];
39809 USE 3 (MATCH_MP point_onto);
39810 TYPE_THEN `x'` UNABBREV_TAC;
39811 ASSUME_TAC cell_unions;
39813 USE 3 (REWRITE_RULE[UNIONS]);
39814 TYPE_THEN `u` EXISTS_TAC;
39817 TYPE_THEN `u SUBSET (component (ctop G) x)` SUBAGOAL_TAC;
39818 IMATCH_MP_TAC convex_component_ver2 ;
39819 ASM_REWRITE_TAC[EMPTY_EXISTS];
39821 ASM_MESON_TAC[cell_convex];
39823 REWRITE_TAC[ctop_unions];
39824 REWRITE_TAC[DIFF;SUBSET ];
39826 ASM_MESON_TAC[cell_euclid;ISUBSET];
39827 FULL_REWRITE_TAC[UNIONS];
39828 USE 1 (MATCH_MP curve_cell_cell);
39829 USE 1 (REWRITE_RULE[ISUBSET]);
39831 TYPE_THEN `u = u'` SUBGOAL_TAC;
39832 IMATCH_MP_TAC cell_partition;
39833 REWRITE_TAC[EMPTY_EXISTS;INTER];
39836 USE 2 (REWRITE_RULE[component_DEF;connected;SUBSET ]);
39837 TYPE_THEN `UNIONS (ctop G) (point p)` SUBGOAL_TAC;
39838 USE 12(REWRITE_RULE[ctop_unions;DIFF ;UNIONS ;DE_MORGAN_THM ]);
39840 TYPE_THEN `point p` EXISTS_TAC;
39841 ASM_REWRITE_TAC [INTER];
39843 FULL_REWRITE_TAC [ISUBSET];
39847 let unbounded = jordan_def `unbounded C <=>
39848 (?r. !s. (r <=. s) ==> C (point(s,&.0)))`;;
39850 let curve_cell_empty = prove_by_refinement(
39851 `curve_cell EMPTY = EMPTY `,
39854 REWRITE_TAC[curve_cell];
39855 REWRITE_TAC[EQ_EMPTY];
39856 THM_INTRO_TAC[`top2`] closure_empty;
39857 REWRITE_TAC[top2_top];
39862 let curve_cell_union = prove_by_refinement(
39863 `!A B. curve_cell (A UNION B) = curve_cell A UNION curve_cell B`,
39866 REWRITE_TAC[curve_cell];
39867 FULL_REWRITE_TAC[UNIONS_UNION;];
39868 ASM_SIMP_TAC[top2_top;closure_union];
39869 TYPE_THEN `{z | ?n. (z = {(pointI n)}) /\ (closure top2 (UNIONS A) UNION closure top2 (UNIONS B)) (pointI n)} = ( {z | ?n. (z = {(pointI n)}) /\ closure top2 (UNIONS A) (pointI n)}) UNION ({z | ?n. (z = {(pointI n)}) /\ closure top2 (UNIONS B) (pointI n)})` SUBAGOAL_TAC;
39870 IMATCH_MP_TAC EQ_EXT;
39871 REWRITE_TAC[UNION];
39873 TYPE_THEN `C = {z | ?n. (z = {(pointI n)}) /\ closure top2 (UNIONS A) (pointI n)}` ABBREV_TAC ;
39874 TYPE_THEN `D = {z | ?n. (z = {(pointI n)}) /\ closure top2 (UNIONS B) (pointI n)}` ABBREV_TAC ;
39875 REWRITE_TAC[UNION_ACI];
39879 let insert_sing = prove_by_refinement(
39880 `!A (x:A). x INSERT A = {x} UNION A`,
39884 IMATCH_MP_TAC EQ_EXT;
39885 REWRITE_TAC[INSERT;UNION;INR IN_SING];
39890 let curve_cell_sing = prove_by_refinement(
39891 `!e. (edge e) ==> (UNIONS (curve_cell {e}) = closure top2 e)`,
39895 REWRITE_TAC[curve_cell;UNIONS_UNION];
39896 FULL_REWRITE_TAC[edge];
39897 FIRST_ASSUM DISJ_CASES_TAC;
39898 REWRITE_TAC[v_edge_closure;vc_edge;plus_e12];
39899 IMATCH_MP_TAC EQ_EXT;
39900 REWRITE_TAC[UNION;UNIONS];
39901 CONV_TAC (dropq_conv "u");
39902 REWRITE_TAC[INR IN_SING;cell_clauses;pointI_inj];
39904 TYPE_THEN `v_edge m x` ASM_CASES_TAC;
39907 REWRITE_TAC[h_edge_closure;hc_edge;plus_e12];
39908 IMATCH_MP_TAC EQ_EXT;
39909 REWRITE_TAC[UNION;UNIONS];
39910 CONV_TAC (dropq_conv "u");
39911 REWRITE_TAC[INR IN_SING;cell_clauses;pointI_inj];
39913 TYPE_THEN `h_edge m x` ASM_CASES_TAC;
39918 let unbounded_elt = prove_by_refinement(
39919 `!G. (FINITE G) /\ (G SUBSET edge) ==>
39920 (?r. !x . (UNIONS (curve_cell G)) x ==> (x 0 <. r))`,
39923 TYPE_THEN `!G. (FINITE G) ==> ((G SUBSET edge) ==> (?r. !x . (UNIONS (curve_cell G)) x ==> (x 0 <. r)))` SUBAGOAL_TAC THENL[IMATCH_MP_TAC FINITE_INDUCT_STRONG ;ASM_MESON_TAC[]];
39926 REWRITE_TAC[curve_cell_empty];
39928 ASSUME_TAC top2_top;
39929 ONCE_REWRITE_TAC[insert_sing];
39930 REWRITE_TAC[curve_cell_union;UNIONS_UNION];
39931 REWRITE_TAC[UNION;];
39933 THM_INTRO_TAC[`x`] curve_cell_sing;
39934 FULL_REWRITE_TAC[INSERT;SUBSET];
39937 TYPE_THEN `G SUBSET edge` SUBAGOAL_TAC;
39938 FULL_REWRITE_TAC[ISUBSET;INSERT];
39942 TYPE_THEN `edge x` SUBAGOAL_TAC;
39943 FULL_REWRITE_TAC[INSERT;SUBSET;];
39945 TYPE_THEN `?r. !x'. closure top2 x x' ==> x' 0 < r` SUBAGOAL_TAC;
39946 USE 7(REWRITE_RULE[edge]);
39947 FIRST_ASSUM DISJ_CASES_TAC;
39948 REWRITE_TAC[v_edge_closure;vc_edge;UNION ;INR IN_SING;plus_e12 ];
39949 TYPE_THEN `real_of_int (FST m) + (&1)` EXISTS_TAC;
39950 FULL_REWRITE_TAC[pointI];
39951 UND 9 THEN REP_CASES_TAC THEN FULL_REWRITE_TAC[v_edge;coord01];
39952 FULL_REWRITE_TAC[v_edge;coord01];
39954 REWRITE_TAC[coord01];
39956 REWRITE_TAC[coord01;pointI];
39959 REWRITE_TAC[h_edge_closure;hc_edge;UNION ;INR IN_SING;plus_e12 ];
39960 TYPE_THEN `real_of_int (FST m) + (&2)` EXISTS_TAC;
39961 UND 9 THEN REP_CASES_TAC;
39962 FULL_REWRITE_TAC[h_edge;coord01];
39963 FULL_REWRITE_TAC[h_edge;coord01];
39964 FULL_REWRITE_TAC[int_add_th;int_of_num_th];
39965 UND 10 THEN REAL_ARITH_TAC;
39966 REWRITE_TAC[pointI];
39968 REWRITE_TAC[pointI];
39969 FULL_REWRITE_TAC[int_add_th;int_of_num_th];
39972 TYPE_THEN `max_real r r'` EXISTS_TAC;
39974 FIRST_ASSUM DISJ_CASES_TAC;
39975 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
39976 IMATCH_MP_TAC REAL_LTE_TRANS;
39977 TYPE_THEN `r'` EXISTS_TAC;
39978 ASM_REWRITE_TAC[max_real_le];
39979 IMATCH_MP_TAC REAL_LTE_TRANS;
39980 TYPE_THEN `r` EXISTS_TAC;
39981 REWRITE_TAC[max_real_le];
39985 let mk_segment_convex = prove_by_refinement(
39986 `!x y. convex (mk_segment x y)`,
39989 REWRITE_TAC[convex];
39990 FULL_REWRITE_TAC[mk_segment;SUBSET;];
39992 REWRITE_TAC[euclid_ldistrib];
39993 ONCE_REWRITE_TAC[euclid_plus_pair];
39994 REWRITE_TAC[euclid_scale_act];
39995 REWRITE_TAC[GSYM euclid_rdistrib];
39996 TYPE_THEN `(a * a'' + (&1 - a) * a')` EXISTS_TAC;
39998 ineq_le_tac `(&0) + (a * a'') + (&1 - a)* a' = (a * a'' + (&1 - a)*a')`;
40000 ineq_le_tac `(a * a'' + (&1 - a) * a') + ((&1 - a)*(&1 - a')) + a*(&1 - a'') = &1`;
40008 let mk_segment_h = prove_by_refinement(
40009 `!r s b x. (r <= s) ==> (mk_segment (point(r,b)) (point(s,b)) x <=> (?t. (r <= t /\ t <= s /\ (x = point(t,b)))))`,
40013 REWRITE_TAC[mk_segment];
40014 REWRITE_TAC[point_scale;point_add;GSYM REAL_RDISTRIB;REAL_ARITH `a + &1 - a = &1`;REAL_ARITH `&1 * b = b`];
40015 IMATCH_MP_TAC EQ_ANTISYM;
40017 TYPE_THEN `a * r + (&1 - a) *s` EXISTS_TAC;
40019 ineq_le_tac `r + (s - r)* (&1 - a) = a * r + (&1 - a)*s`;
40020 ineq_le_tac `(a * r + (&1 - a) * s) + (s - r)*a = s`;
40021 TYPE_THEN `s = r` ASM_CASES_TAC;
40022 REWRITE_TAC[point_inj;PAIR_SPLIT;GSYM REAL_RDISTRIB;REAL_ARITH `(a + &1 - a = &1) /\ (&1* a = a)`];
40023 TYPE_THEN `&0` EXISTS_TAC;
40024 UND 2 THEN UND 3 THEN UND 4 THEN REAL_ARITH_TAC;
40025 REWRITE_TAC[point_inj;PAIR_SPLIT];
40026 TYPE_THEN `v = &1/(s - r)` ABBREV_TAC ;
40027 TYPE_THEN `(s - r)*v = &1` SUBAGOAL_TAC;
40028 TYPE_THEN `v` UNABBREV_TAC;
40029 REWRITE_TAC[GSYM real_div_assoc];
40031 IMATCH_MP_TAC REAL_DIV_REFL;
40032 UND 5 THEN UND 4 THEN REAL_ARITH_TAC;
40033 TYPE_THEN `v*(s - t)` EXISTS_TAC;
40034 TYPE_THEN `&0 < v` SUBAGOAL_TAC;
40035 TYPE_THEN `v` UNABBREV_TAC;
40036 IMATCH_MP_TAC REAL_LT_DIV;
40037 UND 4 THEN UND 0 THEN REAL_ARITH_TAC;
40040 IMATCH_MP_TAC REAL_LE_MUL;
40041 UND 7 THEN UND 2 THEN REAL_ARITH_TAC;
40043 IMATCH_MP_TAC REAL_LE_LCANCEL_IMP;
40044 TYPE_THEN `(s - r)` EXISTS_TAC;
40046 UND 4 THEN UND 0 THEN REAL_ARITH_TAC;
40047 REWRITE_TAC[REAL_MUL_ASSOC];
40049 UND 3 THEN REAL_ARITH_TAC;
40050 TYPE_THEN `(v * (s - t)) * r + (&1 - v * (s - t)) * s = s + ((s - r)*v)*(t - s)` SUBAGOAL_TAC THENL [real_poly_tac;REDUCE_TAC];
40057 let unbounded_comp = prove_by_refinement(
40058 `!G. (FINITE G) /\ (G SUBSET edge) ==>
40059 (?x. unbounded (component (ctop G) x))` ,
40062 REWRITE_TAC[unbounded];
40063 THM_INTRO_TAC[`G`] unbounded_elt;
40064 TYPE_THEN `point(r, &0)` EXISTS_TAC;
40065 TYPE_THEN `r` EXISTS_TAC;
40066 TYPE_THEN `Z = mk_segment (point(r, &0)) (point(s, &0))` ABBREV_TAC ;
40067 THM_INTRO_TAC[`G`;`Z`;`(point(r, &0))`] convex_component_ver2;
40069 TYPE_THEN `Z` UNABBREV_TAC;
40070 REWRITE_TAC[mk_segment_convex];
40073 TYPE_THEN `Z` UNABBREV_TAC;
40074 REWRITE_TAC[ctop_unions];
40075 REWRITE_TAC[SUBSET;DIFF];
40076 THM_INTRO_TAC[`r`;`s`;`&0`;`x`] mk_segment_h;
40078 REWRITE_TAC[euclid_point];
40079 TSPEC `(point (t ,&0))` 2;
40080 FULL_REWRITE_TAC[coord01];
40081 UND 2 THEN UND 7 THEN REAL_ARITH_TAC;
40082 UND 5 THEN REWRITE_TAC[EMPTY_EXISTS];
40083 TYPE_THEN `(point(r,&0))` EXISTS_TAC;
40084 REWRITE_TAC[INTER];
40087 TYPE_THEN `Z` UNABBREV_TAC;
40088 THM_INTRO_TAC[`r`;`s`;`&0`;`point(r,&0)`] mk_segment_h;
40089 TYPE_THEN `r` EXISTS_TAC;
40090 UND 3 THEN REAL_ARITH_TAC;
40091 IMATCH_MP_TAC component_refl;
40092 REWRITE_TAC[ctop_unions];
40093 REWRITE_TAC[DIFF;euclid_point];
40094 TSPEC `(point(r,&0))` 2;
40095 FULL_REWRITE_TAC[coord01];
40096 UND 2 THEN REAL_ARITH_TAC;
40098 FULL_REWRITE_TAC[SUBSET];
40099 TSPEC `(point(s,&0))` 5;
40100 FIRST_ASSUM IMATCH_MP_TAC ;
40101 TYPE_THEN `Z` UNABBREV_TAC;
40102 REWRITE_TAC[mk_segment_end];
40106 let unbounded_comp_unique = prove_by_refinement(
40107 `!G x y. (FINITE G) /\ (G SUBSET edge) /\
40108 (unbounded (component (ctop G) x)) /\
40109 (unbounded(component (ctop G) y)) ==>
40110 (component (ctop G) x = component (ctop G) y) `,
40113 REWRITE_TAC[unbounded];
40114 TSPEC `max_real r r'` 0;
40115 TSPEC `max_real r r'` 1;
40116 FULL_REWRITE_TAC[max_real_le];
40117 ASM_MESON_TAC[component_replace];
40121 let unbounded_set = jordan_def
40122 `unbounded_set G x = unbounded(component (ctop G) x)`;;
40124 let bounded_set = jordan_def
40125 `bounded_set G x <=> ~(component (ctop G) x = EMPTY) /\
40126 ~(unbounded (component (ctop G) x))`;;
40128 let bounded_unbounded_disj = prove_by_refinement(
40129 `!G. bounded_set G INTER unbounded_set G = EMPTY `,
40133 REWRITE_TAC[EQ_EMPTY];
40134 FULL_REWRITE_TAC[INTER;bounded_set;unbounded_set];
40139 let bounded_unbounded_union = prove_by_refinement(
40140 `!G. bounded_set G UNION unbounded_set G = UNIONS (ctop G)`,
40144 IMATCH_MP_TAC EQ_EXT;
40145 REWRITE_TAC[UNION;bounded_set;unbounded_set];
40146 THM_INTRO_TAC[`G`] ctop_top;
40147 TYPE_THEN `component (ctop G) x = EMPTY` ASM_CASES_TAC;
40148 THM_INTRO_TAC[`ctop G`;`x`] component_empty;
40150 REWRITE_TAC[unbounded];
40152 UND 3 THEN REAL_ARITH_TAC;
40153 REWRITE_TAC[TAUT `~A \/ A`];
40154 ASM_MESON_TAC[component_empty];
40158 let bounded_subset_unions = prove_by_refinement(
40159 `!G x. (bounded_set G x ==> UNIONS (ctop G) x) `,
40163 REWRITE_TAC[GSYM bounded_unbounded_union;UNION];
40167 let unbounded_subset_unions = prove_by_refinement(
40168 `!G x. (unbounded_set G x ==> UNIONS (ctop G) x) `,
40172 REWRITE_TAC[GSYM bounded_unbounded_union;UNION];
40176 let unbounded_set_nonempty = prove_by_refinement(
40177 `!G. (FINITE G) /\ (G SUBSET edge) ==>
40178 ~(unbounded_set G = EMPTY)`,
40181 REWRITE_TAC[EMPTY_EXISTS];
40182 REWRITE_TAC[unbounded_set];
40183 THM_INTRO_TAC[`G`] unbounded_comp;
40187 let unbounded_set_comp = prove_by_refinement(
40188 `!G. (FINITE G) /\ (G SUBSET edge) ==>
40189 (?x. unbounded_set G = component (ctop G) x)`,
40193 THM_INTRO_TAC[`G`] unbounded_comp;
40194 TYPE_THEN `x` EXISTS_TAC;
40195 IMATCH_MP_TAC SUBSET_ANTISYM;
40197 PROOF_BY_CONTR_TAC;
40198 USE 3(REWRITE_RULE[SUBSET]);
40200 UND 3 THEN REWRITE_TAC[];
40201 THM_INTRO_TAC[`G`;`x`;`x'`] unbounded_comp_unique;
40202 FULL_REWRITE_TAC[unbounded_set];
40203 IMATCH_MP_TAC component_refl;
40204 FULL_REWRITE_TAC[unbounded_set];
40205 FULL_REWRITE_TAC[unbounded];
40207 FULL_REWRITE_TAC[ARITH_RULE `r <= r`];
40208 TYPE_THEN `~(component (ctop G) x' = EMPTY)` SUBAGOAL_TAC;
40209 FULL_REWRITE_TAC[EQ_EMPTY];
40211 THM_INTRO_TAC[`ctop G`;`x'`] component_empty;
40212 REWRITE_TAC[ctop_top];
40215 REWRITE_TAC[SUBSET];
40216 REWRITE_TAC[unbounded_set];
40217 TYPE_THEN `component (ctop G) x = component (ctop G) x'` SUBAGOAL_TAC;
40218 IMATCH_MP_TAC component_replace;
40223 let unbounded_set_comp_elt = prove_by_refinement(
40224 `!G x. (FINITE G) /\ (G SUBSET edge) /\
40225 (unbounded_set G = component (ctop G) x) ==>
40226 (unbounded_set G x)`,
40230 THM_INTRO_TAC[`G`]unbounded_set_nonempty;
40231 FULL_REWRITE_TAC[EMPTY_EXISTS];
40233 TYPE_THEN `~(component (ctop G) x = EMPTY)` SUBAGOAL_TAC;
40234 FULL_REWRITE_TAC[EQ_EMPTY ];
40236 ASSUME_TAC ctop_top;
40237 TYPE_THEN `(UNIONS (ctop G) x)` SUBAGOAL_TAC;
40238 PROOF_BY_CONTR_TAC;
40239 THM_INTRO_TAC[`ctop G`;`x`] component_empty;
40241 ASM_MESON_TAC[component_refl];
40245 let unbounded_even_subset = prove_by_refinement(
40246 `!G. rectagon G ==> (unbounded_set G SUBSET UNIONS (par_cell T G))`,
40250 TYPE_THEN `FINITE G /\ G SUBSET edge` SUBAGOAL_TAC;
40251 FULL_REWRITE_TAC[rectagon];
40252 THM_INTRO_TAC[`G`] unbounded_set_comp;
40253 THM_INTRO_TAC[`G`;`T`;`x`] par_cell_comp;
40254 FIRST_ASSUM DISJ_CASES_TAC;
40255 PROOF_BY_CONTR_TAC;
40258 THM_INTRO_TAC[`G`;`x`] unbounded_set_comp_elt;
40259 USE 4 (REWRITE_RULE[unbounded_set;unbounded]);
40260 THM_INTRO_TAC[`G`] unbounded_elt;
40261 TYPE_THEN `s = floor (max_real r r') + &:1` ABBREV_TAC ;
40262 TYPE_THEN `r < real_of_int s /\ r' < real_of_int s` SUBAGOAL_TAC;
40263 TYPE_THEN `s` UNABBREV_TAC;
40264 TYPE_THEN `!t u. t <= u ==> t <. real_of_int( floor u + &:1)` SUBAGOAL_TAC;
40265 REWRITE_TAC[int_add_th ; int_of_num_th];
40266 IMATCH_MP_TAC REAL_LET_TRANS;
40267 TYPE_THEN `u` EXISTS_TAC;
40268 REWRITE_TAC[floor_ineq];
40269 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN REWRITE_TAC[max_real_le] ;
40271 TYPE_THEN `~(UNIONS (curve_cell G) (pointI (s, &:0)))` SUBAGOAL_TAC;
40272 TSPEC `pointI (s, &:0)` 6;
40273 USE 6 (REWRITE_RULE[pointI;coord01]);
40274 UND 6 THEN UND 8 THEN REAL_ARITH_TAC;
40275 THM_INTRO_TAC[`G`] rectagon_segment;
40276 THM_INTRO_TAC[`G`;`(s,&:0)`] curve_point_unions;
40277 UND 12 THEN ASM_REWRITE_TAC[];
40278 PROOF_BY_CONTR_TAC;
40280 TYPE_THEN `par_cell T G {(pointI (s, &:0))}` SUBAGOAL_TAC;
40281 THM_INTRO_TAC[`G`;`(s, &:0)`;`T`] par_cell_point;
40283 ASM_MESON_TAC[curve_cell_not_point];
40284 REWRITE_TAC[num_lower];
40285 TYPE_THEN `{m | G (h_edge m) /\ (FST m = s) /\ SND m <=: &:0} = EMPTY` SUBAGOAL_TAC;
40286 PROOF_BY_CONTR_TAC;
40287 FULL_REWRITE_TAC[EMPTY_EXISTS];
40288 USE 6(REWRITE_RULE[UNIONS]);
40291 TSPEC `h_edge u` 6;
40292 THM_INTRO_TAC[`G`;`u`] curve_cell_h;
40294 USE 6(REWRITE_RULE[h_edge]);
40296 USE 6 (CONV_RULE (dropq_conv "x"));
40297 USE 6 (REWRITE_RULE[coord01]);
40298 USE 6 (CONV_RULE (dropq_conv "v"));
40299 TSPEC `real_of_int s + &1/ (&2)` 6;
40300 USE 6(REWRITE_RULE[int_add_th;int_of_num_th; REAL_LT_ADDR; REAL_LT_LADD; ]);
40301 UND 6 THEN DISCH_THEN (THM_INTRO_TAC[]);
40302 IMATCH_MP_TAC half_pos;
40303 TYPE_THEN `real_of_int s < r'` SUBAGOAL_TAC;
40304 IMATCH_MP_TAC REAL_LT_TRANS;
40305 TYPE_THEN `real_of_int s + &1 / &2` EXISTS_TAC;
40306 REWRITE_TAC[REAL_LT_ADDR; REAL_LT_HALF1];
40307 UND 18 THEN UND 8 THEN REAL_ARITH_TAC;
40308 REWRITE_TAC[CARD_CLAUSES;EVEN2];
40310 TYPE_THEN `UNIONS (par_cell F G) (pointI (s,&:0))` SUBAGOAL_TAC;
40311 USE 5 (REWRITE_RULE[SUBSET]);
40312 FIRST_ASSUM IMATCH_MP_TAC ;
40313 REWRITE_TAC[pointI;int_of_num_th];
40314 FIRST_ASSUM IMATCH_MP_TAC ;
40315 UND 9 THEN REAL_ARITH_TAC ;
40316 TYPE_THEN `UNIONS (par_cell T G) (pointI (s,&:0))` SUBAGOAL_TAC;
40317 REWRITE_TAC[UNIONS];
40318 TYPE_THEN `{(pointI (s,&:0))}` EXISTS_TAC ;
40319 REWRITE_TAC[INR IN_SING];
40321 THM_INTRO_TAC[`G`;`T`] par_cell_union_disjoint;
40322 USE 16(REWRITE_RULE[INTER;EQ_EMPTY]);
40327 let odd_bounded_subset = prove_by_refinement(
40328 `!G. rectagon G ==> (UNIONS (par_cell F G) SUBSET bounded_set G)`,
40333 REWRITE_TAC[SUBSET];
40334 THM_INTRO_TAC[`G`] unbounded_even_subset;
40335 FULL_REWRITE_TAC[SUBSET];
40337 PROOF_BY_CONTR_TAC;
40338 FULL_REWRITE_TAC[bounded_set;unbounded_set;DE_MORGAN_THM ];
40339 FIRST_ASSUM DISJ_CASES_TAC;
40340 THM_INTRO_TAC[`G`] ctop_top;
40341 THM_INTRO_TAC[`ctop G`;`x`] component_empty;
40342 UND 6 THEN ASM_REWRITE_TAC[];
40343 THM_INTRO_TAC[`G`]rectagon_segment;
40344 THM_INTRO_TAC[`G`;`T`] par_cell_partition;
40345 USE 7(ONCE_REWRITE_RULE[FUN_EQ_THM]);
40347 FULL_REWRITE_TAC[UNION];
40349 THM_INTRO_TAC[`G`;`T`] par_cell_union_disjoint;
40350 UND 5 THEN REWRITE_TAC[INTER;EMPTY_EXISTS];
40355 let unique_bounded = prove_by_refinement(
40356 `!G x y. (rectagon G) /\ bounded_set G x /\ bounded_set G y ==>
40357 (component (ctop G) x = component (ctop G) y) `,
40361 THM_INTRO_TAC[`G`;`x`] bounded_subset_unions;
40362 THM_INTRO_TAC[`G`;`y`] bounded_subset_unions;
40363 TYPE_THEN `FINITE G /\ G SUBSET edge` SUBAGOAL_TAC;
40364 FULL_REWRITE_TAC[rectagon];
40365 THM_INTRO_TAC[`G`] unbounded_set_nonempty;
40366 FULL_REWRITE_TAC[EMPTY_EXISTS];
40367 THM_INTRO_TAC[`G`;`u`] unbounded_subset_unions;
40368 THM_INTRO_TAC[`G`] rectagon_h_edge;
40369 THM_INTRO_TAC[`G`] ctop_top;
40370 TYPE_THEN `~(component (ctop G) x = EMPTY) /\ ~(component (ctop G) u = EMPTY) /\ ~(component (ctop G) y = EMPTY)` SUBAGOAL_TAC;
40371 ASM_MESON_TAC[component_empty];
40372 TYPE_THEN `segment G` SUBAGOAL_TAC;
40373 IMATCH_MP_TAC rectagon_segment;
40374 THM_INTRO_TAC[`G`;`x`;`h_edge m`] along_lemma11;
40375 THM_INTRO_TAC[`G`;`y`;`h_edge m`] along_lemma11;
40376 THM_INTRO_TAC[`G`;`u`;`h_edge m`] along_lemma11;
40377 USE 16 (MATCH_MP squc_h);
40378 USE 18 (MATCH_MP squc_h);
40379 USE 20 (MATCH_MP squc_h);
40380 TYPE_THEN `(p'' = p) \/ (p'' = p') \/ (p' = p)` SUBAGOAL_TAC;
40382 TYPE_THEN `!p a b. squ p SUBSET component (ctop G) a /\ squ p SUBSET component (ctop G) b ==> (component (ctop G) a = component (ctop G) b)` SUBAGOAL_TAC;
40383 FULL_REWRITE_TAC[SUBSET];
40384 THM_INTRO_TAC[`squ p'''`] cell_nonempty;
40385 REWRITE_TAC[cell_rules];
40386 FULL_REWRITE_TAC[EMPTY_EXISTS];
40389 KILL 19 THEN KILL 17 THEN KILL 15 THEN KILL 5;
40390 ASM_MESON_TAC[component_replace];
40392 TYPE_THEN `!a. bounded_set G a ==> ~(component (ctop G) a = component (ctop G) u)` SUBAGOAL_TAC;
40393 TYPE_THEN `unbounded_set G a` SUBAGOAL_TAC;
40394 REWRITE_TAC[unbounded_set];
40395 REWRITE_TAC[GSYM unbounded_set];
40396 THM_INTRO_TAC[`G`] bounded_unbounded_disj;
40397 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
40400 UND 21 THEN REP_CASES_TAC;
40401 TYPE_THEN `p''` UNABBREV_TAC;
40402 UND 22 THEN DISCH_THEN (THM_INTRO_TAC[`p`;`u`;`x`]);
40403 UND 23 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
40405 TYPE_THEN `p''` UNABBREV_TAC;
40406 UND 22 THEN DISCH_THEN (THM_INTRO_TAC[`p'`;`u`;`y`]);
40407 UND 23 THEN DISCH_THEN (THM_INTRO_TAC[`y`]);
40409 TYPE_THEN `p'` UNABBREV_TAC;
40410 FIRST_ASSUM IMATCH_MP_TAC ;
40415 let odd_bounded = prove_by_refinement(
40416 `!G. rectagon G ==> (UNIONS (par_cell F G) = bounded_set G)`,
40420 IMATCH_MP_TAC SUBSET_ANTISYM;
40422 IMATCH_MP_TAC odd_bounded_subset;
40423 REWRITE_TAC[SUBSET];
40424 PROOF_BY_CONTR_TAC;
40425 THM_INTRO_TAC[`G`;`F`] par_cell_nonempty;
40426 FULL_REWRITE_TAC[EMPTY_EXISTS];
40427 TYPE_THEN `?y. UNIONS (par_cell F G) y` SUBAGOAL_TAC;
40428 REWRITE_TAC[UNIONS];
40430 TYPE_THEN `u` EXISTS_TAC;
40431 TYPE_THEN `cell u` SUBAGOAL_TAC;
40432 THM_INTRO_TAC[`G`;`F`] par_cell_cell;
40433 ASM_MESON_TAC[ISUBSET];
40434 USE 4 (MATCH_MP cell_nonempty);
40435 FULL_REWRITE_TAC[EMPTY_EXISTS];
40438 THM_INTRO_TAC[`G`] odd_bounded_subset;
40439 TYPE_THEN `bounded_set G y` SUBAGOAL_TAC;
40440 ASM_MESON_TAC[ISUBSET];
40442 THM_INTRO_TAC[`G`;`x`;`y`] unique_bounded;
40443 TYPE_THEN `component (ctop G) y SUBSET UNIONS (par_cell F G)` SUBAGOAL_TAC;
40444 THM_INTRO_TAC[`G`;`F`;`y`] par_cell_comp;
40445 FIRST_ASSUM DISJ_CASES_TAC;
40446 USE 9 (REWRITE_RULE[SUBSET]);
40448 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[]);
40449 IMATCH_MP_TAC component_refl;
40450 IMATCH_MP_TAC bounded_subset_unions;
40451 THM_INTRO_TAC[`G`;`T`] par_cell_union_disjoint;
40452 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
40457 USE 8 (REWRITE_RULE[SUBSET]);
40458 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
40459 IMATCH_MP_TAC component_refl;
40460 IMATCH_MP_TAC bounded_subset_unions;
40465 let unbounded_even = prove_by_refinement(
40466 `!G. rectagon G ==> (unbounded_set G = UNIONS (par_cell T G))`,
40470 IMATCH_MP_TAC SUBSET_ANTISYM;
40471 THM_INTRO_TAC[`G`] unbounded_even_subset;
40472 REWRITE_TAC[SUBSET];
40473 PROOF_BY_CONTR_TAC;
40474 THM_INTRO_TAC[`G`] odd_bounded;
40475 USE 4 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
40478 TYPE_THEN `segment G` SUBAGOAL_TAC;
40479 IMATCH_MP_TAC rectagon_segment;
40480 TYPE_THEN `UNIONS (ctop G) x` SUBAGOAL_TAC;
40481 THM_INTRO_TAC[`G`;`T`] par_cell_partition;
40482 USE 6 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
40484 USE 6 (REWRITE_RULE[UNION]);
40487 THM_INTRO_TAC[`G`] bounded_unbounded_union;
40488 USE 7 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
40489 FULL_REWRITE_TAC[UNION];
40490 TYPE_THEN `bounded_set G x` SUBAGOAL_TAC;
40493 THM_INTRO_TAC[`G`;`T`] par_cell_union_disjoint;
40494 FULL_REWRITE_TAC[EQ_EMPTY;INTER];
40499 let par_cell_union_comp = prove_by_refinement(
40500 `!G eps x. (rectagon G) /\ (UNIONS (par_cell eps G) x) ==>
40501 (UNIONS (par_cell eps G) = component (ctop G) x)`,
40505 TYPE_THEN `eps = T` ASM_CASES_TAC;
40506 TYPE_THEN `UNIONS (par_cell T G) = unbounded_set G` SUBAGOAL_TAC;
40507 ASM_MESON_TAC[unbounded_even];
40508 TYPE_THEN `eps` UNABBREV_TAC;
40510 THM_INTRO_TAC[`G`]unbounded_set_comp;
40511 FULL_REWRITE_TAC[rectagon];
40513 ASM_MESON_TAC[component_replace];
40515 TYPE_THEN `eps = F` ASM_CASES_TAC;
40516 TYPE_THEN `eps` UNABBREV_TAC;
40517 IMATCH_MP_TAC SUBSET_ANTISYM;
40519 REWRITE_TAC[SUBSET];
40520 PROOF_BY_CONTR_TAC;
40521 THM_INTRO_TAC[`G`;`x`;`x'`] unique_bounded;
40522 ASM_MESON_TAC[odd_bounded];
40523 UND 4 THEN REWRITE_TAC[];
40524 IMATCH_MP_TAC component_refl;
40525 IMATCH_MP_TAC bounded_subset_unions;
40526 ASM_MESON_TAC[odd_bounded];
40527 THM_INTRO_TAC[`G`;`T`;`x`] par_cell_comp;
40528 FIRST_ASSUM DISJ_CASES_TAC;
40529 USE 4 (REWRITE_RULE [SUBSET]);
40530 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
40531 IMATCH_MP_TAC component_refl;
40532 IMATCH_MP_TAC bounded_subset_unions;
40533 ASM_MESON_TAC[odd_bounded];
40534 THM_INTRO_TAC[`G`;`T`] par_cell_union_disjoint;
40535 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
40541 (* 1.0.7 Adding segments *)
40543 let edge_cell = prove_by_refinement(
40544 `!e. (edge e) ==> (cell e)`,
40548 ASM_MESON_TAC[cell_rules];
40552 let edge_subset_ctop = prove_by_refinement(
40553 `!G A. FINITE G /\ G SUBSET edge /\ A SUBSET edge /\
40554 (A INTER G = EMPTY) ==> (UNIONS A SUBSET UNIONS (ctop G))`,
40558 REWRITE_TAC[ctop_unions;DIFF_SUBSET];
40560 IMATCH_MP_TAC SUBSET_TRANS;
40561 TYPE_THEN `UNIONS edge` EXISTS_TAC ;
40563 IMATCH_MP_TAC UNIONS_UNIONS;
40564 FULL_REWRITE_TAC[segment];
40565 REWRITE_TAC[UNIONS;SUBSET];
40566 USE 5 (MATCH_MP edge_euclid2);
40567 FULL_REWRITE_TAC[SUBSET];
40569 REWRITE_TAC[UNIONS;INTER;EQ_EMPTY];
40570 FULL_REWRITE_TAC[EQ_EMPTY];
40572 USE 0(REWRITE_RULE[INTER]);
40573 UND 0 THEN ASM_REWRITE_TAC[];
40575 TYPE_THEN `cell u /\ cell u'` SUBAGOAL_TAC;
40576 THM_INTRO_TAC[`G`] curve_cell_cell;
40577 THM_INTRO_TAC[`u`] edge_cell;
40578 FULL_REWRITE_TAC[ISUBSET];
40579 FULL_REWRITE_TAC[ISUBSET];
40581 TYPE_THEN `u = u'` SUBAGOAL_TAC ;
40582 IMATCH_MP_TAC cell_partition;
40583 REWRITE_TAC[EMPTY_EXISTS;INTER ];
40585 TYPE_THEN `u'` UNABBREV_TAC;
40586 TYPE_THEN `edge u` SUBAGOAL_TAC;
40587 ASM_MESON_TAC[ISUBSET];
40588 FULL_REWRITE_TAC[edge];
40589 ASM_MESON_TAC[curve_cell_h_ver2;curve_cell_v_ver2];
40593 let par_cell_pointI = prove_by_refinement(
40595 (par_cell eps G {(pointI m)} =
40596 UNIONS (par_cell eps G) (pointI m))`,
40600 REWRITE_TAC[UNIONS];
40601 TYPE_THEN `!u. cell u /\ u (pointI m) ==> ( u = {(pointI m)})` SUBAGOAL_TAC;
40602 FULL_REWRITE_TAC[cell];
40603 UND 1 THEN REP_CASES_TAC THEN (TYPE_THEN `u` UNABBREV_TAC) THEN (FULL_REWRITE_TAC[cell_clauses;INR IN_SING;pointI_inj]);
40604 IMATCH_MP_TAC EQ_ANTISYM;
40606 TYPE_THEN `{(pointI m)}` EXISTS_TAC;
40607 REWRITE_TAC[INR IN_SING];
40608 TYPE_THEN `u = {(pointI m)}` SUBAGOAL_TAC;
40609 FIRST_ASSUM IMATCH_MP_TAC ;
40610 ASM_MESON_TAC[par_cell_cell;subset_imp];
40615 let par_cell_pointI_trichot = prove_by_refinement(
40616 `!G eps m. (rectagon G) ==>
40617 ((par_cell eps G {(pointI m)}) \/ (par_cell (~eps) G {(pointI m)})
40622 TYPE_THEN `UNIONS (ctop G) (pointI m)` ASM_CASES_TAC;
40623 THM_INTRO_TAC[`G`;`eps`] par_cell_partition;
40624 IMATCH_MP_TAC rectagon_segment;
40625 USE 2 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
40626 TSPEC `pointI m` 2;
40628 USE 2(REWRITE_RULE[UNION]);
40629 USE 2 (REWRITE_RULE[GSYM par_cell_pointI]);
40631 THM_INTRO_TAC[`G`] rectagon_segment;
40636 FULL_REWRITE_TAC[ctop_unions;DIFF;DE_MORGAN_THM ];
40637 THM_INTRO_TAC[`G`;`m`] curve_point_unions;
40639 FIRST_ASSUM DISJ_CASES_TAC;
40640 FULL_REWRITE_TAC[pointI;euclid_point];
40642 THM_INTRO_TAC[`G`;`m`] curve_cell_not_point;
40644 THM_INTRO_TAC[`G`;`pointI m`] num_closure0;
40645 FULL_REWRITE_TAC[rectagon];
40651 let par_cell_nbd = prove_by_refinement(
40652 `!G eps m e. (rectagon G) /\ (par_cell eps G {(pointI m)}) /\ edge e
40653 /\ closure top2 e (pointI m) ==> (par_cell eps G e)`,
40657 FULL_REWRITE_TAC[edge];
40658 FIRST_ASSUM DISJ_CASES_TAC;
40659 THM_INTRO_TAC[`G`;`m`;`eps`] par_cell_point_v;
40660 TYPE_THEN `e` UNABBREV_TAC;
40661 FULL_REWRITE_TAC[v_edge_closure;vc_edge;UNION;plus_e12;cell_clauses;INR IN_SING ;pointI_inj;];
40662 FIRST_ASSUM DISJ_CASES_TAC;
40663 TYPE_THEN `m'` UNABBREV_TAC;
40664 TYPE_THEN `m` UNABBREV_TAC;
40665 TYPE_THEN `down (FST m',SND m' +: &:1) = m'` SUBAGOAL_TAC;
40666 REWRITE_TAC[down;PAIR_SPLIT];
40670 TYPE_THEN `e` UNABBREV_TAC;
40671 THM_INTRO_TAC[`G`;`m`;`eps`] par_cell_point_h;
40672 FULL_REWRITE_TAC[h_edge_closure;hc_edge;UNION;plus_e12;cell_clauses;INR IN_SING ;pointI_inj;];
40673 FIRST_ASSUM DISJ_CASES_TAC;
40674 TYPE_THEN `m'` UNABBREV_TAC;
40675 TYPE_THEN `m` UNABBREV_TAC;
40676 TYPE_THEN `left (FST m' +: &:1,SND m') = m'` SUBAGOAL_TAC;
40677 REWRITE_TAC[left ;PAIR_SPLIT];
40683 let segment_in_comp = prove_by_refinement(
40684 `!G A. rectagon G /\ segment A /\ (A INTER G = EMPTY) /\
40685 (cls G INTER cls A SUBSET endpoint A)
40686 ==> (?eps. A SUBSET par_cell eps G)`,
40691 TYPE_THEN `?e. A e` SUBAGOAL_TAC;
40692 FULL_REWRITE_TAC[segment;EMPTY_EXISTS ];
40695 THM_INTRO_TAC[`G`;`A`] edge_subset_ctop;
40696 FULL_REWRITE_TAC[segment;rectagon];
40698 THM_INTRO_TAC[`G`] rectagon_segment;
40699 TYPE_THEN`edge e` SUBAGOAL_TAC;
40700 FULL_REWRITE_TAC[SUBSET;segment];
40701 THM_INTRO_TAC[`e`] edge_cell;
40702 THM_INTRO_TAC[`e`] cell_nonempty;
40703 FULL_REWRITE_TAC[EMPTY_EXISTS];
40705 TYPE_THEN `?eps. ~(e INTER (UNIONS (par_cell eps G)) = EMPTY)` SUBAGOAL_TAC;
40706 REWRITE_TAC[EMPTY_EXISTS];
40707 THM_INTRO_TAC[`G`;`T`] par_cell_partition;
40708 USE 10(ONCE_REWRITE_RULE[FUN_EQ_THM]);
40710 TYPE_THEN `UNIONS (ctop G) u` SUBAGOAL_TAC;
40711 IMATCH_MP_TAC subset_imp;
40712 TYPE_THEN `UNIONS A` EXISTS_TAC;
40713 REWRITE_TAC[UNIONS];
40716 USE 10 (REWRITE_RULE[SUBSET ;UNION]);
40717 FIRST_ASSUM DISJ_CASES_TAC;
40718 TYPE_THEN `T` EXISTS_TAC;
40719 TYPE_THEN `u` EXISTS_TAC;
40720 REWRITE_TAC[INTER];
40721 REWRITE_TAC[INTER];
40724 TYPE_THEN `eps` EXISTS_TAC;
40726 USE 10 (REWRITE_RULE [EMPTY_EXISTS;INTER;UNIONS]);
40727 TYPE_THEN `u'' = e` SUBAGOAL_TAC;
40728 IMATCH_MP_TAC cell_partition;
40729 REWRITE_TAC[EMPTY_EXISTS;INTER ];
40730 ASM_MESON_TAC[par_cell_cell;subset_imp ];
40731 TYPE_THEN `u''` UNABBREV_TAC;
40733 TYPE_THEN `S = A INTER par_cell eps G` ABBREV_TAC ;
40734 TYPE_THEN `inductive_set A S` BACK_TAC ; (* // *)
40735 FULL_REWRITE_TAC[inductive_set;segment];
40736 TYPE_THEN `S = A` SUBAGOAL_TAC;
40737 FIRST_ASSUM IMATCH_MP_TAC ;
40738 UND 2 THEN MESON_TAC[];
40739 KILL 15 THEN KILL 20 THEN KILL 16 THEN KILL 21;
40740 TYPE_THEN `S` UNABBREV_TAC;
40741 ASM_MESON_TAC[SUBSET_INTER_ABSORPTION];
40743 REWRITE_TAC[inductive_set];
40745 TYPE_THEN `S` UNABBREV_TAC ;
40746 REWRITE_TAC[INTER;SUBSET];
40747 REWRITE_TAC[EMPTY_EXISTS];
40749 TYPE_THEN `e` EXISTS_TAC;
40750 TYPE_THEN `S` UNABBREV_TAC;
40751 REWRITE_TAC[INTER];
40753 USE 13(REWRITE_RULE[INTER]);
40754 TYPE_THEN `S` UNABBREV_TAC;
40755 THM_INTRO_TAC[`C`;`C'`] adjv_adj;
40756 FULL_REWRITE_TAC[segment];
40757 ASM_MESON_TAC[subset_imp];
40758 TYPE_THEN `m = adjv C C'` ABBREV_TAC ;
40760 TYPE_THEN `FINITE G /\ FINITE A` SUBAGOAL_TAC;
40761 FULL_REWRITE_TAC[segment];
40762 TYPE_THEN `~endpoint A m` SUBAGOAL_TAC;
40763 FULL_REWRITE_TAC[endpoint];
40764 THM_INTRO_TAC[`A`;`pointI m`] num_closure1;
40769 TYPE_THEN `e' = C` SUBAGOAL_TAC;
40771 TYPE_THEN `e'` UNABBREV_TAC;
40772 THM_INTRO_TAC[`C`;`C'`] adjv_adj2;
40773 USE 2(REWRITE_RULE[segment]);
40774 ASM_MESON_TAC[subset_imp];
40775 TYPE_THEN `C = C'` SUBAGOAL_TAC;
40777 FULL_REWRITE_TAC[adj];
40780 TYPE_THEN `cls A m` SUBAGOAL_TAC;
40784 TYPE_THEN `~cls G m` SUBAGOAL_TAC;
40785 USE 0 (REWRITE_RULE[SUBSET;INTER]);
40788 TYPE_THEN `edge C /\ edge C'` SUBAGOAL_TAC;
40789 USE 2(REWRITE_RULE[segment]);
40790 ASM_MESON_TAC[subset_imp];
40791 THM_INTRO_TAC[`G`;`eps`;`m`] par_cell_pointI_trichot;
40793 FIRST_ASSUM DISJ_CASES_TAC;
40794 THM_INTRO_TAC[`G`;`eps`;`m`;`C'`] par_cell_nbd;
40795 TYPE_THEN `m` UNABBREV_TAC;
40796 IMATCH_MP_TAC adjv_adj2;
40798 THM_INTRO_TAC[`G`;`~eps`;`m`;`C`] par_cell_nbd;
40799 THM_INTRO_TAC[`G`;`eps`] par_cell_disjoint;
40800 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
40806 let segment_end_select = prove_by_refinement(
40807 `!E A a b. (E SUBSET edge) /\ segment_end A a b /\
40808 ~cls E a /\ cls E b ==>
40809 (?B c. segment_end B a c /\ cls E c /\ B SUBSET A /\
40810 (cls B INTER cls E = {c}))`,
40814 TYPE_THEN `EE = { (B,c) | segment_end B a c /\ cls E c /\ B SUBSET A }` ABBREV_TAC ;
40816 TYPE_THEN `~(EE = EMPTY)` SUBAGOAL_TAC;
40817 UND 5 THEN REWRITE_TAC[EMPTY_EXISTS];
40818 TYPE_THEN `(A,b)` EXISTS_TAC;
40819 TYPE_THEN `EE` UNABBREV_TAC;
40820 TYPE_THEN `A` EXISTS_TAC;
40821 TYPE_THEN `b` EXISTS_TAC;
40822 ASM_REWRITE_TAC[SUBSET_REFL];
40824 THM_INTRO_TAC[`EE`;`(CARD o FST):((((num->real)->bool)->bool)#(int#int))->num`] select_image_num_min;
40827 TYPE_THEN `?Bm cm. (z = (Bm,cm))` SUBAGOAL_TAC;
40828 ONCE_REWRITE_TAC[PAIR_SPLIT];
40830 TYPE_THEN `z` UNABBREV_TAC;
40831 TYPE_THEN `Bm` EXISTS_TAC;
40832 TYPE_THEN `cm` EXISTS_TAC;
40833 TYPE_THEN `EE` UNABBREV_TAC;
40834 FULL_REWRITE_TAC[o_DEF];
40835 USE 4(ONCE_REWRITE_RULE[PAIR_SPLIT]);
40836 USE 4(REWRITE_RULE[]);
40837 TYPE_THEN `c` UNABBREV_TAC;
40838 TYPE_THEN `B` UNABBREV_TAC;
40840 IMATCH_MP_TAC SUBSET_ANTISYM;
40841 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
40843 FULL_REWRITE_TAC[SUBSET;INR IN_SING;INTER];
40844 IMATCH_MP_TAC segment_end_cls2;
40847 REWRITE_TAC[SUBSET;INTER;INR IN_SING];
40848 PROOF_BY_CONTR_TAC;
40849 THM_INTRO_TAC[`Bm`;`a`;`cm`;`x`] cut_psegment;
40854 USE 6 (ONCE_REWRITE_RULE[PAIR_SPLIT]);
40856 USE 6 (CONV_RULE (dropq_conv "B"));
40857 USE 6 (CONV_RULE (dropq_conv "c"));
40858 UND 6 THEN DISCH_THEN (THM_INTRO_TAC[]);
40859 IMATCH_MP_TAC SUBSET_TRANS;
40860 TYPE_THEN `Bm` EXISTS_TAC;
40861 REWRITE_TAC[SUBSET;UNION];
40862 USE 6(MATCH_MP (ARITH_RULE `x <=| y ==> ~( y < x)`));
40863 UND 6 THEN REWRITE_TAC[];
40865 IMATCH_MP_TAC card_subset_lt;
40867 REWRITE_TAC[SUBSET;UNION];
40868 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
40870 REWRITE_TAC[FINITE_UNION];
40871 FULL_REWRITE_TAC[segment_end;segment;psegment];
40873 TYPE_THEN `~(B' = EMPTY)` SUBAGOAL_TAC;
40874 FULL_REWRITE_TAC[segment_end;segment;psegment];
40875 UND 17 THEN UND 19 THEN MESON_TAC[];
40876 FULL_REWRITE_TAC[EMPTY_EXISTS];
40877 FULL_REWRITE_TAC[EQ_EMPTY;INTER ];
40879 USE 6 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
40881 FULL_REWRITE_TAC[UNION];
40886 let endpoint_cls = prove_by_refinement(
40887 `!G. FINITE G ==> (endpoint G SUBSET cls G)`,
40890 REWRITE_TAC[endpoint;SUBSET;cls];
40891 THM_INTRO_TAC[`G`;`pointI x`] num_closure1;
40897 let conn2_proper = prove_by_refinement(
40898 `!G H . (G SUBSET edge) /\
40899 conn2 G /\ conn2 H /\ H SUBSET G /\ ~(H = G) ==>
40900 (?A. A SUBSET G /\ (A INTER H = EMPTY) /\ psegment A /\
40901 (cls H INTER cls A = endpoint A))`,
40906 TYPE_THEN `cls G SUBSET cls H` ASM_CASES_TAC;
40907 TYPE_THEN `?e. G e /\ ~H e` SUBAGOAL_TAC;
40908 PROOF_BY_CONTR_TAC;
40909 UND 0 THEN REWRITE_TAC[];
40910 IMATCH_MP_TAC SUBSET_ANTISYM;
40911 REWRITE_TAC[SUBSET];
40914 TYPE_THEN `edge e` SUBAGOAL_TAC;
40915 ASM_MESON_TAC[subset_imp];
40916 TYPE_THEN `{e}` EXISTS_TAC;
40918 ASM_REWRITE_TAC[SUBSET;INR IN_SING];
40920 ASM_REWRITE_TAC[EQ_EMPTY;INR IN_SING;INTER];
40923 IMATCH_MP_TAC psegment_edge;
40924 TYPE_THEN `endpoint{e} = cls{e}` SUBAGOAL_TAC;
40925 ASM_SIMP_TAC[endpoint_closure;cls_edge];
40926 ONCE_REWRITE_TAC[INTER_COMM];
40927 REWRITE_TAC[ONCE_REWRITE_RULE [EQ_SYM_EQ] SUBSET_INTER_ABSORPTION];
40928 IMATCH_MP_TAC SUBSET_TRANS;
40929 TYPE_THEN `cls G` EXISTS_TAC;
40930 IMATCH_MP_TAC cls_subset;
40931 REWRITE_TAC[SUBSET;INR IN_SING];
40933 TYPE_THEN `?a. cls G a /\ ~cls H a` SUBAGOAL_TAC;
40934 USE 5(REWRITE_RULE[SUBSET]);
40937 TYPE_THEN `FINITE H /\ H SUBSET edge` SUBAGOAL_TAC;
40939 FULL_REWRITE_TAC[conn2];
40940 IMATCH_MP_TAC SUBSET_TRANS;
40943 TYPE_THEN `?b c. cls H b /\ cls H c /\ ~(b = c)` SUBAGOAL_TAC;
40944 THM_INTRO_TAC[`H`] conn2_cls3;
40945 THM_INTRO_TAC[`cls H`;`2`] card_has_subset;
40947 ASM_MESON_TAC[finite_cls];
40948 UND 10 THEN ARITH_TAC;
40949 FULL_REWRITE_TAC[has_size2];
40950 TYPE_THEN `B` UNABBREV_TAC;
40951 FULL_REWRITE_TAC[SUBSET;INR in_pair];
40952 TYPE_THEN `a'` EXISTS_TAC;
40953 TYPE_THEN `b` EXISTS_TAC;
40956 TYPE_THEN `cls H SUBSET cls G` SUBAGOAL_TAC;
40957 IMATCH_MP_TAC cls_subset;
40958 TYPE_THEN `~(a = b) /\ ~(a = c)` SUBAGOAL_TAC;
40961 TYPE_THEN `(?U. U SUBSET G /\ segment_end U a b /\ ~cls U c)` SUBAGOAL_TAC;
40962 FULL_REWRITE_TAC[conn2];
40963 FIRST_ASSUM IMATCH_MP_TAC ;
40964 ASM_MESON_TAC[subset_imp];
40965 THM_INTRO_TAC[`H`;`U`;`a`;`b`] segment_end_select;
40966 TYPE_THEN `B SUBSET G` SUBAGOAL_TAC;
40967 IMATCH_MP_TAC SUBSET_TRANS;
40968 TYPE_THEN `U` EXISTS_TAC;
40969 TYPE_THEN `~cls B c` SUBAGOAL_TAC;
40970 TYPE_THEN `cls B SUBSET cls U` SUBAGOAL_TAC;
40971 IMATCH_MP_TAC cls_subset;
40972 USE 25 (REWRITE_RULE[SUBSET]);
40974 KILL 20 THEN KILL 16 THEN KILL 17 THEN KILL 18 THEN KILL 15 THEN KILL 10;
40976 TYPE_THEN `~(a = c')` SUBAGOAL_TAC;
40978 TYPE_THEN `~(c = c')` SUBAGOAL_TAC;
40979 TYPE_THEN`c'` UNABBREV_TAC;
40980 USE 19 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
40982 USE 12 (REWRITE_RULE[INTER;INR IN_SING]);
40985 TYPE_THEN `(?V. V SUBSET G /\ segment_end V a c /\ ~cls V c')` SUBAGOAL_TAC;
40986 FULL_REWRITE_TAC[conn2];
40987 FIRST_ASSUM IMATCH_MP_TAC ;
40988 ASM_MESON_TAC[subset_imp];
40989 THM_INTRO_TAC[`H`;`V`;`a`;`c`] segment_end_select;
40991 TYPE_THEN `B' SUBSET G` SUBAGOAL_TAC;
40992 IMATCH_MP_TAC SUBSET_TRANS;
40993 TYPE_THEN `V` EXISTS_TAC;
40994 TYPE_THEN `~cls B' c'` SUBAGOAL_TAC;
40995 TYPE_THEN `cls B' SUBSET cls V` SUBAGOAL_TAC;
40996 IMATCH_MP_TAC cls_subset;
40997 USE 29 (REWRITE_RULE[SUBSET]);
40999 KILL 20 THEN KILL 16 THEN KILL 17;
41001 KILL 12 THEN KILL 24 THEN KILL 14;
41003 TYPE_THEN `~(c'' = c')` SUBAGOAL_TAC;
41004 TYPE_THEN `c''` UNABBREV_TAC;
41005 USE 18 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
41007 USE 12 (REWRITE_RULE[INTER;INR IN_SING]);
41010 TYPE_THEN `B INTER H = EMPTY` SUBAGOAL_TAC;
41011 PROOF_BY_CONTR_TAC;
41012 FULL_REWRITE_TAC[EMPTY_EXISTS];
41013 USE 14(REWRITE_RULE[INTER]);
41015 TYPE_THEN `cls {u} SUBSET cls B INTER cls H` SUBAGOAL_TAC;
41016 REWRITE_TAC[SUBSET_INTER];
41017 CONJ_TAC THEN IMATCH_MP_TAC cls_subset THEN REWRITE_TAC[SUBSET;INR IN_SING];
41020 THM_INTRO_TAC[`u`] cls_edge_size2;
41021 FULL_REWRITE_TAC[SUBSET];
41022 FULL_REWRITE_TAC[has_size2];
41024 USE 17 (REWRITE_RULE[SUBSET;INR IN_SING;INR in_pair ]);
41030 TYPE_THEN `B' INTER H = EMPTY` SUBAGOAL_TAC;
41031 PROOF_BY_CONTR_TAC;
41032 FULL_REWRITE_TAC[EMPTY_EXISTS];
41033 USE 15(REWRITE_RULE[INTER]);
41035 TYPE_THEN `cls {u} SUBSET cls B' INTER cls H` SUBAGOAL_TAC;
41036 REWRITE_TAC[SUBSET_INTER];
41037 CONJ_TAC THEN IMATCH_MP_TAC cls_subset THEN REWRITE_TAC[SUBSET;INR IN_SING];
41040 THM_INTRO_TAC[`u`] cls_edge_size2;
41041 FULL_REWRITE_TAC[SUBSET];
41042 FULL_REWRITE_TAC[has_size2];
41044 USE 18 (REWRITE_RULE[SUBSET;INR IN_SING;INR in_pair ]);
41050 USE 22 (ONCE_REWRITE_RULE[segment_end_symm]);
41051 THM_INTRO_TAC[`B`;`B'`;`c'`;`a`;`c''`] segment_end_trans;
41052 TYPE_THEN `U` EXISTS_TAC;
41054 IMATCH_MP_TAC SUBSET_TRANS;
41055 TYPE_THEN `B UNION B'` EXISTS_TAC;
41056 REWRITE_TAC[union_subset];
41059 PROOF_BY_CONTR_TAC;
41060 FULL_REWRITE_TAC[EMPTY_EXISTS;SUBSET;UNION;INTER;EQ_EMPTY ];
41064 USE 20(REWRITE_RULE[segment_end]);
41066 IMATCH_MP_TAC SUBSET_ANTISYM;
41068 REWRITE_TAC[INTER;SUBSET];
41069 USE 20 (REWRITE_RULE[segment_end]);
41070 REWRITE_TAC[INR in_pair];
41071 TYPE_THEN `cls U SUBSET cls(B UNION B')` SUBAGOAL_TAC;
41072 IMATCH_MP_TAC cls_subset;
41073 USE 31(REWRITE_RULE[SUBSET;cls_union]);
41074 USE 31(REWRITE_RULE[UNION]);
41076 FIRST_ASSUM DISJ_CASES_TAC;
41077 USE 19(ONCE_REWRITE_RULE[FUN_EQ_THM]);
41079 USE 19 (REWRITE_RULE[INTER;INR IN_SING]);
41081 USE 18(ONCE_REWRITE_RULE[FUN_EQ_THM]);
41083 USE 18 (REWRITE_RULE[INTER;INR IN_SING]);
41086 USE 20(REWRITE_RULE[segment_end]);
41087 REWRITE_TAC[SUBSET;INTER;INR in_pair];
41089 FIRST_ASSUM DISJ_CASES_TAC;
41093 TYPE_THEN `FINITE U` SUBAGOAL_TAC;
41094 FULL_REWRITE_TAC[segment_end;psegment;segment];
41097 TYPE_THEN `endpoint U SUBSET cls U` SUBAGOAL_TAC;
41098 IMATCH_MP_TAC endpoint_cls;
41099 USE 31(REWRITE_RULE[SUBSET]);
41100 FIRST_ASSUM IMATCH_MP_TAC ;
41102 REWRITE_TAC[INR in_pair];
41106 (* ------------------------------------------------------------------ *)
41108 (* ------------------------------------------------------------------ *)
41111 (* EVEN and ODD components. 1.0.8, Nov 28, 2004, 9am *)
41113 let parity_select = jordan_def
41114 `parity G C = @eps. par_cell eps G C`;;
41116 let cell_ununion = prove_by_refinement(
41117 `!V C u. cell C /\ C u /\ (V SUBSET cell) /\ (UNIONS V) u ==> V C`,
41120 REWRITE_TAC[UNIONS];
41121 TYPE_THEN `u' = C` SUBAGOAL_TAC;
41122 IMATCH_MP_TAC cell_partition;
41124 ASM_MESON_TAC[subset_imp];
41125 UND 5 THEN REWRITE_TAC[INTER;EMPTY_EXISTS];
41131 let par_cell_cell_partition = prove_by_refinement(
41132 `!G eps C. segment G /\ cell C ==>
41133 (par_cell eps G C \/ par_cell (~eps) G C \/ curve_cell G C)`,
41137 TYPE_THEN `curve_cell G C` ASM_CASES_TAC;
41138 THM_INTRO_TAC[`C`] cell_nonempty;
41139 FULL_REWRITE_TAC[EMPTY_EXISTS];
41140 TYPE_THEN `UNIONS (ctop G) u` SUBAGOAL_TAC;
41141 REWRITE_TAC[ctop_unions;DIFF;UNIONS ];
41143 THM_INTRO_TAC[`C`] cell_euclid;
41144 ASM_MESON_TAC[subset_imp];
41145 THM_INTRO_TAC[`curve_cell G`;`C`;`u`] cell_ununion;
41147 IMATCH_MP_TAC curve_cell_cell;
41148 FULL_REWRITE_TAC[segment];
41149 REWRITE_TAC[UNIONS];
41153 THM_INTRO_TAC[`G`;`eps`] par_cell_partition;
41154 USE 5 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
41157 USE 5(REWRITE_RULE[UNION]);
41158 THM_INTRO_TAC[`G`] par_cell_cell;
41159 FIRST_ASSUM DISJ_CASES_TAC;
41161 IMATCH_MP_TAC cell_ununion;
41164 IMATCH_MP_TAC cell_ununion;
41169 let par_cell_curve_cell_disj = prove_by_refinement(
41170 `!G eps. (G SUBSET edge) ==>
41171 (par_cell eps G INTER curve_cell G = EMPTY )`,
41175 REWRITE_TAC[INTER;EQ_EMPTY];
41176 USE 2(MATCH_MP par_cell_curve_disj);
41177 UND 2 THEN REWRITE_TAC[EMPTY_EXISTS;INTER;UNIONS ];
41178 TYPE_THEN `cell x` SUBAGOAL_TAC;
41179 ASM_MESON_TAC[curve_cell_cell;subset_imp];
41180 USE 2 (MATCH_MP cell_nonempty);
41181 FULL_REWRITE_TAC[EMPTY_EXISTS];
41182 TYPE_THEN `u` EXISTS_TAC;
41187 let curve_cell_edge = prove_by_refinement(
41188 `!G e . edge e ==> (curve_cell G e = G e) `,
41192 FIRST_ASSUM DISJ_CASES_TAC;
41193 REWRITE_TAC[curve_cell;UNION;INR eq_sing; cell_clauses;v_edge_pointI;h_edge_pointI ];
41194 REWRITE_TAC[curve_cell;UNION;INR eq_sing; cell_clauses;v_edge_pointI;h_edge_pointI ];
41198 let parity = prove_by_refinement(
41199 `!G C. segment G /\ cell C /\ ~curve_cell G C ==>
41200 par_cell (parity G C) G C`,
41203 REWRITE_TAC[parity_select];
41205 THM_INTRO_TAC[`G`;`T`;`C`] par_cell_cell_partition;
41210 let parity_unique = prove_by_refinement(
41211 `!G C eps. segment G /\
41212 par_cell eps G C ==> (eps = parity G C)`,
41216 TYPE_THEN `cell C /\ ~curve_cell G C` SUBAGOAL_TAC;
41218 ASM_MESON_TAC[par_cell_cell;subset_imp];
41219 THM_INTRO_TAC[`G`;`eps`] par_cell_curve_cell_disj;
41220 FULL_REWRITE_TAC[segment];
41221 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
41223 THM_INTRO_TAC[`G`;`C`] parity;
41224 PROOF_BY_CONTR_TAC;
41225 TYPE_THEN`parity G C = ~eps` SUBAGOAL_TAC;
41227 TYPE_THEN `parity G C` UNABBREV_TAC;
41228 THM_INTRO_TAC[`G`;`eps`] par_cell_disjoint;
41229 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
41234 let unions_curve_cell = prove_by_refinement(
41235 `!G C. (G SUBSET edge) /\ cell C ==>
41236 ((C INTER UNIONS (curve_cell G) = EMPTY) = (~curve_cell G C))`,
41240 IMATCH_MP_TAC EQ_ANTISYM;
41242 USE 3(REWRITE_RULE[INTER;UNIONS;EQ_EMPTY]);
41243 USE 0 (MATCH_MP cell_nonempty);
41244 FULL_REWRITE_TAC[EMPTY_EXISTS];
41247 REWRITE_TAC[EQ_EMPTY;INTER];
41248 UND 2 THEN REWRITE_TAC[];
41249 IMATCH_MP_TAC cell_ununion;
41251 IMATCH_MP_TAC curve_cell_cell;
41255 let even_num_lower_union = prove_by_refinement(
41256 `!A B m. FINITE A /\ FINITE B /\ (A INTER B = EMPTY) ==>
41257 (EVEN (num_lower (A UNION B) m) <=>
41258 (EVEN (num_lower A m) = EVEN (num_lower B m)))`,
41261 REWRITE_TAC[num_lower_set];
41262 THM_INTRO_TAC[`set_lower A m`;`set_lower B m`] even_card_even;
41263 REPEAT CONJ_TAC THEN (TRY (IMATCH_MP_TAC finite_set_lower));
41264 REWRITE_TAC[EQ_EMPTY;INTER;set_lower];
41265 FULL_REWRITE_TAC[EQ_EMPTY;INTER];
41270 IMATCH_MP_TAC EQ_EXT;
41271 REWRITE_TAC[set_lower;UNION];
41272 TYPE_THEN `C <=> (FST x = FST m) /\ SND x <=: SND m` ABBREV_TAC ;
41273 USE 0 (REWRITE_RULE[INTER;EQ_EMPTY]);
41274 TSPEC `h_edge x` 0;
41275 UND 0 THEN MESON_TAC[];
41279 let eq_pair_exchange = prove_by_refinement(
41280 `!(a:bool) b c d. ((a = b) <=> (c = d)) <=> ((a = c) <=> (b = d))`,
41287 let parity_point = prove_by_refinement(
41288 `!A p. segment A /\ ~(curve_cell A {(pointI p)}) ==>
41289 (parity A {(pointI p)} = EVEN (num_lower A p))`,
41293 ONCE_REWRITE_TAC[EQ_SYM_EQ];
41294 IMATCH_MP_TAC parity_unique;
41295 REWRITE_TAC[par_cell;cell_clauses];
41296 THM_INTRO_TAC[`A`;`{(pointI p)}`] unions_curve_cell;
41297 FULL_REWRITE_TAC[cell_rules;segment];
41302 let parity_h = prove_by_refinement(
41303 `!A p. segment A /\ ~A (h_edge p) ==>
41304 (parity A (h_edge p) <=> EVEN (num_lower A p))`,
41308 ONCE_REWRITE_TAC[EQ_SYM_EQ];
41309 IMATCH_MP_TAC parity_unique;
41310 REWRITE_TAC[par_cell;cell_clauses];
41311 THM_INTRO_TAC[`A`;`h_edge p`] unions_curve_cell;
41312 FULL_REWRITE_TAC[cell_rules;segment];
41313 THM_INTRO_TAC[`A`;`h_edge p`] curve_cell_edge;
41314 REWRITE_TAC[edge_h];
41319 let parity_v = prove_by_refinement(
41320 `!A p. segment A /\ ~A (v_edge p) ==>
41321 (parity A (v_edge p) <=> EVEN (num_lower A p))`,
41325 ONCE_REWRITE_TAC[EQ_SYM_EQ];
41326 IMATCH_MP_TAC parity_unique;
41327 REWRITE_TAC[par_cell;cell_clauses];
41328 THM_INTRO_TAC[`A`;`v_edge p`] unions_curve_cell;
41329 FULL_REWRITE_TAC[cell_rules;segment];
41330 THM_INTRO_TAC[`A`;`v_edge p`] curve_cell_edge;
41331 REWRITE_TAC[edge_v];
41336 let parity_squ = prove_by_refinement(
41337 `!A p. segment A ==>
41338 (parity A (squ p) <=> EVEN (num_lower A p))`,
41342 ONCE_REWRITE_TAC[EQ_SYM_EQ];
41343 IMATCH_MP_TAC parity_unique;
41344 REWRITE_TAC[par_cell;cell_clauses];
41345 THM_INTRO_TAC[`A`;`squ p`] unions_curve_cell;
41346 FULL_REWRITE_TAC[cell_rules;segment];
41347 THM_INTRO_TAC[`A`;`p`] curve_cell_squ;
41352 let parity_union = prove_by_refinement(
41353 `!A B C. segment A /\ segment B /\ segment (A UNION B) /\
41354 (A INTER B = EMPTY) /\
41355 cell C /\ ~curve_cell A C /\ ~curve_cell B C ==>
41356 (parity (A UNION B) C <=> (parity A C = parity B C))`,
41361 ONCE_REWRITE_TAC[EQ_SYM_EQ];
41362 IMATCH_MP_TAC parity_unique;
41363 REWRITE_TAC[par_cell];
41364 TYPE_THEN `A UNION B SUBSET edge` SUBAGOAL_TAC;
41365 REWRITE_TAC[union_subset];
41366 FULL_REWRITE_TAC[segment];
41367 ASM_SIMP_TAC[unions_curve_cell];
41368 TYPE_THEN `FINITE A /\ FINITE B` SUBAGOAL_TAC;
41369 FULL_REWRITE_TAC[segment];
41370 ASM_SIMP_TAC[even_num_lower_union];
41371 ONCE_REWRITE_TAC[eq_pair_exchange];
41373 REWRITE_TAC[curve_cell_union];
41374 REWRITE_TAC[UNION];
41376 WITH 2(REWRITE_RULE[cell_mem]);
41377 UND 10 THEN REP_CASES_TAC ;
41379 REWRITE_TAC[cell_clauses];
41380 TYPE_THEN`p` EXISTS_TAC;
41381 IMATCH_MP_TAC (TAUT `a /\ b ==> (a <=> b)`);
41382 TYPE_THEN `C` UNABBREV_TAC;
41383 CONJ_TAC THEN (IMATCH_MP_TAC parity_point);
41384 REWRITE_TAC[cell_clauses];
41385 TYPE_THEN`p` EXISTS_TAC;
41386 IMATCH_MP_TAC (TAUT `a /\ b ==> (a <=> b)`);
41387 TYPE_THEN `C` UNABBREV_TAC;
41388 CONJ_TAC THEN (IMATCH_MP_TAC parity_h) THEN ASM_MESON_TAC[curve_cell_h_ver2];
41389 REWRITE_TAC[cell_clauses];
41390 TYPE_THEN`p` EXISTS_TAC;
41391 IMATCH_MP_TAC (TAUT `a /\ b ==> (a <=> b)`);
41392 TYPE_THEN `C` UNABBREV_TAC;
41393 CONJ_TAC THEN (IMATCH_MP_TAC parity_v) THEN ASM_MESON_TAC[curve_cell_v_ver2];
41394 REWRITE_TAC[cell_clauses];
41395 TYPE_THEN`p` EXISTS_TAC;
41396 IMATCH_MP_TAC (TAUT `a /\ b ==> (a <=> b)`);
41397 TYPE_THEN `C` UNABBREV_TAC;
41398 CONJ_TAC THEN (IMATCH_MP_TAC parity_squ) ;
41403 (* extraneous fact *)
41404 let component_simple_arc = prove_by_refinement(
41405 `!G x y. (FINITE G /\ G SUBSET edge ) /\ ~(x = y) ==>
41406 ((component (ctop G) x y) <=>
41407 (?C. simple_arc_end C x y /\
41408 (C INTER (UNIONS (curve_cell G)) = EMPTY)))`,
41412 string together :component-imp-connected, connected-induced2,
41413 p_conn_conn, p_conn_hv_finite;
41414 other_direction : simple_arc_connected, connected-induced,
41415 connected-component; *)
41417 THM_INTRO_TAC[`G`] ctop_top;
41418 ASSUME_TAC top2_top;
41419 THM_INTRO_TAC[`G`] curve_closed_ver2;
41420 TYPE_THEN `top2 (euclid 2 DIFF UNIONS (curve_cell G))` SUBAGOAL_TAC;
41421 USE 5 (MATCH_MP closed_open);
41422 FULL_REWRITE_TAC[top2_unions;open_DEF ];
41423 TYPE_THEN `A = euclid 2 DIFF UNIONS (curve_cell G)` ABBREV_TAC ;
41424 TYPE_THEN `UNIONS (ctop G) = A` SUBAGOAL_TAC;
41425 TYPE_THEN`A` UNABBREV_TAC;
41426 REWRITE_TAC[ctop_unions];
41427 TYPE_THEN `induced_top top2 A = ctop G` SUBAGOAL_TAC;
41430 IMATCH_MP_TAC EQ_ANTISYM;
41432 THM_INTRO_TAC[`(ctop G)`;`x`] component_imp_connected;
41433 THM_INTRO_TAC[`(top2)`;`A`;`(component (ctop G) x)`] connected_induced2;
41434 REWRITE_TAC[top2_unions];
41435 IMATCH_MP_TAC SUBSET_TRANS;
41436 TYPE_THEN `UNIONS (ctop G)` EXISTS_TAC;
41439 TYPE_THEN `A` UNABBREV_TAC;
41440 REWRITE_TAC[component_unions];
41441 TYPE_THEN `A` UNABBREV_TAC;
41442 REWRITE_TAC[DIFF;SUBSET];
41445 TYPE_THEN `B = component (ctop G) x` ABBREV_TAC ;
41446 TYPE_THEN `B x /\ B y` SUBAGOAL_TAC;
41447 TYPE_THEN `B` UNABBREV_TAC;
41448 THM_INTRO_TAC[`(ctop G)`;`x`;`y`] component_replace;
41449 IMATCH_MP_TAC component_symm;
41451 ASSUME_TAC loc_path_conn_top2;
41452 TYPE_THEN `top_of_metric(A,d_euclid) = (ctop G)` SUBAGOAL_TAC;
41455 ONCE_REWRITE_TAC[EQ_SYM_EQ];
41456 IMATCH_MP_TAC top_of_metric_induced;
41457 TYPE_THEN `A` UNABBREV_TAC;
41458 REWRITE_TAC[DIFF;SUBSET];
41460 TYPE_THEN `loc_path_conn (ctop G)` SUBAGOAL_TAC;
41461 THM_INTRO_TAC[`2`;`A`] loc_path_conn_euclid;
41462 FULL_REWRITE_TAC[top2];
41465 THM_INTRO_TAC[`top2`] loc_path_conn;
41470 TYPE_THEN `A x` SUBAGOAL_TAC;
41471 ASM_MESON_TAC[subset_imp];
41472 TYPE_THEN `top2 B` SUBAGOAL_TAC;
41473 TYPE_THEN `B` UNABBREV_TAC;
41474 ASM_MESON_TAC[path_eq_conn];
41476 THM_INTRO_TAC[`B`;`x`;`y`] p_conn_conn;
41478 THM_INTRO_TAC[`B`;`x`;`y`] p_conn_hv_finite;
41481 TYPE_THEN `C` EXISTS_TAC;
41482 PROOF_BY_CONTR_TAC;
41483 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
41484 USE 7 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
41486 FULL_REWRITE_TAC[DIFF];
41487 TYPE_THEN `B u` SUBAGOAL_TAC;
41488 ASM_MESON_TAC[subset_imp];
41489 TYPE_THEN `A u` SUBAGOAL_TAC;
41490 ASM_MESON_TAC[subset_imp];
41493 (* other_direction : simple_arc_connected, connected-induced,
41494 connected-component; *)
41495 THM_INTRO_TAC[`C`;`x`;`y`] simple_arc_end_simple;
41496 THM_INTRO_TAC[`C`] simple_arc_connected;
41497 TYPE_THEN `C SUBSET euclid 2` SUBAGOAL_TAC;
41498 IMATCH_MP_TAC simple_arc_euclid;
41499 THM_INTRO_TAC[`top2`;`A`;`C`] connected_induced2;
41500 REWRITE_TAC[top2_unions];
41503 TYPE_THEN `C SUBSET A` SUBAGOAL_TAC;
41504 TYPE_THEN `A` UNABBREV_TAC;
41505 REWRITE_TAC[DIFF_SUBSET];
41508 THM_INTRO_TAC[`(ctop G)`;`C`;`x`] connected_component;
41509 IMATCH_MP_TAC simple_arc_end_end;
41511 USE 17(REWRITE_RULE[SUBSET]);
41513 FIRST_ASSUM IMATCH_MP_TAC ;
41514 IMATCH_MP_TAC simple_arc_end_end2;
41519 let ctop_comp_open = prove_by_refinement(
41520 `!G x . (FINITE G /\ G SUBSET edge ) ==>
41521 top2 (component (ctop G) x)`,
41525 THM_INTRO_TAC[`G`] ctop_top;
41526 ASSUME_TAC top2_top;
41527 THM_INTRO_TAC[`G`] curve_closed_ver2;
41528 TYPE_THEN `top2 (euclid 2 DIFF UNIONS (curve_cell G))` SUBAGOAL_TAC;
41529 USE 4 (MATCH_MP closed_open);
41530 FULL_REWRITE_TAC[top2_unions;open_DEF ];
41531 TYPE_THEN `A = euclid 2 DIFF UNIONS (curve_cell G)` ABBREV_TAC ;
41532 TYPE_THEN `UNIONS (ctop G) = A` SUBAGOAL_TAC;
41533 TYPE_THEN`A` UNABBREV_TAC;
41534 REWRITE_TAC[ctop_unions];
41535 TYPE_THEN `induced_top top2 A = ctop G` SUBAGOAL_TAC;
41538 TYPE_THEN `B = component (ctop G) x` ABBREV_TAC ;
41539 TYPE_THEN `B = EMPTY` ASM_CASES_TAC;
41540 THM_INTRO_TAC[`top2`] open_EMPTY;
41541 FULL_REWRITE_TAC[open_DEF];
41542 FULL_REWRITE_TAC[EMPTY_EXISTS];
41544 THM_INTRO_TAC[`(ctop G)`;`x`] component_imp_connected;
41545 THM_INTRO_TAC[`(top2)`;`A`;`(component (ctop G) x)`] connected_induced2;
41546 REWRITE_TAC[top2_unions];
41547 IMATCH_MP_TAC SUBSET_TRANS;
41548 TYPE_THEN `UNIONS (ctop G)` EXISTS_TAC;
41551 TYPE_THEN `A` UNABBREV_TAC;
41552 TYPE_THEN `B` UNABBREV_TAC;
41553 REWRITE_TAC[component_unions];
41554 TYPE_THEN `A` UNABBREV_TAC;
41555 REWRITE_TAC[DIFF;SUBSET];
41558 TYPE_THEN `B x /\ B u` SUBAGOAL_TAC;
41559 TYPE_THEN `B` UNABBREV_TAC;
41560 THM_INTRO_TAC[`(ctop G)`;`x`;`u`] component_replace;
41561 IMATCH_MP_TAC component_symm;
41563 ASSUME_TAC loc_path_conn_top2;
41564 TYPE_THEN `top_of_metric(A,d_euclid) = (ctop G)` SUBAGOAL_TAC;
41567 ONCE_REWRITE_TAC[EQ_SYM_EQ];
41568 IMATCH_MP_TAC top_of_metric_induced;
41569 TYPE_THEN `A` UNABBREV_TAC;
41570 REWRITE_TAC[DIFF;SUBSET];
41572 TYPE_THEN `loc_path_conn (ctop G)` SUBAGOAL_TAC;
41573 THM_INTRO_TAC[`2`;`A`] loc_path_conn_euclid;
41574 FULL_REWRITE_TAC[top2];
41577 THM_INTRO_TAC[`top2`] loc_path_conn;
41582 TYPE_THEN `A x` SUBAGOAL_TAC;
41583 ASM_MESON_TAC[subset_imp];
41584 TYPE_THEN `B` UNABBREV_TAC;
41585 ASM_MESON_TAC[path_eq_conn];
41590 let psegment_triple = jordan_def
41591 `psegment_triple A B C <=>
41592 psegment A /\ psegment B /\ psegment C /\
41593 rectagon (A UNION B) /\ rectagon (A UNION C) /\
41594 rectagon(B UNION C) /\
41595 (A INTER B = EMPTY) /\ (A INTER C = EMPTY) /\
41596 (B INTER C = EMPTY) /\
41597 (cls A INTER cls B = endpoint A) /\
41598 (cls B INTER cls C = endpoint A) /\
41599 (cls A INTER cls C = endpoint A) /\
41600 (endpoint A = endpoint B) /\ (endpoint B = endpoint C)`;;
41602 let psegment_triple3 = prove_by_refinement(
41603 `!A B C. psegment_triple A B C ==> psegment_triple B C A`,
41607 FULL_REWRITE_TAC[psegment_triple];
41608 FULL_REWRITE_TAC[UNION_COMM;INTER_COMM];
41613 let psegment_triple2 = prove_by_refinement(
41614 `!A B C. psegment_triple A B C ==> psegment_triple C B A`,
41617 FULL_REWRITE_TAC[psegment_triple];
41618 FULL_REWRITE_TAC[UNION_COMM;INTER_COMM];
41623 let unions_empty_imp_empty = prove_by_refinement(
41624 `!(A:(A->bool)->bool) B. (UNIONS A INTER UNIONS B = EMPTY) /\
41625 (!C. A C ==> ~(C = EMPTY)) ==>
41626 (A INTER B = EMPTY) `,
41629 REWRITE_TAC[EQ_EMPTY;INTER;UNIONS];
41634 let par_cell_closure = prove_by_refinement(
41636 FINITE A /\ A SUBSET edge /\ rectagon G /\
41637 A SUBSET par_cell eps G ==>
41638 (curve_cell A INTER par_cell (~eps) G = EMPTY)`,
41642 IMATCH_MP_TAC unions_empty_imp_empty;
41643 ASSUME_TAC top2_top;
41644 TYPE_THEN `(par_cell (~eps) G) = EMPTY` ASM_CASES_TAC;
41645 REWRITE_TAC[INTER_EMPTY];
41646 FULL_REWRITE_TAC[curve_cell;UNION];
41647 TYPE_THEN `C` UNABBREV_TAC;
41648 FIRST_ASSUM DISJ_CASES_TAC;
41649 FULL_REWRITE_TAC[SUBSET];
41650 TYPE_THEN `edge {}` SUBAGOAL_TAC;
41651 TYPE_THEN `cell {}` SUBAGOAL_TAC;
41652 IMATCH_MP_TAC edge_cell;
41653 USE 9 (MATCH_MP cell_nonempty);
41656 FULL_REWRITE_TAC[EQ_EMPTY;INR IN_SING ];
41659 FULL_REWRITE_TAC[EMPTY_EXISTS];
41660 TYPE_THEN `~(UNIONS (par_cell (~eps) G) = EMPTY)` SUBAGOAL_TAC;
41661 FULL_REWRITE_TAC[UNIONS;EQ_EMPTY];
41662 TYPE_THEN `~ (u = EMPTY)` SUBAGOAL_TAC;
41663 TYPE_THEN `u` UNABBREV_TAC;
41664 THM_INTRO_TAC[`G`;`~eps`] par_cell_cell;
41665 FULL_REWRITE_TAC[SUBSET];
41666 TYPE_THEN `cell {}` SUBAGOAL_TAC;
41668 USE 8 (MATCH_MP cell_nonempty);
41670 FULL_REWRITE_TAC[EMPTY_EXISTS];
41674 TYPE_THEN`closed_ top2 (euclid 2 DIFF (UNIONS (par_cell (~eps) G)))` SUBAGOAL_TAC;
41675 THM_INTRO_TAC[`top2`;`(UNIONS (par_cell (~eps) G))`] open_closed;
41676 REWRITE_TAC[open_DEF];
41677 FULL_REWRITE_TAC[EMPTY_EXISTS];
41678 THM_INTRO_TAC[`G`;`~eps`;`u'`] par_cell_union_comp;
41679 IMATCH_MP_TAC ctop_comp_open ;
41680 ASM_MESON_TAC[rectagon];
41681 FULL_REWRITE_TAC[top2_unions];
41683 THM_INTRO_TAC[`A`] curve_closure_ver2;
41684 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
41686 THM_INTRO_TAC[`A`] curve_cell_cell;
41687 USE 10 (REWRITE_RULE[SUBSET]);
41689 USE 9 (MATCH_MP cell_nonempty);
41690 FULL_REWRITE_TAC[EMPTY_EXISTS];
41693 TYPE_THEN`UNIONS (curve_cell A) SUBSET (euclid 2 DIFF UNIONS (par_cell (~eps) G))` SUBAGOAL_TAC;
41695 IMATCH_MP_TAC closure_subset;
41696 REWRITE_TAC[DIFF_SUBSET];
41698 IMATCH_MP_TAC SUBSET_TRANS;
41699 TYPE_THEN `UNIONS edge` EXISTS_TAC;
41701 IMATCH_MP_TAC UNIONS_UNIONS;
41702 REWRITE_TAC[UNIONS;SUBSET];
41703 THM_INTRO_TAC[`u'`] edge_euclid2;
41704 ASM_MESON_TAC[subset_imp];
41705 REWRITE_TAC[INTER;EQ_EMPTY];
41707 USE 11(REWRITE_RULE[UNIONS]);
41708 THM_INTRO_TAC[`par_cell (~eps) G`;`u'`;`x`] cell_ununion;
41709 TYPE_THEN`edge u'` SUBAGOAL_TAC;
41710 ASM_MESON_TAC[subset_imp];
41711 ASM_MESON_TAC [par_cell_cell;edge_cell];
41712 USE 0 (REWRITE_RULE[SUBSET]);
41714 THM_INTRO_TAC[`G`;`eps`] par_cell_disjoint;
41715 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
41718 FULL_REWRITE_TAC[DIFF_SUBSET];
41722 let cell_unions_disj = prove_by_refinement(
41723 `!U V. U SUBSET cell /\ V SUBSET cell ==> ((U INTER V = EMPTY) <=>
41724 (UNIONS U INTER UNIONS V = EMPTY))`,
41728 IMATCH_MP_TAC EQ_ANTISYM;
41730 PROOF_BY_CONTR_TAC;
41731 FULL_REWRITE_TAC[EMPTY_EXISTS];
41732 USE 3(REWRITE_RULE[INTER]);
41733 TYPE_THEN `?C. V C /\ C u` SUBAGOAL_TAC;
41734 FULL_REWRITE_TAC[UNIONS];
41736 TYPE_THEN `cell C` SUBAGOAL_TAC;
41737 ASM_MESON_TAC[subset_imp];
41738 TYPE_THEN `U C` SUBAGOAL_TAC;
41739 IMATCH_MP_TAC cell_ununion;
41741 USE 2 (REWRITE_RULE[INTER;EQ_EMPTY]);
41744 IMATCH_MP_TAC unions_empty_imp_empty;
41746 TYPE_THEN `C` UNABBREV_TAC;
41747 TYPE_THEN `cell EMPTY ` SUBAGOAL_TAC;
41748 ASM_MESON_TAC[subset_imp];
41749 ASM_MESON_TAC[cell_nonempty];
41753 let unions_curve_cell_par_cell_disj = prove_by_refinement(
41754 `!G eps. (G SUBSET edge) ==>
41755 (UNIONS (par_cell eps G) INTER UNIONS (curve_cell G) = EMPTY)`,
41759 THM_INTRO_TAC[`par_cell eps G`;`curve_cell G`] cell_unions_disj;
41760 THM_INTRO_TAC[`G`] curve_cell_cell;
41761 REWRITE_TAC[par_cell_cell];
41763 IMATCH_MP_TAC par_cell_curve_cell_disj;
41767 let par_cell_simple_arc = prove_by_refinement(
41768 `!G eps x y. rectagon G /\ ~(x = y) ==>
41769 ((UNIONS (par_cell eps G) x /\ UNIONS (par_cell eps G) y) <=>
41770 (?C. simple_arc_end C x y /\
41771 (C SUBSET (UNIONS (par_cell eps G)))) )`,
41775 IMATCH_MP_TAC EQ_ANTISYM;
41777 THM_INTRO_TAC[`G`;`eps`;`x`] par_cell_union_comp;
41778 THM_INTRO_TAC[`G`;`x`;`y`] component_simple_arc;
41779 FULL_REWRITE_TAC[rectagon];
41781 TYPE_THEN `C` EXISTS_TAC;
41783 REWRITE_TAC[SUBSET];
41784 PROOF_BY_CONTR_TAC;
41786 THM_INTRO_TAC[`C`;`x`;`y`;`x'`] simple_arc_end_cut;
41788 TYPE_THEN `x'` UNABBREV_TAC;
41790 TYPE_THEN `x'` UNABBREV_TAC;
41793 THM_INTRO_TAC[`G`;`x`;`x'`] component_simple_arc;
41794 FULL_REWRITE_TAC[rectagon];
41798 TYPE_THEN `~component (ctop G) x x'` SUBAGOAL_TAC;
41800 UND 13 THEN ASM_REWRITE_TAC[];
41801 TYPE_THEN `C'` EXISTS_TAC;
41802 FULL_REWRITE_TAC[ONCE_REWRITE_RULE[EQ_SYM_EQ]SUBSET_EMPTY];
41803 IMATCH_MP_TAC SUBSET_TRANS;
41804 TYPE_THEN `C INTER UNIONS (curve_cell G)` EXISTS_TAC;
41805 IMATCH_MP_TAC subset_inter_pair;
41806 REWRITE_TAC[SUBSET_REFL];
41807 TYPE_THEN `C` UNABBREV_TAC;
41808 REWRITE_TAC[SUBSET;UNION];
41810 TYPE_THEN `C x /\ C y` SUBAGOAL_TAC;
41811 CONJ_TAC THEN ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
41812 ASM_MESON_TAC[subset_imp];
41816 let trap_triple_seg = prove_by_refinement(
41817 `!A B C eps eps'. psegment_triple A B C /\
41818 C SUBSET par_cell (~eps) (A UNION B)
41820 (par_cell eps (A UNION B) SUBSET par_cell eps' (A UNION C) \/
41821 par_cell eps (A UNION B) SUBSET par_cell (~eps') (A UNION C))`,
41825 PROOF_BY_CONTR_TAC;
41826 USE 2 (REWRITE_RULE[SUBSET]);
41827 FULL_REWRITE_TAC[DE_MORGAN_THM];
41830 UND 2 THEN REWRITE_TAC[];
41831 PROOF_BY_CONTR_TAC;
41832 UND 3 THEN REWRITE_TAC[];
41833 PROOF_BY_CONTR_TAC;
41834 TYPE_THEN`cell x' /\ cell x` SUBAGOAL_TAC;
41835 ASM_MESON_TAC[par_cell_cell;subset_imp];
41837 TYPE_THEN `!x. cell x /\ par_cell eps (A UNION B) x ==> par_cell eps' (A UNION C) x \/ par_cell (~eps') (A UNION C) x` SUBAGOAL_TAC;
41838 THM_INTRO_TAC[`A UNION C`;`eps'`;`x''`] par_cell_cell_partition;
41839 IMATCH_MP_TAC rectagon_segment;
41840 FULL_REWRITE_TAC[psegment_triple];
41841 USE 10 (REWRITE_RULE[curve_cell_union]);
41842 UND 10 THEN REP_CASES_TAC;
41843 USE 10 (REWRITE_RULE[UNION]);
41845 FIRST_ASSUM DISJ_CASES_TAC;
41846 THM_INTRO_TAC[`A UNION B`;`eps`] par_cell_curve_cell_disj;
41847 FULL_REWRITE_TAC[psegment_triple];
41848 USE 21 (REWRITE_RULE[rectagon]);
41849 USE 12 (REWRITE_RULE[INTER;EQ_EMPTY;curve_cell_union;DE_MORGAN_THM ]);
41852 USE 12 (REWRITE_RULE[UNION;DE_MORGAN_THM ]);
41855 THM_INTRO_TAC[`A UNION B`;`C`;`~eps`;] par_cell_closure;
41856 FULL_REWRITE_TAC[psegment_triple];
41857 USE 22(REWRITE_RULE[psegment;segment]);
41858 USE 12 (REWRITE_RULE[INTER;EQ_EMPTY]);
41864 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[]);
41865 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[]);
41869 USE 6 (MATCH_MP cell_nonempty);
41870 USE 7(MATCH_MP cell_nonempty);
41871 FULL_REWRITE_TAC[EMPTY_EXISTS];
41872 TYPE_THEN `UNIONS (par_cell eps (A UNION B)) u /\ UNIONS (par_cell eps (A UNION B)) u'` SUBAGOAL_TAC;
41873 REWRITE_TAC[UNIONS];
41876 TYPE_THEN `u = u'` ASM_CASES_TAC;
41877 TYPE_THEN `u'` UNABBREV_TAC;
41878 TYPE_THEN `cell x /\ cell x'` SUBAGOAL_TAC;
41879 ASM_MESON_TAC[par_cell_cell;subset_imp];
41880 TYPE_THEN `x = x'` SUBAGOAL_TAC;
41881 IMATCH_MP_TAC cell_partition;
41882 REWRITE_TAC[INTER;EMPTY_EXISTS];
41884 TYPE_THEN `x'` UNABBREV_TAC;
41887 THM_INTRO_TAC[`A UNION B`;`eps`;`u`;`u'`]par_cell_simple_arc;
41888 FULL_REWRITE_TAC[psegment_triple];
41891 TYPE_THEN `C' INTER UNIONS (curve_cell A) = EMPTY` SUBAGOAL_TAC;
41892 REWRITE_TAC [ONCE_REWRITE_RULE [EQ_SYM_EQ] SUBSET_EMPTY];
41893 IMATCH_MP_TAC SUBSET_TRANS;
41894 TYPE_THEN `C' INTER UNIONS (curve_cell (A UNION B))` EXISTS_TAC;
41896 IMATCH_MP_TAC subset_inter_pair;
41897 REWRITE_TAC[SUBSET_REFL;curve_cell_union;UNIONS_UNION];
41898 REWRITE_TAC[SUBSET;UNION];
41899 IMATCH_MP_TAC SUBSET_TRANS;
41900 TYPE_THEN `UNIONS (par_cell eps (A UNION B)) INTER UNIONS (curve_cell (A UNION B))` EXISTS_TAC;
41902 IMATCH_MP_TAC subset_inter_pair;
41903 REWRITE_TAC[SUBSET_REFL];
41904 REWRITE_TAC[SUBSET_EMPTY];
41905 IMATCH_MP_TAC unions_curve_cell_par_cell_disj ;
41906 FULL_REWRITE_TAC[psegment_triple];
41907 USE 24 (REWRITE_RULE[rectagon]);
41909 THM_INTRO_TAC[`A UNION B`;`C`;`~eps`] par_cell_closure;
41910 FULL_REWRITE_TAC[psegment_triple];
41911 USE 26(REWRITE_RULE[psegment;segment]);
41913 THM_INTRO_TAC[`curve_cell C`;`par_cell eps (A UNION B)`] cell_unions_disj;
41915 IMATCH_MP_TAC curve_cell_cell;
41916 FULL_REWRITE_TAC[psegment_triple];
41917 USE 27(REWRITE_RULE[psegment;segment]);
41918 REWRITE_TAC[par_cell_cell];
41920 TYPE_THEN `UNIONS (curve_cell C) INTER C' = EMPTY` SUBAGOAL_TAC ;
41921 REWRITE_TAC [ONCE_REWRITE_RULE [EQ_SYM_EQ] SUBSET_EMPTY];
41923 IMATCH_MP_TAC subset_inter_pair;
41924 REWRITE_TAC[SUBSET_REFL];
41926 TYPE_THEN `C' INTER UNIONS (curve_cell (A UNION C)) = EMPTY` SUBAGOAL_TAC;
41927 REWRITE_TAC[curve_cell_union;UNIONS_UNION];
41928 REWRITE_TAC[UNION_OVER_INTER; UNION_EMPTY];
41929 REWRITE_TAC[UNION_EMPTY];
41930 ONCE_REWRITE_TAC[INTER_COMM];
41932 THM_INTRO_TAC[`A UNION C`;`u`;`u'`] component_simple_arc;
41933 FULL_REWRITE_TAC[psegment_triple];
41934 USE 28(REWRITE_RULE[rectagon]);
41936 TYPE_THEN `component (ctop (A UNION C)) u u'` SUBAGOAL_TAC;
41937 TYPE_THEN `C'` EXISTS_TAC;
41939 TYPE_THEN `UNIONS (par_cell (eps') (A UNION C)) u'` SUBAGOAL_TAC;
41940 REWRITE_TAC[UNIONS];
41942 TYPE_THEN `UNIONS (par_cell (~eps') (A UNION C)) u` SUBAGOAL_TAC;
41943 REWRITE_TAC[UNIONS];
41946 THM_INTRO_TAC [`A UNION C`;`eps'`] par_cell_union_disjoint;
41947 THM_INTRO_TAC[`A UNION C`;`eps'`;`u'`] par_cell_union_comp;
41948 FULL_REWRITE_TAC[psegment_triple];
41949 THM_INTRO_TAC[`A UNION C`;`~eps'`;`u`] par_cell_union_comp;
41950 FULL_REWRITE_TAC[psegment_triple];
41951 TYPE_THEN `UNIONS (par_cell (~eps') (A UNION C))` UNABBREV_TAC;
41952 TYPE_THEN `UNIONS (par_cell eps' (A UNION C))` UNABBREV_TAC;
41953 USE 25 (REWRITE_RULE[INTER;EQ_EMPTY]);
41959 let parity_even_cell = prove_by_refinement(
41960 `!G m. (rectagon G) ==> (parity G (squ m) = even_cell G (squ m))`,
41964 THM_INTRO_TAC[`G`;`m`] parity_squ;
41965 IMATCH_MP_TAC rectagon_segment;
41966 REWRITE_TAC[parity_squ;even_cell_squ];
41970 let par_cell_squ_neg = prove_by_refinement(
41971 `!G m eps. segment G ==>
41972 (par_cell (~eps) G (squ m) <=> ~(par_cell eps G (squ m)))`,
41976 IMATCH_MP_TAC EQ_ANTISYM;
41978 THM_INTRO_TAC[`G`;`eps`] par_cell_disjoint;
41979 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
41981 THM_INTRO_TAC[`G`;`eps`;`squ m`] par_cell_cell_partition;
41982 REWRITE_TAC[cell_rules];
41983 ASM_MESON_TAC[curve_cell_squ];
41987 let triple_par_cell_distinct = prove_by_refinement(
41988 `!A B C eps eps'. psegment_triple A B C ==>
41989 ~(par_cell eps (A UNION B) = par_cell eps' (A UNION C))`,
41993 TYPE_THEN `s = (eps = eps')` ABBREV_TAC ;
41994 TYPE_THEN `!m. (parity (A UNION B) (squ m) = parity(A UNION C) (squ m)) = s` SUBAGOAL_TAC;
41995 TYPE_THEN `s` UNABBREV_TAC;
41996 REWRITE_TAC[EQ_SYM_EQ];
41997 ONCE_REWRITE_TAC[eq_pair_exchange];
41998 TYPE_THEN `eps = parity (A UNION B) (squ m)` ASM_CASES_TAC;
41999 IMATCH_MP_TAC parity_unique;
42002 FULL_REWRITE_TAC[psegment_triple];
42003 IMATCH_MP_TAC rectagon_segment;
42004 IMATCH_MP_TAC parity;
42005 REWRITE_TAC[cell_rules;];
42007 FULL_REWRITE_TAC[psegment_triple];
42008 IMATCH_MP_TAC rectagon_segment;
42009 ASM_MESON_TAC[curve_cell_squ];
42011 TYPE_THEN `!m. par_cell (~eps) (A UNION B) (squ m) = par_cell (~eps') (A UNION C) (squ m)` SUBAGOAL_TAC;
42012 TYPE_THEN `segment (A UNION B) /\ segment(A UNION C)` SUBAGOAL_TAC;
42013 FULL_REWRITE_TAC[psegment_triple];
42014 CONJ_TAC THEN IMATCH_MP_TAC rectagon_segment;
42015 ASM_SIMP_TAC [par_cell_squ_neg];
42016 TYPE_THEN `~eps = parity (A UNION B) (squ m)` SUBAGOAL_TAC;
42019 TYPE_THEN `~(~eps' = parity (A UNION C) (squ m))` SUBAGOAL_TAC;
42020 TYPE_THEN `eps'` UNABBREV_TAC;
42023 UND 2 THEN REWRITE_TAC[];
42024 IMATCH_MP_TAC parity_unique;
42028 FULL_REWRITE_TAC[psegment_triple];
42029 IMATCH_MP_TAC rectagon_segment;
42030 IMATCH_MP_TAC parity;
42031 REWRITE_TAC[cell_rules;];
42033 FULL_REWRITE_TAC[psegment_triple];
42034 IMATCH_MP_TAC rectagon_segment;
42035 ASM_MESON_TAC[curve_cell_squ];
42037 THM_INTRO_TAC[`A UNION B`] parity_even_cell;
42039 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[]);
42040 FULL_REWRITE_TAC[psegment_triple];
42042 THM_INTRO_TAC[`A UNION C`] parity_even_cell;
42044 UND 5 THEN DISCH_THEN (THM_INTRO_TAC[]);
42045 FULL_REWRITE_TAC[psegment_triple];
42048 TYPE_THEN `?e. B e /\ ~C e /\ ~A e` SUBAGOAL_TAC;
42049 TYPE_THEN `~(B = EMPTY)` SUBAGOAL_TAC ;
42050 TYPE_THEN `B` UNABBREV_TAC;
42051 FULL_REWRITE_TAC[psegment_triple];
42052 USE 17( REWRITE_RULE[psegment;segment]);
42053 FULL_REWRITE_TAC[EMPTY_EXISTS];
42054 TYPE_THEN `u` EXISTS_TAC;
42055 REWRITE_TAC[GSYM DE_MORGAN_THM];
42056 FULL_REWRITE_TAC[psegment_triple];
42057 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
42060 TYPE_THEN `edge e` SUBAGOAL_TAC;
42061 FULL_REWRITE_TAC[psegment_triple];
42062 USE 20 (REWRITE_RULE[psegment;segment]);
42063 ASM_MESON_TAC[subset_imp];
42064 FULL_REWRITE_TAC[edge];
42065 TYPE_THEN `rectagon (A UNION B) /\ rectagon (A UNION C)` SUBAGOAL_TAC;
42066 FULL_REWRITE_TAC[psegment_triple];
42072 TYPE_THEN `~(A UNION C) e /\ (A UNION B) e` SUBAGOAL_TAC;
42073 ASM_REWRITE_TAC[UNION];
42074 FIRST_ASSUM DISJ_CASES_TAC;
42075 TYPE_THEN `e` UNABBREV_TAC;
42076 THM_INTRO_TAC[`(A UNION B)`;`m`] squ_left_odd;
42077 THM_INTRO_TAC[`(A UNION C)`;`m`] squ_left_even;
42079 TYPE_THEN `e` UNABBREV_TAC;
42080 THM_INTRO_TAC[`A UNION B`;`m`] squ_down;
42081 FULL_REWRITE_TAC[rectagon];
42082 THM_INTRO_TAC[`A UNION C`;`m`] squ_down;
42083 FULL_REWRITE_TAC[rectagon];
42084 FULL_REWRITE_TAC[set_lower_n];
42089 let triple_in_comp = prove_by_refinement(
42090 `!A B C eps. psegment_triple A B C /\
42091 ~(C SUBSET par_cell eps (A UNION B)) ==>
42092 (C SUBSET par_cell (~eps) (A UNION B)) `,
42096 THM_INTRO_TAC[`(A UNION B)`;`C`] segment_in_comp;
42097 FULL_REWRITE_TAC[psegment_triple];
42098 USE 12 (REWRITE_RULE[psegment]);
42099 REWRITE_TAC[cls_union;];
42101 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
42102 ONCE_REWRITE_TAC[INTER_COMM];
42103 ONCE_REWRITE_TAC[INTER_COMM];
42104 REWRITE_TAC[UNION_OVER_INTER];
42105 REWRITE_TAC[union_subset];
42106 TYPE_THEN `endpoint A` UNABBREV_TAC;
42107 TYPE_THEN `endpoint B` UNABBREV_TAC;
42108 TYPE_THEN `endpoint C` UNABBREV_TAC;
42109 FULL_REWRITE_TAC[INTER_COMM];
42110 REWRITE_TAC[SUBSET_REFL];
42111 TYPE_THEN `eps' = eps` ASM_CASES_TAC;
42112 TYPE_THEN`eps'` UNABBREV_TAC;
42114 TYPE_THEN `eps' = ~eps` SUBAGOAL_TAC;
42116 TYPE_THEN `eps'` UNABBREV_TAC;
42120 let trap_odd_cell = prove_by_refinement(
42121 `!A B C. psegment_triple A B C ==>
42122 (A SUBSET par_cell F (B UNION C)) \/
42123 (B SUBSET par_cell F (A UNION C)) \/
42124 (C SUBSET par_cell F (A UNION B))`,
42129 PROOF_BY_CONTR_TAC;
42130 FULL_REWRITE_TAC[DE_MORGAN_THM];
42131 TYPE_THEN `C SUBSET par_cell (~F) (A UNION B)` SUBAGOAL_TAC THENL[IMATCH_MP_TAC triple_in_comp;ALL_TAC];
42132 TYPE_THEN `A SUBSET par_cell (~F) (B UNION C)` SUBAGOAL_TAC THENL[IMATCH_MP_TAC triple_in_comp;ALL_TAC];
42133 IMATCH_MP_TAC psegment_triple3;
42134 TYPE_THEN `B SUBSET par_cell (~F) (C UNION A)` SUBAGOAL_TAC THENL[IMATCH_MP_TAC triple_in_comp;ALL_TAC];
42136 IMATCH_MP_TAC psegment_triple3;
42137 IMATCH_MP_TAC psegment_triple3;
42138 USE 6(ONCE_REWRITE_RULE[UNION_COMM]);
42140 FULL_REWRITE_TAC[];
42142 TYPE_THEN `!A B. psegment_triple A B C /\ (C SUBSET par_cell T (A UNION B)) /\ (A SUBSET par_cell T (B UNION C)) ==> (par_cell F (A UNION B) SUBSET par_cell T (B UNION C))` SUBAGOAL_TAC;
42143 THM_INTRO_TAC[`B'`;`A'`;`C`;`F`;`T`] trap_triple_seg;
42144 FULL_REWRITE_TAC[UNION_COMM];
42145 IMATCH_MP_TAC psegment_triple3;
42146 IMATCH_MP_TAC psegment_triple2;
42147 FULL_REWRITE_TAC[UNION_COMM];
42148 FIRST_ASSUM DISJ_CASES_TAC;
42149 THM_INTRO_TAC[`B'`;`C`;`A'`;`F`;`F`] trap_triple_seg;
42150 IMATCH_MP_TAC psegment_triple3;
42151 FIRST_ASSUM DISJ_CASES_TAC;
42152 FULL_REWRITE_TAC[UNION_COMM];
42153 TYPE_THEN `par_cell F (B' UNION C) = par_cell F (A' UNION B')` SUBAGOAL_TAC;
42154 IMATCH_MP_TAC SUBSET_ANTISYM;
42155 THM_INTRO_TAC[`B'`;`A'`;`C`;`F`;`F`] triple_par_cell_distinct;
42156 IMATCH_MP_TAC psegment_triple3;
42157 IMATCH_MP_TAC psegment_triple2;
42158 FULL_REWRITE_TAC[UNION_COMM];
42161 TYPE_THEN `par_cell F (B' UNION A') SUBSET par_cell T (B' UNION A')` SUBAGOAL_TAC;
42162 FULL_REWRITE_TAC[UNION_COMM];
42163 IMATCH_MP_TAC SUBSET_TRANS;
42164 TYPE_THEN `par_cell F (B' UNION C)` EXISTS_TAC;
42166 THM_INTRO_TAC[`A' UNION B'`;`F` ] par_cell_nonempty;
42167 USE 9(REWRITE_RULE[psegment_triple]);
42168 FULL_REWRITE_TAC[EMPTY_EXISTS];
42169 THM_INTRO_TAC[`A' UNION B'`;`F`] par_cell_disjoint;
42170 FULL_REWRITE_TAC[EQ_EMPTY;INTER];
42173 USE 14(REWRITE_RULE[SUBSET]);
42174 FULL_REWRITE_TAC[UNION_COMM];
42178 UND 7 THEN DISCH_THEN (THM_INTRO_TAC[`A`;`B`]);
42179 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[`B`;`A`]);
42180 FULL_REWRITE_TAC[UNION_COMM];
42181 IMATCH_MP_TAC psegment_triple3;
42182 IMATCH_MP_TAC psegment_triple2;
42184 FULL_REWRITE_TAC[UNION_COMM];
42185 THM_INTRO_TAC[`A UNION B`;`F`] par_cell_nonempty;
42186 FULL_REWRITE_TAC[psegment_triple];
42187 FULL_REWRITE_TAC[EMPTY_EXISTS];
42188 THM_INTRO_TAC[`A UNION B`;`u`;`F`] parity_unique;
42189 FULL_REWRITE_TAC[psegment_triple];
42190 IMATCH_MP_TAC rectagon_segment;
42191 TYPE_THEN `par_cell T (A UNION C) u /\ par_cell T (B UNION C) u` SUBAGOAL_TAC;
42192 ASM_MESON_TAC[subset_imp];
42193 THM_INTRO_TAC[`A UNION C`;`u`;`T`] parity_unique;
42194 FULL_REWRITE_TAC[psegment_triple];
42195 IMATCH_MP_TAC rectagon_segment;
42196 THM_INTRO_TAC[`B UNION C`;`u`;`T`] parity_unique;
42197 FULL_REWRITE_TAC[psegment_triple];
42198 IMATCH_MP_TAC rectagon_segment;
42200 TYPE_THEN `cell u` SUBAGOAL_TAC;
42201 ASM_MESON_TAC[par_cell_cell;subset_imp];
42202 TYPE_THEN `!A B eps. rectagon (A UNION B) /\ (par_cell eps (A UNION B) u) ==> ~curve_cell A u` SUBAGOAL_TAC;
42203 THM_INTRO_TAC[`A' UNION B'`;`eps`] par_cell_curve_cell_disj;
42204 FULL_REWRITE_TAC[rectagon];
42205 FULL_REWRITE_TAC[EQ_EMPTY;INTER];
42207 USE 19 (REWRITE_RULE[curve_cell_union;DE_MORGAN_THM ]);
42208 FIRST_ASSUM DISJ_CASES_TAC;
42210 USE 20 (REWRITE_RULE[UNION]);
42213 TYPE_THEN `segment A /\ segment B /\ segment C /\ segment (A UNION B) /\ segment (B UNION C) /\ segment (A UNION C) /\ (A INTER B = EMPTY) /\ (B INTER C = EMPTY) /\ (A INTER C = EMPTY)` SUBAGOAL_TAC;
42214 FULL_REWRITE_TAC[psegment_triple];
42215 FULL_REWRITE_TAC[psegment];
42216 FULL_REWRITE_TAC[UNION_COMM];
42217 REPEAT CONJ_TAC THEN (IMATCH_MP_TAC rectagon_segment);
42219 THM_INTRO_TAC[`A`;`B`;`u`] parity_union;
42220 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
42221 TYPE_THEN `B` EXISTS_TAC;
42222 TYPE_THEN `F` EXISTS_TAC;
42223 FULL_REWRITE_TAC[psegment_triple];
42224 TYPE_THEN `A` EXISTS_TAC;
42226 TYPE_THEN `F` EXISTS_TAC;
42227 FULL_REWRITE_TAC[UNION_COMM];
42228 FULL_REWRITE_TAC[psegment_triple];
42230 THM_INTRO_TAC[`B`;`C`;`u`] parity_union;
42231 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
42232 TYPE_THEN `C` EXISTS_TAC;
42233 TYPE_THEN `T` EXISTS_TAC;
42234 FULL_REWRITE_TAC[psegment_triple];
42235 TYPE_THEN `B` EXISTS_TAC;
42236 TYPE_THEN `T` EXISTS_TAC;
42237 FULL_REWRITE_TAC[UNION_COMM];
42238 FULL_REWRITE_TAC[psegment_triple];
42240 THM_INTRO_TAC[`A`;`C`;`u`] parity_union;
42241 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
42242 TYPE_THEN `C` EXISTS_TAC;
42243 TYPE_THEN `T` EXISTS_TAC;
42244 FULL_REWRITE_TAC[psegment_triple];
42245 TYPE_THEN `A` EXISTS_TAC;
42246 TYPE_THEN `T` EXISTS_TAC;
42247 FULL_REWRITE_TAC[UNION_COMM];
42248 FULL_REWRITE_TAC[psegment_triple];
42256 (* ------------------------------------------------------------------ *)
42258 (* ------------------------------------------------------------------ *)
42260 (* -- more on 2-connectedness, etc. *)
42262 let euclid_diff_par_cell = prove_by_refinement(
42263 `!G eps. (segment G) ==>
42264 (euclid 2 DIFF UNIONS(par_cell (~eps) G) =
42265 UNIONS(par_cell eps G) UNION UNIONS (curve_cell G))`,
42269 IMATCH_MP_TAC EQ_EXT;
42270 REWRITE_TAC[DIFF;UNION];
42271 IMATCH_MP_TAC EQ_ANTISYM;
42273 PROOF_BY_CONTR_TAC;
42274 USE 3(REWRITE_RULE[DE_MORGAN_THM]);
42275 TYPE_THEN `UNIONS (ctop G) x` SUBAGOAL_TAC;
42276 ASM_REWRITE_TAC[ctop_unions;DIFF];
42278 THM_INTRO_TAC[`G`;`eps`] par_cell_partition;
42281 FULL_REWRITE_TAC[UNION];
42285 USE 1(REWRITE_RULE[UNIONS]);
42287 THM_INTRO_TAC[`u`] cell_euclid;
42288 THM_INTRO_TAC[`G`;`eps`] par_cell_cell;
42289 THM_INTRO_TAC[`G`] curve_cell_cell;
42290 FULL_REWRITE_TAC[segment];
42291 ASM_MESON_TAC[subset_imp];
42292 ASM_MESON_TAC[subset_imp];
42294 THM_INTRO_TAC[`G`;`eps`] par_cell_union_disjoint;
42295 USE 3(REWRITE_RULE[INTER;EQ_EMPTY]);
42296 FIRST_ASSUM DISJ_CASES_TAC;
42299 THM_INTRO_TAC[`G`] ctop_unions;
42300 USE 5 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
42302 FULL_REWRITE_TAC[DIFF];
42303 TYPE_THEN `~UNIONS (ctop G )x` SUBAGOAL_TAC;
42305 THM_INTRO_TAC[`G`;`eps`] par_cell_partition;
42306 USE 7 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
42307 FULL_REWRITE_TAC[UNION];
42312 let par_cell_closure_cell = prove_by_refinement(
42314 cell C /\ cell d /\ rectagon G /\ (d SUBSET closure top2 C) /\
42315 par_cell eps G C ==>
42316 (par_cell eps G d \/ curve_cell G d)`,
42320 ASSUME_TAC top2_top;
42321 TYPE_THEN`closed_ top2 (euclid 2 DIFF (UNIONS (par_cell (~eps) G)))` SUBAGOAL_TAC;
42322 THM_INTRO_TAC[`top2`;`(UNIONS (par_cell (~eps) G))`] open_closed;
42323 REWRITE_TAC[open_DEF];
42324 TYPE_THEN `UNIONS (par_cell (~eps) G) = EMPTY ` ASM_CASES_TAC;
42325 USE 5 (MATCH_MP (REWRITE_RULE[open_DEF]open_EMPTY));
42326 FULL_REWRITE_TAC[EMPTY_EXISTS];
42327 THM_INTRO_TAC[`G`;`~eps`;`u`] par_cell_union_comp;
42328 IMATCH_MP_TAC ctop_comp_open ;
42329 ASM_MESON_TAC[rectagon];
42330 FULL_REWRITE_TAC[top2_unions];
42331 THM_INTRO_TAC[`G`;`eps`] euclid_diff_par_cell;
42332 IMATCH_MP_TAC rectagon_segment;
42336 TYPE_THEN `closure top2 C SUBSET (UNIONS (par_cell eps G) UNION UNIONS (curve_cell G))` SUBAGOAL_TAC;
42337 IMATCH_MP_TAC closure_subset;
42338 IMATCH_MP_TAC in_union;
42340 IMATCH_MP_TAC sub_union;
42342 TYPE_THEN `d SUBSET UNIONS (par_cell eps G) UNION UNIONS (curve_cell G)` SUBAGOAL_TAC;
42343 IMATCH_MP_TAC SUBSET_TRANS;
42345 FULL_REWRITE_TAC[GSYM UNIONS_UNION];
42347 THM_INTRO_TAC[`d`] cell_nonempty;
42348 FULL_REWRITE_TAC[EMPTY_EXISTS];
42350 THM_INTRO_TAC[`par_cell eps G UNION curve_cell G`;`d`;`u`] cell_ununion;
42352 REWRITE_TAC[union_subset];
42353 REWRITE_TAC [par_cell_cell];
42354 THM_INTRO_TAC[`G`] curve_cell_cell;
42355 FULL_REWRITE_TAC[rectagon];
42356 REWRITE_TAC[UNIONS;UNION];
42357 USE 8(REWRITE_RULE[SUBSET;UNIONS]);
42359 USE 8 (REWRITE_RULE[UNION]);
42360 TYPE_THEN `u'` EXISTS_TAC;
42362 FULL_REWRITE_TAC[UNION];
42363 (* Thu Dec 2 09:50:25 EST 2004 *)
42367 let rectagon_curve = prove_by_refinement(
42368 `!G C a b. FINITE G /\ G SUBSET edge /\ simple_arc_end C a b /\
42369 (C INTER UNIONS (curve_cell G) = EMPTY) ==>
42370 (C SUBSET (component (ctop G) a))`,
42374 REWRITE_TAC[SUBSET];
42375 TYPE_THEN `a = x` ASM_CASES_TAC;
42376 TYPE_THEN `x` UNABBREV_TAC;
42377 IMATCH_MP_TAC component_refl;
42378 FULL_REWRITE_TAC[ctop_unions;DIFF;EQ_EMPTY ;INTER ];
42380 USE 1 (MATCH_MP simple_arc_end_simple);
42381 USE 1 (MATCH_MP simple_arc_euclid);
42382 ASM_MESON_TAC[subset_imp];
42385 THM_INTRO_TAC[`G`;`a`;`x`] component_simple_arc;
42386 TYPE_THEN `x = b` ASM_CASES_TAC;
42387 TYPE_THEN `C` EXISTS_TAC;
42389 THM_INTRO_TAC[`C`;`a`;`b`;`x`] simple_arc_end_cut;
42390 TYPE_THEN `C'` EXISTS_TAC;
42391 TYPE_THEN `C` UNABBREV_TAC;
42392 FULL_REWRITE_TAC[GSYM SUBSET_EMPTY];
42393 IMATCH_MP_TAC SUBSET_TRANS;
42394 TYPE_THEN `(C' UNION C'') INTER UNIONS (curve_cell G)` EXISTS_TAC;
42395 IMATCH_MP_TAC subset_inter_pair;
42396 REWRITE_TAC[SUBSET_REFL];
42397 REWRITE_TAC[SUBSET;UNION];
42398 (* Thu Dec 2 10:11:45 EST 2004 *)
42404 let star_avoidance_lemma1 = prove_by_refinement(
42405 `!E E' R B x. bounded_set E x /\ E SUBSET E' /\ FINITE E' /\
42406 E' SUBSET edge /\ rectagon R /\ R SUBSET E /\
42407 ~(UNIONS (curve_cell B) x) /\
42408 B SUBSET par_cell F R /\ ~(UNIONS (curve_cell E') x) ==>
42409 (bounded_set (E' DIFF B) x \/ unbounded_set (E' DIFF B) x)`,
42413 THM_INTRO_TAC[`ctop E`;`x`] component_empty;
42414 REWRITE_TAC[ctop_top];
42416 TYPE_THEN `UNIONS (ctop E) x` SUBAGOAL_TAC;
42417 USE 9 (ONCE_REWRITE_RULE[ONCE_REWRITE_RULE[EQ_SYM_EQ] not_eq]);
42418 FULL_REWRITE_TAC[EMPTY_EXISTS;bounded_set];
42422 TYPE_THEN `UNIONS (ctop (E' DIFF B)) x` SUBAGOAL_TAC;
42423 REWRITE_TAC[ctop_unions];
42424 TYPE_THEN `E'' = E' DIFF B` ABBREV_TAC ;
42427 USE 10(REWRITE_RULE[ctop_unions;DIFF]);
42428 TYPE_THEN `E' = E'' UNION E'` SUBAGOAL_TAC;
42429 IMATCH_MP_TAC EQ_EXT;
42430 TYPE_THEN `E''` UNABBREV_TAC;
42431 REWRITE_TAC[DIFF;UNION];
42433 THM_INTRO_TAC[`E''`;`E'`] curve_cell_union;
42436 TYPE_THEN `UNIONS (curve_cell E') = UNIONS (curve_cell E'') UNION UNIONS(curve_cell E')` SUBAGOAL_TAC;
42437 REWRITE_TAC[GSYM UNIONS_UNION];
42440 USE 14(ONCE_REWRITE_RULE[FUN_EQ_THM]);
42442 USE 14(REWRITE_RULE[UNION]);
42445 THM_INTRO_TAC[`E' DIFF B`] bounded_unbounded_union;
42446 USE 11(ONCE_REWRITE_RULE[FUN_EQ_THM]);
42449 USE 11(REWRITE_RULE[UNION]);
42454 let curve_cell_imp_subset = prove_by_refinement(
42455 `!A B. A SUBSET B ==> curve_cell A SUBSET curve_cell B`,
42459 TYPE_THEN `B = A UNION (B DIFF A)` SUBAGOAL_TAC;
42460 IMATCH_MP_TAC EQ_EXT;
42461 FULL_REWRITE_TAC [UNION;DIFF;SUBSET ];
42463 TYPE_THEN `C = B DIFF A` ABBREV_TAC ;
42464 REWRITE_TAC[curve_cell_union];
42465 REWRITE_TAC[SUBSET;UNION];
42469 let unbound_set_x_axis = prove_by_refinement(
42470 `!G. (FINITE G /\ G SUBSET edge ) ==>
42471 (?r. !s. (r <= s) ==> unbounded_set G (point(s,&0)))`,
42475 REWRITE_TAC[unbounded_set;unbounded;];
42479 THM_INTRO_TAC[`G`] unbounded_set_nonempty;
42480 FULL_REWRITE_TAC[EMPTY_EXISTS;unbounded_set;unbounded];
42481 TYPE_THEN `r` EXISTS_TAC;
42482 TYPE_THEN `(\ (s:real). r)` EXISTS_TAC;
42486 USE 4 (MATCH_MP component_symm);
42487 USE 4 (MATCH_MP component_replace);
42492 let star_avoidance = prove_by_refinement(
42493 `!E E' R B x. unbounded_set (E' DIFF B) x /\ E SUBSET E' /\ FINITE E' /\
42494 E' SUBSET edge /\ rectagon R /\ R SUBSET E /\
42495 FINITE B /\ B SUBSET edge /\
42496 ~(UNIONS (curve_cell B) x) /\
42497 B SUBSET par_cell F R /\ ~(UNIONS (curve_cell E') x) ==>
42498 ( unbounded_set (E) x)`,
42502 TYPE_THEN `E'' = E' DIFF B` ABBREV_TAC ;
42503 RULE_ASSUM_TAC (REWRITE_RULE[unbounded_set;unbounded]);
42505 THM_INTRO_TAC[`R`] unbound_set_x_axis;
42506 FULL_REWRITE_TAC[rectagon];
42508 TYPE_THEN `?r. !s. (r <= s) ==> component (ctop E'') x (point(s,&0)) /\ ~(x = (point(s,&0))) /\ unbounded_set R (point(s,&0)) ` SUBAGOAL_TAC;
42509 TYPE_THEN `r'' = &1 + (||. r') + (||. r) + ||. (x 0)` ABBREV_TAC ;
42510 TYPE_THEN `r''` EXISTS_TAC;
42511 TYPE_THEN `r <= s` SUBAGOAL_TAC;
42512 UNDF `r'' <= s` THEN UND 13 THEN REAL_ARITH_TAC;
42514 TYPE_THEN `x` UNABBREV_TAC;
42515 FULL_REWRITE_TAC[coord01];
42516 UND 13 THEN UND 14 THEN REAL_ARITH_TAC;
42517 FIRST_ASSUM IMATCH_MP_TAC ;
42518 UND 13 THEN UND 14 THEN REAL_ARITH_TAC;
42522 TYPE_THEN `FINITE E'' /\ E'' SUBSET edge` SUBAGOAL_TAC;
42523 TYPE_THEN `E''` UNABBREV_TAC;
42525 IMATCH_MP_TAC FINITE_DIFF;
42526 IMATCH_MP_TAC SUBSET_TRANS;
42528 REWRITE_TAC[SUBSET_DIFF];
42530 TYPE_THEN `!s. ?C. (r'' <= s) ==> (simple_arc_end C x (point(s,&0)) /\ (C INTER UNIONS (curve_cell E'') = {}))` SUBAGOAL_TAC;
42533 THM_INTRO_TAC[`E''`;`x`;`point(s,&0)`] component_simple_arc;
42536 REWRITE_TAC[unbounded_set;unbounded];
42537 TYPE_THEN `r''` EXISTS_TAC;
42540 THM_INTRO_TAC[`E`;`x`;`point(s,&0)`] component_simple_arc;
42542 IMATCH_MP_TAC FINITE_SUBSET;
42544 IMATCH_MP_TAC SUBSET_TRANS;
42546 TYPE_THEN `C` EXISTS_TAC;
42548 TYPE_THEN `R SUBSET E''` SUBAGOAL_TAC;
42549 TYPE_THEN `E''` UNABBREV_TAC;
42550 REWRITE_TAC[DIFF_SUBSET];
42552 IMATCH_MP_TAC SUBSET_TRANS;
42554 PROOF_BY_CONTR_TAC;
42555 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
42556 THM_INTRO_TAC[`R`;`F`] par_cell_curve_cell_disj;
42557 FULL_REWRITE_TAC[rectagon];
42558 USE 21(REWRITE_RULE[INTER;EQ_EMPTY]);
42560 UND 21 THEN ASM_REWRITE_TAC[];
42562 ASM_MESON_TAC[subset_imp];
42563 ASM_MESON_TAC[curve_cell_subset;subset_imp];
42565 TYPE_THEN `C INTER UNIONS(curve_cell R) = EMPTY` SUBAGOAL_TAC;
42566 FULL_REWRITE_TAC[GSYM SUBSET_EMPTY];
42567 IMATCH_MP_TAC SUBSET_TRANS;
42568 TYPE_THEN `C INTER UNIONS (curve_cell E'')` EXISTS_TAC;
42569 IMATCH_MP_TAC subset_inter_pair;
42570 REWRITE_TAC[SUBSET_REFL];
42571 IMATCH_MP_TAC UNIONS_UNIONS;
42572 IMATCH_MP_TAC curve_cell_imp_subset;
42574 THM_INTRO_TAC[`R`;`C`;`x`;`point(s,&0)`] rectagon_curve;
42575 FULL_REWRITE_TAC[rectagon];
42577 THM_INTRO_TAC[`R`]unbounded_set_comp;
42578 FULL_REWRITE_TAC[rectagon];
42579 TYPE_THEN `component (ctop R) x' = component (ctop R) (point(s,&0))` SUBAGOAL_TAC;
42580 IMATCH_MP_TAC component_replace;
42583 TYPE_THEN `component (ctop R) x'` UNABBREV_TAC;
42584 TYPE_THEN `component (ctop R) x = component (ctop R) (point(s,&0))` SUBAGOAL_TAC;
42585 IMATCH_MP_TAC component_replace;
42586 USE 22(REWRITE_RULE[SUBSET]);
42587 FIRST_ASSUM IMATCH_MP_TAC ;
42588 IMATCH_MP_TAC simple_arc_end_end2;
42591 THM_INTRO_TAC[`R`;`B`;`F`] par_cell_closure;
42593 TYPE_THEN `C INTER UNIONS (curve_cell B) = EMPTY` SUBAGOAL_TAC;
42594 FULL_REWRITE_TAC[GSYM SUBSET_EMPTY ];
42595 IMATCH_MP_TAC SUBSET_TRANS;
42596 TYPE_THEN `UNIONS (par_cell T R) INTER UNIONS (curve_cell B)` EXISTS_TAC;
42598 IMATCH_MP_TAC subset_inter_pair;
42599 REWRITE_TAC[SUBSET_REFL];
42600 THM_INTRO_TAC[`R`] unbounded_even;
42603 ONCE_REWRITE_TAC[INTER_COMM];
42604 FULL_REWRITE_TAC[SUBSET_EMPTY ];
42605 THM_INTRO_TAC[`curve_cell B`;`par_cell T R`] cell_unions_disj;
42606 THM_INTRO_TAC[`B`]curve_cell_cell;
42607 THM_INTRO_TAC[`R`]par_cell_cell;
42608 USE 26 (ONCE_REWRITE_RULE[EQ_SYM_EQ]);
42611 TYPE_THEN `E SUBSET E'' UNION B` SUBAGOAL_TAC;
42612 TYPE_THEN `E''` UNABBREV_TAC;
42613 REWRITE_TAC[SUBSET;DIFF;UNION];
42614 ASM_MESON_TAC[subset_imp];
42616 FULL_REWRITE_TAC[GSYM SUBSET_EMPTY ];
42617 IMATCH_MP_TAC SUBSET_TRANS;
42618 TYPE_THEN `C INTER UNIONS (curve_cell (E'' UNION B))` EXISTS_TAC;
42620 IMATCH_MP_TAC subset_inter_pair;
42621 REWRITE_TAC[SUBSET_REFL];
42622 IMATCH_MP_TAC UNIONS_UNIONS;
42623 IMATCH_MP_TAC curve_cell_imp_subset;
42625 REWRITE_TAC[curve_cell_union;UNIONS_UNION];
42626 REWRITE_TAC[UNION_OVER_INTER];
42627 REWRITE_TAC[union_subset];
42628 (* Thu Dec 2 16:12:59 EST 2004 *)
42633 let star_avoidance_contrp = prove_by_refinement(
42634 `!E E' R B x. bounded_set (E) x /\ E SUBSET E' /\ FINITE E' /\
42635 E' SUBSET edge /\ rectagon R /\ R SUBSET E /\
42636 FINITE B /\ B SUBSET edge /\
42637 ~(UNIONS (curve_cell B) x) /\
42638 B SUBSET par_cell F R /\ ~(UNIONS (curve_cell E') x) ==>
42639 ( bounded_set (E' DIFF B) x)`,
42643 THM_INTRO_TAC[`E`;`E'`;`R`;`B`;`x`] star_avoidance_lemma1;
42644 FIRST_ASSUM DISJ_CASES_TAC;
42645 THM_INTRO_TAC[`E`;`E'`;`R`;`B`;`x`] star_avoidance;
42646 THM_INTRO_TAC[`E`] bounded_unbounded_disj;
42647 FULL_REWRITE_TAC[EQ_EMPTY;INTER];
42652 let bounded_avoidance_subset = prove_by_refinement(
42653 `!E E' x. bounded_set E x /\ E SUBSET E' /\ (E' SUBSET edge) /\
42656 ~(UNIONS (curve_cell E') x) ==>
42657 (bounded_set E' x)`,
42661 THM_INTRO_TAC[`E`] conn2_has_rectagon;
42662 IMATCH_MP_TAC SUBSET_TRANS;
42664 THM_INTRO_TAC[`E`;`E'`;`B`;`EMPTY:((num->real)->bool)->bool`;`x`] star_avoidance_contrp;
42665 ASM_REWRITE_TAC[FINITE_RULES;curve_cell_empty];
42666 FULL_REWRITE_TAC[DIFF_EMPTY];
42670 let unbounded_avoidance_subset = prove_by_refinement(
42671 `!E E' x. (unbounded_set E' x) /\ E SUBSET E' /\ (E' SUBSET edge) /\
42674 ~(UNIONS (curve_cell E') x) ==> unbounded_set E x
42679 THM_INTRO_TAC[`E`] conn2_has_rectagon;
42680 IMATCH_MP_TAC SUBSET_TRANS;
42682 THM_INTRO_TAC[`E`;`E'`;`B`;`EMPTY:((num->real)->bool)->bool`;`x`] star_avoidance;
42683 ASM_REWRITE_TAC[FINITE_RULES;curve_cell_empty;DIFF_EMPTY];
42687 let diff_unchange = prove_by_refinement(
42688 `! (A:A -> bool) B. (A DIFF B = A) <=> (A INTER B = EMPTY)`,
42692 IMATCH_MP_TAC EQ_ANTISYM;
42694 USE 0(ONCE_REWRITE_RULE[FUN_EQ_THM]);
42695 USE 0(REWRITE_RULE[DIFF]);
42696 IMATCH_MP_TAC EQ_EXT;
42697 REWRITE_TAC[EQ_EMPTY;INTER];
42699 USE 0 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
42700 IMATCH_MP_TAC EQ_EXT;
42701 FULL_REWRITE_TAC[DIFF;INTER];
42706 let union_diff2 = prove_by_refinement(
42707 `!(A:A->bool) B. (A UNION B) DIFF A = (B DIFF A)`,
42711 IMATCH_MP_TAC EQ_EXT;
42712 REWRITE_TAC[UNION;DIFF;];
42717 let unbounded_triple_avoidance = prove_by_refinement(
42718 `!A B C x. psegment_triple A B C /\
42719 A SUBSET par_cell F (B UNION C) /\
42720 unbounded_set (B UNION C) x ==>
42721 unbounded_set (A UNION B UNION C) x`,
42725 THM_INTRO_TAC[`A UNION B UNION C`;`A UNION B UNION C`;`B UNION C`;`A`;`x`] star_avoidance;
42727 TYPE_THEN `(A UNION B UNION C) DIFF A = (B UNION C)` SUBAGOAL_TAC;
42728 ONCE_REWRITE_TAC [union_diff2];
42729 REWRITE_TAC[diff_unchange];
42730 ONCE_REWRITE_TAC[INTER_COMM];
42731 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
42732 FULL_REWRITE_TAC[psegment_triple];
42735 REWRITE_TAC[SUBSET_REFL];
42737 REWRITE_TAC[FINITE_UNION];
42738 FULL_REWRITE_TAC[psegment_triple];
42739 FULL_REWRITE_TAC[psegment;segment];
42742 REWRITE_TAC[union_subset];
42743 FULL_REWRITE_TAC[psegment_triple];
42744 FULL_REWRITE_TAC[psegment;segment];
42746 FULL_REWRITE_TAC[psegment_triple];
42748 REWRITE_TAC[SUBSET;UNION];
42750 FULL_REWRITE_TAC[psegment_triple];
42751 USE 15 (REWRITE_RULE[segment;psegment]);
42753 FULL_REWRITE_TAC[psegment_triple];
42754 USE 15 (REWRITE_RULE[segment;psegment]);
42756 THM_INTRO_TAC[`(B UNION C)`;`A`;`F`] par_cell_closure;
42757 FULL_REWRITE_TAC[psegment_triple];
42758 USE 16 (REWRITE_RULE[psegment;segment]);
42759 THM_INTRO_TAC[`B UNION C`] unbounded_even;
42760 FULL_REWRITE_TAC[psegment_triple];
42763 FULL_REWRITE_TAC[UNIONS];
42764 TYPE_THEN `u = u'` SUBAGOAL_TAC;
42765 IMATCH_MP_TAC cell_partition;
42766 REWRITE_TAC[EMPTY_EXISTS;INTER ];
42767 THM_INTRO_TAC[`A`] curve_cell_cell;
42768 FULL_REWRITE_TAC[psegment_triple];
42769 USE 19 (REWRITE_RULE[psegment;segment;]);
42770 REPEAT CONJ_TAC THEN (TRY (ASM_MESON_TAC[par_cell_cell;subset_imp]));
42771 TYPE_THEN`u'` UNABBREV_TAC;
42772 USE 4 (REWRITE_RULE [EQ_EMPTY;INTER]);
42775 USE 3(ONCE_REWRITE_RULE[curve_cell_union; ]);
42776 USE 3(REWRITE_RULE[UNIONS_UNION]);
42777 TYPE_THEN `D = B UNION C` ABBREV_TAC ;
42778 USE 3(REWRITE_RULE[UNION]);
42780 TYPE_THEN `D` UNABBREV_TAC;
42781 THM_INTRO_TAC[`B UNION C`;`T`] unions_curve_cell_par_cell_disj;
42782 FULL_REWRITE_TAC[psegment_triple];
42783 USE 12(REWRITE_RULE[rectagon]);
42784 THM_INTRO_TAC[`B UNION C`] unbounded_even;
42785 FULL_REWRITE_TAC[psegment_triple];
42786 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
42791 let unbounded_set_comp_elt_eq = prove_by_refinement(
42792 `! G x. FINITE G /\
42793 G SUBSET edge /\ unbounded_set G x ==>
42794 (unbounded_set G = component (ctop G) x)
42799 THM_INTRO_TAC[`G`] unbounded_set_comp;
42800 IMATCH_MP_TAC component_replace;
42805 let outer_segment_even = prove_by_refinement(
42806 `!A B C. psegment_triple A B C /\ A SUBSET par_cell F (B UNION C)
42807 ==> C SUBSET par_cell T (A UNION B)`,
42811 TYPE_THEN `~(C = EMPTY)` SUBAGOAL_TAC;
42812 FULL_REWRITE_TAC[psegment_triple;psegment;segment];
42813 TYPE_THEN `C` UNABBREV_TAC;
42814 FULL_REWRITE_TAC[EMPTY_EXISTS];
42816 THM_INTRO_TAC[`B UNION C`] unbounded_set_nonempty;
42817 FULL_REWRITE_TAC[psegment_triple];
42818 USE 10(REWRITE_RULE [rectagon]);
42819 FULL_REWRITE_TAC[EMPTY_EXISTS];
42821 THM_INTRO_TAC[`B UNION C`;`u'`] unbounded_set_comp_elt_eq;
42822 FULL_REWRITE_TAC[psegment_triple];
42823 USE 11 (REWRITE_RULE[rectagon]);
42824 THM_INTRO_TAC[`B UNION C`;`u'`;`u`] along_lemma11;
42826 FULL_REWRITE_TAC[psegment_triple];
42827 IMATCH_MP_TAC rectagon_segment;
42828 REWRITE_TAC[EMPTY_EXISTS];
42831 REWRITE_TAC[UNION];
42833 THM_INTRO_TAC[`squ p`] cell_nonempty;
42834 REWRITE_TAC[cell_rules];
42835 FULL_REWRITE_TAC[EMPTY_EXISTS];
42836 TYPE_THEN `unbounded_set (B UNION C) u''` SUBAGOAL_TAC;
42837 ASM_MESON_TAC[subset_imp];
42839 THM_INTRO_TAC[`A`;`B`;`C`;`u''`] unbounded_triple_avoidance;
42840 THM_INTRO_TAC[`A UNION B`;`A UNION B UNION C`;`u''`] unbounded_avoidance_subset;
42843 REWRITE_TAC[SUBSET;UNION];
42844 FIRST_ASSUM DISJ_CASES_TAC;
42846 REWRITE_TAC[union_subset];
42847 FULL_REWRITE_TAC[psegment_triple];
42848 FULL_REWRITE_TAC[psegment;segment];
42850 REWRITE_TAC[FINITE_UNION];
42851 FULL_REWRITE_TAC[psegment_triple];
42852 FULL_REWRITE_TAC[psegment;segment];
42854 IMATCH_MP_TAC conn2_rectagon;
42855 FULL_REWRITE_TAC[psegment_triple];
42857 TYPE_THEN `D = B UNION C` ABBREV_TAC ;
42858 USE 10(REWRITE_RULE[curve_cell_union;]);
42859 USE 10(REWRITE_RULE[UNIONS_UNION]);
42860 USE 10(REWRITE_RULE[UNION]);
42861 THM_INTRO_TAC[`D`] unbounded_even;
42862 TYPE_THEN `D` UNABBREV_TAC;
42863 FULL_REWRITE_TAC[psegment_triple];
42865 TYPE_THEN `unbounded_set D` UNABBREV_TAC;
42866 FIRST_ASSUM DISJ_CASES_TAC;
42867 THM_INTRO_TAC[`D`;`A`;`F`] par_cell_closure;
42868 TYPE_THEN `D` UNABBREV_TAC;
42869 FULL_REWRITE_TAC[psegment_triple];
42870 USE 23(REWRITE_RULE[psegment;segment]);
42871 THM_INTRO_TAC[`curve_cell A`;`par_cell T D`] cell_unions_disj;
42872 THM_INTRO_TAC[`A`] curve_cell_cell;
42873 FULL_REWRITE_TAC[psegment_triple];
42874 USE 25(REWRITE_RULE[psegment;segment]);
42875 THM_INTRO_TAC[`D`] par_cell_cell;
42878 USE 12 (REWRITE_RULE[INTER;EQ_EMPTY]);
42881 THM_INTRO_TAC[`D`;`T`]unions_curve_cell_par_cell_disj;
42882 FULL_REWRITE_TAC[psegment_triple];
42883 TYPE_THEN `D` UNABBREV_TAC;
42884 USE 19 (REWRITE_RULE[rectagon]);
42885 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
42888 THM_INTRO_TAC[`A UNION B`] unbounded_even;
42889 FULL_REWRITE_TAC[psegment_triple];
42891 TYPE_THEN `unbounded_set (A UNION B)` UNABBREV_TAC;
42892 THM_INTRO_TAC[`par_cell T (A UNION B)`;`squ p`;`u''`] cell_ununion;
42893 REWRITE_TAC[par_cell_cell;cell_rules];
42894 THM_INTRO_TAC[`A UNION B`;`squ p`;`u`;`T`] par_cell_closure_cell;
42895 REWRITE_TAC[cell_rules;squ_closure];
42897 IMATCH_MP_TAC edge_cell;
42898 FULL_REWRITE_TAC[psegment_triple];
42899 USE 21 (REWRITE_RULE[psegment;segment]);
42900 ASM_MESON_TAC[subset_imp];
42901 FULL_REWRITE_TAC[psegment_triple];
42903 THM_INTRO_TAC[`A UNION B`;`u`] curve_cell_edge;
42904 FULL_REWRITE_TAC[psegment_triple];
42905 USE 22 (REWRITE_RULE[psegment;segment]);
42906 ASM_MESON_TAC[subset_imp];
42910 FIRST_ASSUM DISJ_CASES_TAC ;
42911 THM_INTRO_TAC[`A UNION B`;`C`] segment_in_comp;
42913 FULL_REWRITE_TAC[psegment_triple];
42915 FULL_REWRITE_TAC[psegment_triple];
42916 FULL_REWRITE_TAC[psegment];
42917 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
42919 FULL_REWRITE_TAC[psegment_triple];
42920 FULL_REWRITE_TAC[INTER_COMM];
42921 REWRITE_TAC[cls_union];
42922 ONCE_REWRITE_TAC[INTER_COMM];
42923 REWRITE_TAC[UNION_OVER_INTER;union_subset];
42924 FULL_REWRITE_TAC[psegment_triple];
42925 FULL_REWRITE_TAC[INTER_COMM];
42926 ASM_MESON_TAC[SUBSET_REFL];
42928 TYPE_THEN `eps = T` ASM_CASES_TAC;
42929 TYPE_THEN `eps` UNABBREV_TAC;
42930 TYPE_THEN `eps = F` SUBAGOAL_TAC;
42932 TYPE_THEN `eps` UNABBREV_TAC;
42933 THM_INTRO_TAC[`A UNION B`;`T`] par_cell_disjoint;
42934 USE 15(REWRITE_RULE[INTER;EQ_EMPTY]);
42936 USE 13 (REWRITE_RULE[SUBSET]);
42939 USE 12 (REWRITE_RULE[UNION]);
42940 FULL_REWRITE_TAC[psegment_triple];
42941 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
42946 let meeting_lemma = prove_by_refinement(
42947 `!R B C v eps. rectagon R /\ B SUBSET par_cell eps R /\
42948 (C INTER R = EMPTY) /\ cls R INTER cls C SUBSET endpoint C /\
42949 cls C v /\ cls B v /\ ~cls R v /\ segment C /\ B SUBSET edge ==>
42950 C SUBSET par_cell eps R`,
42954 THM_INTRO_TAC[`R`;`C`] segment_in_comp;
42955 TYPE_THEN `eps' = eps` ASM_CASES_TAC ;
42956 TYPE_THEN `eps'` UNABBREV_TAC;
42957 TYPE_THEN `eps' = ~eps` SUBAGOAL_TAC;
42959 TYPE_THEN `eps'` UNABBREV_TAC;
42962 TYPE_THEN `~(C INTER par_cell eps R = EMPTY)` BACK_TAC ;
42963 USE 10(REWRITE_RULE[INTER;EMPTY_EXISTS ]);
42964 THM_INTRO_TAC[`R`;`eps`] par_cell_disjoint;
42965 USE 12(REWRITE_RULE[INTER;EQ_EMPTY]);
42966 USE 9 (REWRITE_RULE[SUBSET]);
42969 TYPE_THEN `?eC. closure top2 eC (pointI v) /\ C eC` SUBAGOAL_TAC;
42970 FULL_REWRITE_TAC[cls];
42972 TYPE_THEN `?eB. closure top2 eB (pointI v) /\ B eB` SUBAGOAL_TAC;
42973 FULL_REWRITE_TAC[cls];
42976 UND 10 THEN REWRITE_TAC[EMPTY_EXISTS;INTER];
42977 TYPE_THEN `eC` EXISTS_TAC;
42978 IMATCH_MP_TAC par_cell_nbd;
42979 TYPE_THEN `v` EXISTS_TAC;
42980 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
42982 FULL_REWRITE_TAC[segment];
42983 ASM_MESON_TAC[subset_imp];
42985 THM_INTRO_TAC[`R`;`eB`;`{(pointI v)}`;`eps`] par_cell_closure_cell;
42986 REWRITE_TAC[cell_rules;SUBSET;INR IN_SING];
42988 IMATCH_MP_TAC edge_cell;
42989 ASM_MESON_TAC[subset_imp];
42990 ASM_MESON_TAC[subset_imp];
42991 PROOF_BY_CONTR_TAC;
42993 THM_INTRO_TAC[`R`;`v`] curve_cell_not_point;
42994 IMATCH_MP_TAC rectagon_segment;
42995 UND 16 THEN ASM_REWRITE_TAC[];
42996 THM_INTRO_TAC[`R`;`pointI v`] num_closure0;
42997 FULL_REWRITE_TAC[rectagon];
42998 USE 2(REWRITE_RULE[cls]);
43003 let parity_union_triple = prove_by_refinement(
43004 `!A B C e. segment B /\ segment C /\ (segment (B UNION C)) /\
43005 (B INTER C = EMPTY) /\ (A INTER B = EMPTY) /\ (A INTER C = EMPTY)
43006 /\ (A SUBSET edge) /\ A e ==>
43007 (parity (B UNION C) e = (parity B e = parity C e))`,
43011 TYPE_THEN `edge e` SUBAGOAL_TAC;
43012 ASM_MESON_TAC[subset_imp];
43013 THM_INTRO_TAC[`B`;`C`;`e`] parity_union;
43015 IMATCH_MP_TAC edge_cell;
43017 TYPE_THEN `~B e /\ ~C e` SUBAGOAL_TAC;
43018 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
43020 ASM_SIMP_TAC[curve_cell_edge];
43024 let parity_union_triple_even = prove_by_refinement(
43025 `!A B C e. segment B /\ segment C /\ (segment (B UNION C)) /\
43026 (B INTER C = EMPTY) /\ (A INTER B = EMPTY) /\ (A INTER C = EMPTY)
43027 /\ (segment A ) /\ A e /\
43028 A SUBSET par_cell T (B UNION C) ==> (parity B e = parity C e)`,
43032 THM_INTRO_TAC[`A`;`B`;`C`;`e`] parity_union_triple;
43033 FULL_REWRITE_TAC[segment];
43034 USE 9(ONCE_REWRITE_RULE[EQ_SYM_EQ]);
43035 THM_INTRO_TAC[`B UNION C`;`e`;`T`] parity_unique;
43036 ASM_MESON_TAC[subset_imp];
43040 let parity_union_triple_odd = prove_by_refinement(
43041 `!A B C e. segment B /\ segment C /\ (segment (B UNION C)) /\
43042 (B INTER C = EMPTY) /\ (A INTER B = EMPTY) /\ (A INTER C = EMPTY)
43043 /\ (A SUBSET edge) /\ A e /\
43044 A SUBSET par_cell F (B UNION C) ==> ~(parity B e = parity C e)`,
43048 THM_INTRO_TAC[`A`;`B`;`C`;`e`] parity_union_triple;
43050 THM_INTRO_TAC[`B UNION C`;`e`;`F`] parity_unique;
43051 ASM_MESON_TAC[subset_imp];
43056 let par_cell_even_imp = prove_by_refinement(
43057 `!A B C D. psegment_triple A B D /\ segment C /\
43058 cls (A UNION B) INTER cls C SUBSET endpoint C /\
43059 (A INTER C = EMPTY) /\ (B INTER C = EMPTY) /\ (C INTER D = EMPTY)
43060 /\ C SUBSET par_cell T (B UNION D) /\ C SUBSET par_cell T (A UNION D)
43061 ==> C SUBSET par_cell T (A UNION B)`,
43065 THM_INTRO_TAC[`(A UNION B)`;`C`] segment_in_comp;
43066 REWRITE_TAC[cls_union];
43068 FULL_REWRITE_TAC[psegment_triple];
43069 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
43070 FULL_REWRITE_TAC[INTER_COMM];
43072 TYPE_THEN `eps = T` ASM_CASES_TAC;
43073 TYPE_THEN `eps` UNABBREV_TAC;
43074 TYPE_THEN `eps = F` SUBAGOAL_TAC;
43076 TYPE_THEN `eps` UNABBREV_TAC;
43078 PROOF_BY_CONTR_TAC;
43080 TYPE_THEN `?e. edge e /\ C e` SUBAGOAL_TAC;
43081 FULL_REWRITE_TAC[segment];
43082 FULL_REWRITE_TAC[EMPTY_EXISTS];
43083 TYPE_THEN `u` EXISTS_TAC;
43084 ASM_MESON_TAC[subset_imp];
43086 THM_INTRO_TAC[`C`;`A`;`D`;`e`] parity_union_triple_even;
43087 FULL_REWRITE_TAC[INTER_COMM;psegment_triple;psegment];
43088 IMATCH_MP_TAC rectagon_segment;
43089 THM_INTRO_TAC[`C`;`B`;`D`;`e`] parity_union_triple_even;
43090 FULL_REWRITE_TAC[INTER_COMM;psegment_triple;psegment];
43091 IMATCH_MP_TAC rectagon_segment;
43092 TYPE_THEN `parity D e` UNABBREV_TAC;
43095 THM_INTRO_TAC[`C`;`A`;`B`;`e`] parity_union_triple;
43096 FULL_REWRITE_TAC[INTER_COMM;psegment_triple;psegment];
43098 IMATCH_MP_TAC rectagon_segment;
43099 USE 6(REWRITE_RULE[segment]);
43102 THM_INTRO_TAC[`(A UNION B)`;`e`] parity;
43103 ASM_SIMP_TAC[curve_cell_edge];
43104 FULL_REWRITE_TAC[psegment_triple];
43106 IMATCH_MP_TAC rectagon_segment;
43108 IMATCH_MP_TAC edge_cell;
43109 USE 27 (REWRITE_RULE[UNION]);
43110 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
43113 THM_INTRO_TAC[`A UNION B`;`parity(A UNION B) e`] par_cell_disjoint;
43114 USE 15(REWRITE_RULE[INTER;EQ_EMPTY]);
43116 UND 15 THEN ASM_REWRITE_TAC[];
43117 ASM_MESON_TAC[subset_imp];
43121 let par_cell_odd_imp = prove_by_refinement(
43122 `!A B C D. psegment_triple A B D /\ segment C /\
43123 cls (A UNION B) INTER cls C SUBSET endpoint C /\
43124 (A INTER C = EMPTY) /\ (B INTER C = EMPTY) /\ (C INTER D = EMPTY)
43125 /\ C SUBSET par_cell F (B UNION D) /\ C SUBSET par_cell T (A UNION D)
43126 ==> C SUBSET par_cell F (A UNION B)`,
43131 THM_INTRO_TAC[`(A UNION B)`;`C`] segment_in_comp;
43132 REWRITE_TAC[cls_union];
43134 FULL_REWRITE_TAC[psegment_triple];
43135 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
43136 FULL_REWRITE_TAC[INTER_COMM];
43138 TYPE_THEN `eps = F` ASM_CASES_TAC;
43139 TYPE_THEN `eps` UNABBREV_TAC;
43140 TYPE_THEN `eps = T` SUBAGOAL_TAC;
43142 TYPE_THEN `eps` UNABBREV_TAC;
43144 PROOF_BY_CONTR_TAC;
43146 TYPE_THEN `?e. edge e /\ C e` SUBAGOAL_TAC;
43147 FULL_REWRITE_TAC[segment];
43148 FULL_REWRITE_TAC[EMPTY_EXISTS];
43149 TYPE_THEN `u` EXISTS_TAC;
43150 ASM_MESON_TAC[subset_imp];
43152 THM_INTRO_TAC[`C`;`A`;`D`;`e`] parity_union_triple_even;
43153 FULL_REWRITE_TAC[INTER_COMM;psegment_triple;psegment];
43154 IMATCH_MP_TAC rectagon_segment;
43155 THM_INTRO_TAC[`C`;`B`;`D`;`e`] parity_union_triple_odd;
43156 FULL_REWRITE_TAC[INTER_COMM;psegment_triple;psegment];
43158 IMATCH_MP_TAC rectagon_segment;
43159 USE 6 (REWRITE_RULE[segment]);
43160 TYPE_THEN `parity D e` UNABBREV_TAC;
43163 THM_INTRO_TAC[`C`;`A`;`B`;`e`] parity_union_triple;
43164 FULL_REWRITE_TAC[INTER_COMM;psegment_triple;psegment];
43166 IMATCH_MP_TAC rectagon_segment;
43167 USE 6(REWRITE_RULE[segment]);
43169 THM_INTRO_TAC[`(A UNION B)`;`e`] parity;
43170 ASM_SIMP_TAC[curve_cell_edge];
43171 FULL_REWRITE_TAC[psegment_triple];
43173 IMATCH_MP_TAC rectagon_segment;
43175 IMATCH_MP_TAC edge_cell;
43176 USE 27 (REWRITE_RULE[UNION]);
43177 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
43180 TYPE_THEN `parity(A UNION B) e = F` SUBAGOAL_TAC;
43182 KILL 13 THEN REWR 14;
43183 UND 9 THEN ASM_REWRITE_TAC[];
43184 THM_INTRO_TAC[`A UNION B`;`F`] par_cell_disjoint;
43185 USE 9(REWRITE_RULE[INTER;EQ_EMPTY]);
43187 ASM_MESON_TAC[subset_imp];
43192 let curve_cell_cls = prove_by_refinement(
43193 `!G m. segment G ==> (curve_cell G {(pointI m)} = cls G m)`,
43197 ASM_SIMP_TAC[curve_cell_not_point];
43198 THM_INTRO_TAC[`G`;`pointI m`] num_closure0;
43199 FULL_REWRITE_TAC[segment];
43205 let conn2_rect_diff_inner = prove_by_refinement(
43206 `!E R. conn2 E /\ (E SUBSET edge) /\ rectagon R /\ R SUBSET E ==>
43207 conn2 (E DIFF (E INTER par_cell F R))`,
43210 REWRITE_TAC[conn2];
43211 TYPE_THEN `J = E INTER par_cell F R` ABBREV_TAC ;
43213 IMATCH_MP_TAC FINITE_SUBSET;
43215 REWRITE_TAC[DIFF;SUBSET];
43217 TYPE_THEN `R SUBSET E DIFF J` SUBAGOAL_TAC;
43218 REWRITE_TAC[DIFF_SUBSET];
43219 PROOF_BY_CONTR_TAC;
43220 FULL_REWRITE_TAC [EMPTY_EXISTS;INTER];
43221 TYPE_THEN `J` UNABBREV_TAC;
43222 THM_INTRO_TAC[`R`;`F`] par_cell_curve_cell_disj;
43223 FULL_REWRITE_TAC[rectagon];
43224 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
43226 THM_INTRO_TAC[`R`;`u`] curve_cell_edge;
43227 FULL_REWRITE_TAC[rectagon];
43228 ASM_MESON_TAC[subset_imp];
43231 THM_INTRO_TAC[`R`] conn2_rectagon;
43233 THM_INTRO_TAC[`R`;`E DIFF J`] CARD_SUBSET;
43234 FULL_REWRITE_TAC[conn2];
43235 UND 10 THEN UND 11 THEN ARITH_TAC;
43236 TYPE_THEN `(E DIFF J) UNION J = E` SUBAGOAL_TAC;
43237 TYPE_THEN `J` UNABBREV_TAC;
43238 IMATCH_MP_TAC EQ_EXT;
43239 REWRITE_TAC[DIFF;INTER;UNION];
43241 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`a`;`b`;`c`]);
43242 UND 15 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t]);
43243 REWRITE_TAC[cls_union];
43244 REWRITE_TAC[UNION];
43246 TYPE_THEN `S SUBSET E DIFF J` ASM_CASES_TAC;
43247 TYPE_THEN `S` EXISTS_TAC;
43248 TYPE_THEN `~(S INTER J = EMPTY)` SUBAGOAL_TAC;
43249 TYPE_THEN `~(S = EMPTY)` SUBAGOAL_TAC;
43250 FULL_REWRITE_TAC[segment_end;segment;psegment];
43251 TYPE_THEN `S` UNABBREV_TAC ;
43252 USE 20 (REWRITE_RULE[EMPTY_EXISTS]);
43253 UND 20 THEN UND 19 THEN UND 18 THEN UND 17 THEN REWRITE_TAC[EQ_EMPTY;SUBSET;INTER;DIFF] THEN MESON_TAC[];
43255 THM_INTRO_TAC[`R`;`T`;`{(pointI a)}`] par_cell_cell_partition;
43256 REWRITE_TAC[cell_rules];
43257 IMATCH_MP_TAC rectagon_segment;
43258 TYPE_THEN `par_cell T R {(pointI a)} \/ cls R a` SUBAGOAL_TAC;
43259 FIRST_ASSUM DISJ_CASES_TAC;
43260 FIRST_ASSUM DISJ_CASES_TAC;
43261 FULL_REWRITE_TAC[cls];
43262 USE 14 (REWRITE_RULE[DIFF]);
43263 THM_INTRO_TAC[`R`;`F`;`a`;`e'`] par_cell_nbd;
43264 ASM_MESON_TAC[subset_imp];
43265 TYPE_THEN `J` UNABBREV_TAC;
43266 USE 14(REWRITE_RULE[INTER]);
43268 THM_INTRO_TAC[`R`;`a`]curve_cell_cls;
43269 IMATCH_MP_TAC rectagon_segment;
43273 THM_INTRO_TAC[`R`;`T`;`{(pointI b)}`] par_cell_cell_partition;
43274 REWRITE_TAC[cell_rules];
43275 IMATCH_MP_TAC rectagon_segment;
43277 TYPE_THEN `par_cell T R {(pointI b)} \/ cls R b` SUBAGOAL_TAC;
43278 FIRST_ASSUM DISJ_CASES_TAC;
43279 FIRST_ASSUM DISJ_CASES_TAC;
43280 FULL_REWRITE_TAC[cls];
43281 USE 25 (REWRITE_RULE[DIFF]);
43282 THM_INTRO_TAC[`R`;`F`;`b`;`e`] par_cell_nbd;
43283 ASM_MESON_TAC[subset_imp];
43284 TYPE_THEN `J` UNABBREV_TAC;
43285 USE 25(REWRITE_RULE[INTER]);
43287 THM_INTRO_TAC[`R`;`b`]curve_cell_cls;
43288 IMATCH_MP_TAC rectagon_segment;
43292 USE 19 (REWRITE_RULE [EMPTY_EXISTS;INTER]);
43294 TYPE_THEN `~cls J a \/ cls R a` SUBAGOAL_TAC;
43295 UND 21 THEN DISCH_THEN DISJ_CASES_TAC;
43297 USE 21(REWRITE_RULE[cls]);
43298 THM_INTRO_TAC[`R`;`T`;`a`;`e`] par_cell_nbd;
43299 TYPE_THEN `J` UNABBREV_TAC;
43300 USE 23(REWRITE_RULE[INTER]);
43301 ASM_MESON_TAC[subset_imp];
43302 TYPE_THEN `J` UNABBREV_TAC;
43303 USE 23(REWRITE_RULE[INTER]);
43304 THM_INTRO_TAC[`R`;`T`] par_cell_disjoint;
43305 USE 25(REWRITE_RULE[INTER;EQ_EMPTY]);
43308 TYPE_THEN `~cls J b \/ cls R b` SUBAGOAL_TAC;
43309 UND 22 THEN DISCH_THEN DISJ_CASES_TAC;
43311 USE 23(REWRITE_RULE[cls]);
43312 THM_INTRO_TAC[`R`;`T`;`b`;`e`] par_cell_nbd;
43313 TYPE_THEN `J` UNABBREV_TAC;
43314 USE 24(REWRITE_RULE[INTER]);
43315 ASM_MESON_TAC[subset_imp];
43316 TYPE_THEN `J` UNABBREV_TAC;
43317 USE 24(REWRITE_RULE[INTER]);
43318 THM_INTRO_TAC[`R`;`T`] par_cell_disjoint;
43319 USE 26(REWRITE_RULE[INTER;EQ_EMPTY]);
43322 TYPE_THEN `!a b S'. (S' SUBSET S) /\ segment_end S' a b /\ (cls S' INTER cls (R UNION J) = {b}) ==> cls R b /\ (S' INTER (R UNION J) = EMPTY)` SUBAGOAL_TAC;
43323 TYPE_THEN `S' INTER (R UNION J) = EMPTY` SUBAGOAL_TAC;
43324 PROOF_BY_CONTR_TAC;
43325 FULL_REWRITE_TAC[EMPTY_EXISTS];
43326 USE 27 (REWRITE_RULE[INTER;UNION ]);
43327 THM_INTRO_TAC[`u'`] two_endpoint;
43328 FULL_REWRITE_TAC[segment_end;psegment;segment];
43329 UND 28 THEN UND 31 THEN MESON_TAC[subset_imp];
43330 TYPE_THEN `!n. closure top2 u' (pointI n) ==> (n = b')` SUBAGOAL_TAC;
43331 USE 24 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
43333 USE 24 (REWRITE_RULE[INTER;INR IN_SING]);
43335 TYPE_THEN `{u'} SUBSET S' /\ {u'} SUBSET (R UNION J)` SUBAGOAL_TAC;
43336 REWRITE_TAC[SUBSET;INR IN_SING;UNION ];
43337 USE 31(MATCH_MP cls_subset);
43338 USE 32(MATCH_MP cls_subset);
43339 FULL_REWRITE_TAC[cls_edge];
43340 FULL_REWRITE_TAC[SUBSET];
43341 USE 29 (REWRITE_RULE[has_size2]);
43342 USE 31(ONCE_REWRITE_RULE[FUN_EQ_THM]);
43343 USE 31(REWRITE_RULE[INR in_pair]);
43349 UND 29 THEN REWRITE_TAC[];
43351 PROOF_BY_CONTR_TAC;
43352 TYPE_THEN `cls J b'` SUBAGOAL_TAC;
43353 USE 24(ONCE_REWRITE_RULE[FUN_EQ_THM]);
43354 USE 24(REWRITE_RULE[INTER;INR IN_SING]);
43356 USE 24(REWRITE_RULE[cls_union]);
43357 USE 24(REWRITE_RULE[UNION]);
43360 TYPE_THEN`par_cell F R {(pointI b')}` SUBAGOAL_TAC;
43361 THM_INTRO_TAC[`R`;`T`;`{(pointI b')}`] par_cell_cell_partition;
43363 IMATCH_MP_TAC rectagon_segment;
43364 REWRITE_TAC[cell_rules];
43365 UND 30 THEN REP_CASES_TAC;
43366 USE 29 (REWRITE_RULE[cls]);
43367 THM_INTRO_TAC[`R`;`e`;`{(pointI b')}`;`F`] par_cell_closure_cell;
43368 REWRITE_TAC[cell_rules];
43369 REWRITE_TAC[SUBSET;INR IN_SING];
43370 TYPE_THEN `J` UNABBREV_TAC;
43371 USE 31 (REWRITE_RULE[INTER]);
43372 IMATCH_MP_TAC edge_cell;
43373 UND 31 THEN UND 2 THEN MESON_TAC[subset_imp];
43374 FIRST_ASSUM DISJ_CASES_TAC ;
43375 THM_INTRO_TAC[`R`;`F`] par_cell_curve_cell_disj;
43376 FULL_REWRITE_TAC[rectagon];
43377 THM_INTRO_TAC[`R`;`b'`] curve_cell_cls;
43378 IMATCH_MP_TAC rectagon_segment;
43380 THM_INTRO_TAC[`R`;`b'`] curve_cell_cls;
43381 IMATCH_MP_TAC rectagon_segment;
43384 USE 24 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
43385 USE 24 (REWRITE_RULE[INR IN_SING;cls_union]);
43387 USE 24 (REWRITE_RULE[INTER;UNION]);
43388 USE 31(REWRITE_RULE[cls]);
43389 THM_INTRO_TAC[`R`;`F`;`b'`;`e`] par_cell_nbd;
43390 USE 16 (REWRITE_RULE[segment_end;segment;psegment]);
43391 UND 36 THEN UND 26 THEN UND 32 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43392 USE 27(REWRITE_RULE[EQ_EMPTY;INTER;UNION]);
43394 UND 27 THEN ASM_REWRITE_TAC[];
43396 TYPE_THEN `J` UNABBREV_TAC;
43397 REWRITE_TAC[INTER];
43398 UND 17 THEN UND 26 THEN UND 32 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43400 TYPE_THEN `?m. (cls R m /\ cls S m)` SUBAGOAL_TAC;
43401 PROOF_BY_CONTR_TAC;
43402 THM_INTRO_TAC[`R`;`S`] segment_in_comp;
43403 FULL_REWRITE_TAC[segment_end;psegment];
43406 PROOF_BY_CONTR_TAC;
43407 USE 28(REWRITE_RULE[EMPTY_EXISTS;INTER ]);
43408 THM_INTRO_TAC[`u'`] two_endpoint;
43409 UND 29 THEN UND 17 THEN UND 2 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43410 USE 30(REWRITE_RULE[has_size2]);
43411 USE 31(ONCE_REWRITE_RULE[FUN_EQ_THM]);
43413 USE 31(REWRITE_RULE[INR in_pair]);
43415 USE 25(REWRITE_RULE[cls]);
43417 IMATCH_MP_TAC SUBSET_TRANS;
43418 TYPE_THEN `EMPTY:((int#int)->bool)` EXISTS_TAC;
43419 REWRITE_TAC[SUBSET_EMPTY;EQ_EMPTY;INTER;];
43421 UND 25 THEN ASM_REWRITE_TAC[];
43422 TYPE_THEN `eps = T` ASM_CASES_TAC ;
43423 TYPE_THEN `eps` UNABBREV_TAC;
43424 THM_INTRO_TAC[`R`;`T`] par_cell_disjoint;
43425 USE 27(REWRITE_RULE[INTER;EQ_EMPTY]);
43427 USE 26(REWRITE_RULE[SUBSET]);
43428 TYPE_THEN`J` UNABBREV_TAC;
43429 USE 18 (REWRITE_RULE[INTER]);
43430 UND 6 THEN UND 26 THEN UND 27 THEN UND 19 THEN MESON_TAC[];
43431 TYPE_THEN `eps = F` SUBAGOAL_TAC;
43434 TYPE_THEN `eps` UNABBREV_TAC;
43435 USE 16 (REWRITE_RULE[segment_end]);
43436 THM_INTRO_TAC[`S`;`a`] terminal_endpoint;
43437 USE 16 (REWRITE_RULE[FUN_EQ_THM]);
43439 FULL_REWRITE_TAC[psegment;segment;INR in_pair];
43440 TYPE_THEN `e = terminal_edge S a` ABBREV_TAC ;
43441 USE 20 (REWRITE_RULE[cls]);
43442 FIRST_ASSUM DISJ_CASES_TAC;
43445 TYPE_THEN `J` UNABBREV_TAC;
43446 USE 31(REWRITE_RULE[INTER]);
43447 UND 6 THEN ASM_REWRITE_TAC[];
43448 UND 29 THEN UND 26 THEN UND 17 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43451 USE 25 (REWRITE_RULE[cls]);
43455 TYPE_THEN `conn2 R` SUBAGOAL_TAC;
43456 USE 27(REWRITE_RULE[conn2]);
43461 TYPE_THEN `(~(a = m)) ==> (?S'. S' SUBSET E DIFF J /\ segment_end S' a m /\ ~cls S' c)` SUBAGOAL_TAC;
43462 TYPE_THEN `cls R a` ASM_CASES_TAC;
43463 UND 27 THEN DISCH_THEN (THM_INTRO_TAC[`a`]);
43466 TYPE_THEN `S'` EXISTS_TAC;
43467 ONCE_REWRITE_TAC[segment_end_symm];
43468 IMATCH_MP_TAC SUBSET_TRANS;
43469 TYPE_THEN `R` EXISTS_TAC;
43471 TYPE_THEN `?S'. S' SUBSET S /\ segment_end S' a m` SUBAGOAL_TAC;
43472 TYPE_THEN `m = b` ASM_CASES_TAC;
43473 TYPE_THEN `S` EXISTS_TAC;
43474 REWRITE_TAC[SUBSET_REFL];
43475 THM_INTRO_TAC[`S`;`a`;`b`;`m`] cut_psegment;
43476 TYPE_THEN `A` EXISTS_TAC;
43477 REWRITE_TAC[SUBSET_UNION];
43478 THM_INTRO_TAC[`R UNION J`;`S'`;`a`;`m`] segment_end_select;
43479 REWRITE_TAC[cls_union;union_subset];
43480 ASM_REWRITE_TAC[UNION];
43481 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
43485 FULL_REWRITE_TAC [rectagon];
43486 TYPE_THEN `J` UNABBREV_TAC;
43487 UND 2 THEN REWRITE_TAC[INTER;SUBSET] THEN MESON_TAC[];
43489 UND 24 THEN DISCH_THEN (THM_INTRO_TAC[`a`;`c'`;`B`]);
43490 UND 35 THEN UND 33 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43491 TYPE_THEN `c' = m` ASM_CASES_TAC;
43492 TYPE_THEN `B` EXISTS_TAC;
43494 USE 24(REWRITE_RULE[INTER;UNION;EQ_EMPTY]);
43495 UND 24 THEN UND 35 THEN UND 33 THEN UND 17 THEN REWRITE_TAC[SUBSET;DIFF] THEN MESON_TAC[];
43496 TYPE_THEN `c'` UNABBREV_TAC;
43497 TYPE_THEN `cls B SUBSET cls S` SUBAGOAL_TAC;
43498 IMATCH_MP_TAC cls_subset;
43499 UND 35 THEN UND 33 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43500 UND 39 THEN UND 40 THEN UND 3 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43502 TYPE_THEN `B SUBSET E DIFF J /\ ~cls B c` SUBAGOAL_TAC;
43504 USE 24(REWRITE_RULE[INTER;UNION;EQ_EMPTY]);
43505 UND 24 THEN UND 35 THEN UND 33 THEN UND 17 THEN REWRITE_TAC[SUBSET;DIFF] THEN MESON_TAC[];
43506 TYPE_THEN `cls B SUBSET cls S` SUBAGOAL_TAC;
43507 IMATCH_MP_TAC cls_subset;
43508 UND 35 THEN UND 33 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43509 UND 41 THEN UND 40 THEN UND 3 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43511 UND 27 THEN DISCH_THEN (THM_INTRO_TAC[`c'`]);
43513 TYPE_THEN `c'` UNABBREV_TAC;
43514 USE 37(MATCH_MP segment_end_cls2);
43515 UND 40 THEN ASM_REWRITE_TAC[];
43516 TYPE_THEN `c` UNABBREV_TAC;
43517 USE 32 (MATCH_MP segment_end_cls2);
43518 TYPE_THEN `cls S' SUBSET cls S` SUBAGOAL_TAC;
43519 IMATCH_MP_TAC cls_subset;
43520 UND 25 THEN UND 3 THEN MESON_TAC[];
43521 USE 42 (ONCE_REWRITE_RULE[segment_end_symm]);
43523 TYPE_THEN `S'' SUBSET (E DIFF J)`SUBAGOAL_TAC;
43524 IMATCH_MP_TAC SUBSET_TRANS;
43525 TYPE_THEN `R` EXISTS_TAC;
43526 THM_INTRO_TAC[`B`;`S''`;`a`;`c'`;`m`] segment_end_trans;
43527 TYPE_THEN `U` EXISTS_TAC;
43529 IMATCH_MP_TAC SUBSET_TRANS;
43530 TYPE_THEN `B UNION S''` EXISTS_TAC;
43531 REWRITE_TAC[union_subset];
43532 TYPE_THEN `cls U SUBSET cls (B UNION S'')` SUBAGOAL_TAC;
43533 IMATCH_MP_TAC cls_subset;
43534 USE 48(REWRITE_RULE[cls_union]);
43535 UND 48 THEN UND 47 THEN UND 40 THEN UND 27 THEN REWRITE_TAC[SUBSET;UNION] THEN MESON_TAC[];
43537 TYPE_THEN `(~(b = m)) ==> (?S'. S' SUBSET E DIFF J /\ segment_end S' b m /\ ~cls S' c)` SUBAGOAL_TAC;
43538 TYPE_THEN `cls R b` ASM_CASES_TAC;
43539 UND 27 THEN DISCH_THEN (THM_INTRO_TAC[`b`]);
43542 TYPE_THEN `S'` EXISTS_TAC;
43543 USE 33(ONCE_REWRITE_RULE[segment_end_symm]);
43544 IMATCH_MP_TAC SUBSET_TRANS;
43545 TYPE_THEN `R` EXISTS_TAC;
43547 TYPE_THEN `?S'. S' SUBSET S /\ segment_end S' b m` SUBAGOAL_TAC;
43548 TYPE_THEN `m = a` ASM_CASES_TAC;
43549 TYPE_THEN `S` EXISTS_TAC;
43550 REWRITE_TAC[SUBSET_REFL];
43551 USE 16 (ONCE_REWRITE_RULE[segment_end_symm]);
43552 THM_INTRO_TAC[`S`;`b`;`a`;`m`] cut_psegment;
43553 USE 16 (ONCE_REWRITE_RULE[segment_end_symm]);
43554 TYPE_THEN `A` EXISTS_TAC;
43555 REWRITE_TAC[SUBSET_UNION];
43557 THM_INTRO_TAC[`R UNION J`;`S'`;`b`;`m`] segment_end_select;
43558 REWRITE_TAC[cls_union;union_subset];
43559 ASM_REWRITE_TAC[UNION];
43560 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
43564 FULL_REWRITE_TAC [rectagon];
43565 TYPE_THEN `J` UNABBREV_TAC;
43566 UND 2 THEN REWRITE_TAC[INTER;SUBSET] THEN MESON_TAC[];
43568 UND 24 THEN DISCH_THEN (THM_INTRO_TAC[`b`;`c'`;`B`]);
43569 UND 36 THEN UND 34 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43570 TYPE_THEN `c' = m` ASM_CASES_TAC;
43571 TYPE_THEN `B` EXISTS_TAC;
43573 USE 24(REWRITE_RULE[INTER;UNION;EQ_EMPTY]);
43574 UND 24 THEN UND 36 THEN UND 34 THEN UND 17 THEN REWRITE_TAC[SUBSET;DIFF] THEN MESON_TAC[];
43575 TYPE_THEN `c'` UNABBREV_TAC;
43576 TYPE_THEN `cls B SUBSET cls S` SUBAGOAL_TAC;
43577 IMATCH_MP_TAC cls_subset;
43578 UND 36 THEN UND 34 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43579 UND 40 THEN UND 41 THEN UND 3 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43581 TYPE_THEN `B SUBSET E DIFF J /\ ~cls B c` SUBAGOAL_TAC;
43583 USE 24(REWRITE_RULE[INTER;UNION;EQ_EMPTY]);
43584 UND 24 THEN UND 36 THEN UND 34 THEN UND 17 THEN REWRITE_TAC[SUBSET;DIFF] THEN MESON_TAC[];
43585 TYPE_THEN `cls B SUBSET cls S` SUBAGOAL_TAC;
43586 IMATCH_MP_TAC cls_subset;
43587 UND 36 THEN UND 34 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43588 UND 42 THEN UND 41 THEN UND 3 THEN REWRITE_TAC[SUBSET] THEN MESON_TAC[];
43590 UND 27 THEN DISCH_THEN (THM_INTRO_TAC[`c'`]);
43592 TYPE_THEN `c'` UNABBREV_TAC;
43593 USE 38(MATCH_MP segment_end_cls2);
43594 UND 41 THEN ASM_REWRITE_TAC[];
43595 TYPE_THEN `c` UNABBREV_TAC;
43596 USE 33 (MATCH_MP segment_end_cls2);
43597 TYPE_THEN `cls S' SUBSET cls S` SUBAGOAL_TAC;
43598 IMATCH_MP_TAC cls_subset;
43599 UND 25 THEN UND 3 THEN MESON_TAC[];
43601 TYPE_THEN `S'' SUBSET (E DIFF J)`SUBAGOAL_TAC;
43602 IMATCH_MP_TAC SUBSET_TRANS;
43603 TYPE_THEN `R` EXISTS_TAC;
43604 THM_INTRO_TAC[`B`;`S''`;`b`;`c'`;`m`] segment_end_trans;
43605 ONCE_REWRITE_TAC[segment_end_symm];
43606 TYPE_THEN `U` EXISTS_TAC;
43608 IMATCH_MP_TAC SUBSET_TRANS;
43609 TYPE_THEN `B UNION S''` EXISTS_TAC;
43610 REWRITE_TAC[union_subset];
43611 TYPE_THEN `cls U SUBSET cls (B UNION S'')` SUBAGOAL_TAC;
43612 IMATCH_MP_TAC cls_subset;
43613 USE 49(REWRITE_RULE[cls_union]);
43614 UND 49 THEN UND 48 THEN UND 41 THEN UND 27 THEN REWRITE_TAC[SUBSET;UNION] THEN MESON_TAC[];
43616 TYPE_THEN `b = m` ASM_CASES_TAC;
43617 TYPE_THEN`m` UNABBREV_TAC;
43618 TYPE_THEN `a = m` ASM_CASES_TAC;
43619 TYPE_THEN `m` UNABBREV_TAC;
43620 TYPE_THEN `S'` EXISTS_TAC;
43621 ONCE_REWRITE_TAC[segment_end_symm];
43624 THM_INTRO_TAC[`S''`;`S'`;`a`;`m`;`b`] segment_end_trans;
43625 ONCE_REWRITE_TAC[segment_end_symm];
43626 TYPE_THEN `U` EXISTS_TAC;
43628 IMATCH_MP_TAC SUBSET_TRANS;
43629 TYPE_THEN `S'' UNION S'` EXISTS_TAC;
43630 REWRITE_TAC[union_subset];
43631 TYPE_THEN `cls U SUBSET cls (S'' UNION S')` SUBAGOAL_TAC;
43632 IMATCH_MP_TAC cls_subset;
43633 USE 41(REWRITE_RULE[SUBSET;cls_union]);
43634 UND 41 THEN UND 40 THEN UND 30 THEN UND 33 THEN REWRITE_TAC[UNION] THEN MESON_TAC[];
43635 (* Sat Dec 4 18:57:41 EST 2004 *)
43640 let conn2_psegment_triple = prove_by_refinement(
43641 `!E. conn2 E /\ (E SUBSET edge) /\
43642 ~(rectagon E) ==> (?A B C. psegment_triple A B C
43643 /\ A SUBSET E /\ B SUBSET E /\ C SUBSET E /\
43644 A SUBSET par_cell F (B UNION C))`,
43648 TYPE_THEN `(?A B C. psegment_triple A B C /\ A SUBSET E /\ B SUBSET E /\ C SUBSET E)` BACK_TAC;
43649 THM_INTRO_TAC[`A`;`B`;`C`] trap_odd_cell;
43650 FIRST_ASSUM DISJ_CASES_TAC;
43652 FIRST_ASSUM DISJ_CASES_TAC;
43653 USE 6 (MATCH_MP psegment_triple3);
43654 USE 9 (ONCE_REWRITE_RULE[UNION_COMM ]);
43656 USE 6 (MATCH_MP psegment_triple2);
43657 USE 9 (ONCE_REWRITE_RULE[UNION_COMM ]);
43660 THM_INTRO_TAC[`E`] conn2_has_rectagon;
43661 THM_INTRO_TAC[`E`;`B`] conn2_proper;
43663 IMATCH_MP_TAC conn2_rectagon;
43665 THM_INTRO_TAC[`A`] endpoint_size2;
43666 FULL_REWRITE_TAC[has_size2];
43667 THM_INTRO_TAC[`B`;`a`;`b`] cut_rectagon_cls;
43669 USE 5 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
43670 USE 5 (REWRITE_RULE[INTER;INR in_pair]);
43672 TYPE_THEN `C = A'` ABBREV_TAC ;
43673 TYPE_THEN `A'` UNABBREV_TAC;
43674 TYPE_THEN`A` EXISTS_TAC;
43675 TYPE_THEN `B` UNABBREV_TAC;
43676 TYPE_THEN `B'` EXISTS_TAC;
43677 TYPE_THEN `C` EXISTS_TAC;
43678 REWRITE_TAC[psegment_triple];
43679 TYPE_THEN `psegment B' /\ psegment C` SUBAGOAL_TAC;
43680 FULL_REWRITE_TAC[segment_end];
43681 TYPE_THEN`(A INTER B' = EMPTY) /\ (A INTER C = EMPTY)` SUBAGOAL_TAC;
43682 FULL_REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
43683 FULL_REWRITE_TAC[INTER_COMM];
43684 USE 5 (REWRITE_RULE[cls_union]);
43685 FULL_REWRITE_TAC[UNION_OVER_INTER;];
43686 TYPE_THEN `(endpoint B' = {a,b}) /\ (endpoint C = {a,b})` SUBAGOAL_TAC;
43687 FULL_REWRITE_TAC[segment_end];
43688 TYPE_THEN `(cls A INTER cls B' = {a, b}) /\ (cls A INTER cls C = {a, b})` SUBAGOAL_TAC;
43689 TYPE_THEN `endpoint A` UNABBREV_TAC;
43691 USE 10 (REWRITE_RULE[FUN_EQ_THM]);
43692 USE 5 (REWRITE_RULE[INTER;UNION;INR in_pair]);
43693 CONJ_TAC THEN IMATCH_MP_TAC EQ_EXT THEN REWRITE_TAC[INTER;INR in_pair];
43694 ASM_MESON_TAC[segment_end_cls;segment_end_cls2];
43695 ASM_MESON_TAC[segment_end_cls;segment_end_cls2];
43697 FULL_REWRITE_TAC[UNION_COMM];
43699 TYPE_THEN`segment_end A a b` SUBAGOAL_TAC;
43700 REWRITE_TAC[segment_end];
43702 ASM_MESON_TAC[segment_end_union_rectagon;segment_end_symm;INTER_COMM;UNION_COMM];
43703 ASM_MESON_TAC[union_subset];
43707 let rectagon_surround_conn2 = prove_by_refinement(
43708 `!G. conn2 G /\ G SUBSET edge ==>
43709 (?C. rectagon C /\ C SUBSET G /\
43710 (!x. bounded_set G x ==> bounded_set C x))`,
43714 TYPE_THEN `EE = {C | conn2 C /\ (C SUBSET G) /\ (!x. bounded_set G x ==> bounded_set C x)}` ABBREV_TAC ;
43715 TYPE_THEN `EE G` SUBAGOAL_TAC;
43716 TYPE_THEN `EE` UNABBREV_TAC;
43717 REWRITE_TAC[SUBSET_REFL];
43718 THM_INTRO_TAC[`EE`] select_card_min;
43719 UND 4 THEN REWRITE_TAC[EMPTY_EXISTS];
43721 TYPE_THEN `C = z` ABBREV_TAC ;
43722 TYPE_THEN `z` UNABBREV_TAC;
43723 TYPE_THEN `rectagon C` BACK_TAC ;
43724 TYPE_THEN `C` EXISTS_TAC;
43725 TYPE_THEN `EE` UNABBREV_TAC;
43726 PROOF_BY_CONTR_TAC;
43727 TYPE_THEN `!R. rectagon R /\ R SUBSET C ==> (C INTER par_cell F R = EMPTY)` SUBAGOAL_TAC;
43728 PROOF_BY_CONTR_TAC;
43729 TYPE_THEN `J = (C INTER par_cell F R )` ABBREV_TAC ;
43730 TYPE_THEN `EE (C DIFF J)` SUBAGOAL_TAC;
43731 TYPE_THEN `EE` UNABBREV_TAC;
43733 TYPE_THEN `J` UNABBREV_TAC;
43734 IMATCH_MP_TAC conn2_rect_diff_inner;
43735 IMATCH_MP_TAC SUBSET_TRANS;
43738 IMATCH_MP_TAC SUBSET_TRANS;
43739 TYPE_THEN `C` EXISTS_TAC;
43740 REWRITE_TAC[DIFF;SUBSET];
43742 THM_INTRO_TAC[`C`;`C`;`R`;`J`;`x`] star_avoidance_contrp;
43743 REWRITE_TAC[SUBSET_REFL];
43745 TYPE_THEN `FINITE G` SUBAGOAL_TAC;
43746 FULL_REWRITE_TAC[conn2];
43747 TYPE_THEN `J SUBSET G` SUBAGOAL_TAC;
43748 TYPE_THEN `J` UNABBREV_TAC;
43749 UND 3 THEN REWRITE_TAC[SUBSET;INTER] THEN MESON_TAC[];
43750 TYPE_THEN `FINITE C /\ FINITE J` SUBAGOAL_TAC;
43751 CONJ_TAC THEN IMATCH_MP_TAC FINITE_SUBSET THEN ASM_MESON_TAC[];
43752 TYPE_THEN `C SUBSET edge /\ J SUBSET edge` SUBAGOAL_TAC;
43753 CONJ_TAC THEN IMATCH_MP_TAC SUBSET_TRANS THEN ASM_MESON_TAC[];
43754 TYPE_THEN `J SUBSET par_cell F R` SUBAGOAL_TAC;
43755 TYPE_THEN`J` UNABBREV_TAC;
43756 REWRITE_TAC[INTER;SUBSET];
43757 TYPE_THEN `~(UNIONS (curve_cell G) x)` SUBAGOAL_TAC;
43758 THM_INTRO_TAC[`G`;`x`] bounded_subset_unions;
43759 USE 22(REWRITE_RULE[ctop_unions;DIFF ]);
43761 TYPE_THEN `!A. A SUBSET G ==> UNIONS (curve_cell A) SUBSET UNIONS(curve_cell G)` SUBAGOAL_TAC;
43762 IMATCH_MP_TAC UNIONS_UNIONS;
43763 IMATCH_MP_TAC curve_cell_imp_subset;
43764 ASM_MESON_TAC[subset_imp];
43765 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`C DIFF J`]);
43766 USE 4(MATCH_MP (ARITH_RULE `x <=| y ==> ~(y < x)`));
43767 UND 4 THEN ASM_REWRITE_TAC[];
43768 IMATCH_MP_TAC card_subset_lt;
43770 REWRITE_TAC[DIFF;SUBSET];
43772 TYPE_THEN `J` UNABBREV_TAC;
43773 USE 9(REWRITE_RULE[EMPTY_EXISTS]);
43774 USE 4 (REWRITE_RULE[diff_unchange]);
43775 USE 4(REWRITE_RULE[EQ_EMPTY]);
43776 FULL_REWRITE_TAC[INTER];
43778 IMATCH_MP_TAC FINITE_SUBSET;
43779 TYPE_THEN `G` EXISTS_TAC;
43780 FULL_REWRITE_TAC[conn2];
43781 TYPE_THEN `EE` UNABBREV_TAC;
43783 THM_INTRO_TAC[`C`] conn2_psegment_triple;
43784 TYPE_THEN `EE` UNABBREV_TAC;
43785 IMATCH_MP_TAC SUBSET_TRANS;
43787 TSPEC `(B UNION C')` 7;
43788 UND 7 THEN DISCH_THEN (THM_INTRO_TAC[]);
43790 FULL_REWRITE_TAC[psegment_triple];
43791 REWRITE_TAC[union_subset];
43792 UND 7 THEN ASM_REWRITE_TAC[EMPTY_EXISTS;INTER];
43793 TYPE_THEN `~(A = EMPTY)` SUBAGOAL_TAC;
43794 FULL_REWRITE_TAC[psegment_triple];
43795 TYPE_THEN `A` UNABBREV_TAC;
43796 USE 25 (REWRITE_RULE[psegment;segment]);
43797 FULL_REWRITE_TAC[EMPTY_EXISTS];
43798 TYPE_THEN `u` EXISTS_TAC;
43799 ASM_MESON_TAC[subset_imp];
43803 let curve_cell_subset = prove_by_refinement(
43804 `!H G. (H SUBSET G) ==>
43805 UNIONS (curve_cell H) SUBSET UNIONS (curve_cell G)`,
43809 IMATCH_MP_TAC UNIONS_UNIONS;
43810 TYPE_THEN `G = H UNION (G DIFF H)` SUBAGOAL_TAC;
43811 IMATCH_MP_TAC EQ_EXT;
43812 UND 0 THEN REWRITE_TAC[SUBSET;UNION;DIFF] THEN MESON_TAC[];
43813 UND 1 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
43814 REWRITE_TAC[curve_cell_union];
43815 REWRITE_TAC[SUBSET;UNION];
43819 let bounded_set_curve_cell_empty = prove_by_refinement(
43820 `!H G x. bounded_set G x /\ H SUBSET G ==> ~UNIONS (curve_cell H) x`,
43824 THM_INTRO_TAC[`H`;`G`]curve_cell_subset;
43825 THM_INTRO_TAC[`G`] bounded_unbounded_union;
43826 USE 4 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
43828 USE 4(REWRITE_RULE[UNION;ctop_unions;DIFF ]);
43829 FULL_REWRITE_TAC[SUBSET];
43834 let unbounded_set_curve_cell_empty = prove_by_refinement(
43835 `!H G x. unbounded_set G x /\ H SUBSET G ==> ~UNIONS (curve_cell H) x`,
43839 THM_INTRO_TAC[`H`;`G`]curve_cell_subset;
43840 THM_INTRO_TAC[`G`] bounded_unbounded_union;
43841 USE 4 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
43843 USE 4(REWRITE_RULE[UNION;ctop_unions;DIFF ]);
43844 FULL_REWRITE_TAC[SUBSET];
43849 let bounded_triple_avoidance = prove_by_refinement(
43850 `!A B C. psegment_triple A B C /\ A SUBSET par_cell F (B UNION C) ==>
43851 bounded_set (A UNION B UNION C) SUBSET bounded_set (B UNION C)`,
43855 REWRITE_TAC[SUBSET];
43856 PROOF_BY_CONTR_TAC;
43857 THM_INTRO_TAC[`A UNION B UNION C`;`A UNION B UNION C`;`B UNION C`;`A`;`x`] star_avoidance_lemma1;
43858 REWRITE_TAC[SUBSET_REFL];
43859 REWRITE_TAC[FINITE_UNION;union_subset];
43861 FULL_REWRITE_TAC[psegment_triple];
43862 FULL_REWRITE_TAC[psegment;segment];
43864 FULL_REWRITE_TAC[psegment_triple];
43865 FULL_REWRITE_TAC[psegment;segment];
43867 FULL_REWRITE_TAC[psegment_triple];
43869 REWRITE_TAC[SUBSET;UNION];
43871 THM_INTRO_TAC[`A`;`A UNION B UNION C`;`x`] bounded_set_curve_cell_empty;
43872 REWRITE_TAC[SUBSET;UNION];
43874 THM_INTRO_TAC[`A UNION B UNION C`;`A UNION B UNION C`;`x`] bounded_set_curve_cell_empty;
43875 REWRITE_TAC[SUBSET_REFL ];
43878 TYPE_THEN `(A UNION B UNION C) DIFF A = (B UNION C)` SUBAGOAL_TAC;
43879 FULL_REWRITE_TAC[psegment_triple];
43880 IMATCH_MP_TAC EQ_EXT;
43881 UND 10 THEN UND 11 THEN REWRITE_TAC[EQ_EMPTY;INTER;UNION;DIFF] THEN MESON_TAC[];
43882 FIRST_ASSUM DISJ_CASES_TAC;
43886 THM_INTRO_TAC[`A`;`B`;`C`;`x`] unbounded_triple_avoidance;
43887 THM_INTRO_TAC[`A UNION B UNION C`] bounded_unbounded_disj;
43888 FULL_REWRITE_TAC[INTER;EQ_EMPTY ];
43893 let bounded_euclid = prove_by_refinement(
43894 `!G x. bounded_set G x ==> euclid 2 x`,
43898 USE 0(MATCH_MP bounded_subset_unions);
43899 FULL_REWRITE_TAC[ctop_unions;DIFF ];
43903 let unbounded_euclid = prove_by_refinement(
43904 `!G x. unbounded_set G x ==> euclid 2 x`,
43908 USE 0(MATCH_MP unbounded_subset_unions);
43909 FULL_REWRITE_TAC[ctop_unions;DIFF ];
43913 let bounded_triple_inner_union = prove_by_refinement(
43914 `!A B C. psegment_triple A B C ==> bounded_set (A UNION B UNION C)
43915 SUBSET (bounded_set (A UNION B) UNION bounded_set (B UNION C))`,
43919 THM_INTRO_TAC[`C`;`A`;`B`] trap_odd_cell;
43920 IMATCH_MP_TAC psegment_triple3;
43921 IMATCH_MP_TAC psegment_triple3;
43922 UND 1 THEN REP_CASES_TAC;
43923 THM_INTRO_TAC[`C`;`A`;`B`] bounded_triple_avoidance;
43924 IMATCH_MP_TAC psegment_triple3;
43925 IMATCH_MP_TAC psegment_triple3;
43926 FULL_REWRITE_TAC[UNION_ACI;];
43927 IMATCH_MP_TAC in_union;
43928 THM_INTRO_TAC[`A`;`B`;`C`] bounded_triple_avoidance;
43929 FULL_REWRITE_TAC[UNION_ACI;];
43930 IMATCH_MP_TAC in_union;
43932 REWRITE_TAC[SUBSET];
43933 ONCE_REWRITE_TAC[UNION];
43934 PROOF_BY_CONTR_TAC;
43935 FULL_REWRITE_TAC[DE_MORGAN_THM];
43936 THM_INTRO_TAC[`B UNION C`;`A UNION B UNION C`;`x`] bounded_set_curve_cell_empty;
43937 REWRITE_TAC[UNION;SUBSET];
43938 THM_INTRO_TAC[`A UNION B`;`A UNION B UNION C`;`x`] bounded_set_curve_cell_empty;
43939 REWRITE_TAC[UNION;SUBSET] THEN MESON_TAC[];
43940 TYPE_THEN `euclid 2 x` SUBAGOAL_TAC;
43941 ASM_MESON_TAC[bounded_euclid];
43942 THM_INTRO_TAC[`A UNION B`] bounded_unbounded_union;
43943 USE 8(ONCE_REWRITE_RULE[FUN_EQ_THM]);
43944 USE 8(REWRITE_RULE[ctop_unions;DIFF]);
43946 TYPE_THEN `R = A UNION B` ABBREV_TAC ;
43947 USE 8(REWRITE_RULE[UNION]);
43949 TYPE_THEN `R` UNABBREV_TAC;
43951 THM_INTRO_TAC[`B UNION C`] bounded_unbounded_union;
43952 USE 9(ONCE_REWRITE_RULE[FUN_EQ_THM]);
43953 USE 9(REWRITE_RULE[ctop_unions;DIFF]);
43955 TYPE_THEN `R = B UNION C` ABBREV_TAC ;
43956 USE 9(REWRITE_RULE[UNION]);
43958 TYPE_THEN `R'` UNABBREV_TAC;
43964 THM_INTRO_TAC[`x`] point_onto;
43965 TYPE_THEN `x` UNABBREV_TAC;
43966 THM_INTRO_TAC[`p`] cell_unions;
43967 USE 3(REWRITE_RULE[UNIONS]);
43968 THM_INTRO_TAC[`B UNION C`] unbounded_even;
43969 FULL_REWRITE_TAC[psegment_triple];
43972 THM_INTRO_TAC[`par_cell T (B UNION C)`;`u`;`point p`] cell_ununion;
43973 REWRITE_TAC[par_cell_cell];
43976 THM_INTRO_TAC[`A UNION B`] unbounded_even;
43977 FULL_REWRITE_TAC[psegment_triple];
43980 THM_INTRO_TAC[`par_cell T (A UNION B)`;`u`;`point p`] cell_ununion;
43981 REWRITE_TAC[par_cell_cell];
43984 TYPE_THEN `unbounded_set (A UNION B UNION C) (point p)` ASM_CASES_TAC;
43985 THM_INTRO_TAC[`A UNION B UNION C`] bounded_unbounded_disj;
43986 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
43989 TYPE_THEN `~unbounded_set (B UNION C UNION A) (point p)` SUBAGOAL_TAC;
43990 FULL_REWRITE_TAC[UNION_ACI];
43992 UND 9 THEN REWRITE_TAC[];
43993 IMATCH_MP_TAC unbounded_triple_avoidance;
43995 IMATCH_MP_TAC psegment_triple3;
43997 FULL_REWRITE_TAC[UNION_ACI];
44000 THM_INTRO_TAC[`A UNION C`] unbounded_even;
44001 FULL_REWRITE_TAC[psegment_triple];
44002 REWRITE_TAC[UNIONS];
44003 TYPE_THEN `u` EXISTS_TAC;
44006 THM_INTRO_TAC[`A UNION B`;`u`;`T`] parity_unique;
44007 IMATCH_MP_TAC rectagon_segment;
44008 FULL_REWRITE_TAC[psegment_triple];
44009 THM_INTRO_TAC[`B UNION C`;`u`;`T`] parity_unique;
44010 IMATCH_MP_TAC rectagon_segment;
44011 FULL_REWRITE_TAC[psegment_triple];
44013 TYPE_THEN `!A B. rectagon (A UNION B) /\ par_cell T (A UNION B) u ==> ~curve_cell A u` SUBAGOAL_TAC;
44014 THM_INTRO_TAC[`A' UNION B'`;`T`] par_cell_curve_cell_disj;
44015 FULL_REWRITE_TAC[rectagon];
44016 UND 12 THEN ASM_REWRITE_TAC[EMPTY_EXISTS];
44017 TYPE_THEN `u` EXISTS_TAC;
44018 REWRITE_TAC[INTER];
44019 THM_INTRO_TAC[`A'`;`A' UNION B'`] curve_cell_imp_subset;
44020 REWRITE_TAC[SUBSET;UNION];
44021 ASM_MESON_TAC[subset_imp];
44023 TYPE_THEN `~curve_cell A u` SUBAGOAL_TAC THENL[FIRST_ASSUM IMATCH_MP_TAC ;ALL_TAC];
44024 TYPE_THEN `B` EXISTS_TAC;
44025 FULL_REWRITE_TAC[psegment_triple;psegment;];
44026 TYPE_THEN `~curve_cell B u` SUBAGOAL_TAC THENL[FIRST_ASSUM IMATCH_MP_TAC ;ALL_TAC];
44027 TYPE_THEN `A` EXISTS_TAC;
44028 REWRITE_TAC[UNION_ACI];
44029 FULL_REWRITE_TAC[psegment_triple;psegment;];
44030 TYPE_THEN `~curve_cell C u` SUBAGOAL_TAC THENL[FIRST_ASSUM IMATCH_MP_TAC ;ALL_TAC];
44031 TYPE_THEN `B` EXISTS_TAC;
44032 REWRITE_TAC[UNION_ACI];
44033 FULL_REWRITE_TAC[psegment_triple;psegment;];
44035 THM_INTRO_TAC[`A`;`B`;`u`] parity_union;
44036 FULL_REWRITE_TAC[psegment_triple;psegment;];
44037 IMATCH_MP_TAC rectagon_segment;
44040 THM_INTRO_TAC[`B`;`C`;`u`] parity_union;
44041 FULL_REWRITE_TAC[psegment_triple;psegment;];
44042 IMATCH_MP_TAC rectagon_segment;
44045 TYPE_THEN `parity A u = parity C u` SUBAGOAL_TAC;
44049 THM_INTRO_TAC[`A`;`C`;`u`] parity_union;
44050 FULL_REWRITE_TAC[psegment_triple;psegment;];
44051 IMATCH_MP_TAC rectagon_segment;
44053 TYPE_THEN `parity (A UNION C) u = T` SUBAGOAL_TAC;
44055 IMATCH_MP_TAC parity;
44056 REWRITE_TAC[curve_cell_union];
44058 FULL_REWRITE_TAC[psegment_triple;psegment;];
44059 IMATCH_MP_TAC rectagon_segment;
44060 USE 16(REWRITE_RULE[UNION]);
44065 (* ------------------------------------------------------------------ *)
44067 (* ------------------------------------------------------------------ *)
44070 (* back to the K3 graph *)
44072 let rectagon_graph = jordan_def
44073 `rectagon_graph G <=>
44075 graph_edge G SUBSET psegment /\
44076 (!e. graph_edge G e ==> (graph_inc G e = endpoint e)) /\
44077 (!e e'. graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==>
44078 (e INTER e' = EMPTY)) /\
44079 (!e e'. graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==>
44080 (cls e INTER cls e' = endpoint e INTER endpoint e'))`;;
44082 let rectagonal_graph = jordan_def
44083 `rectagonal_graph (G:(A,B)graph_t) <=>
44084 (?H. rectagon_graph H /\ graph_isomorphic H G)`;;
44086 let k33_rectagon_hyp = jordan_def
44087 `k33_rectagon_hyp R f <=> rectagon R /\
44088 (!(i:three_t) j. ~(i = j) ==> (cls (f i) INTER (cls (f j)) = EMPTY)) /\
44089 (!i j. ~(i = j) ==> ((f i) INTER (f j) = EMPTY)) /\
44090 (!i. ?A B. (R = A UNION B) /\ psegment_triple A B (f i) /\
44091 (!j. ~(cls (f j) INTER cls A = EMPTY) /\
44092 ~(cls (f j) INTER cls B = EMPTY)) /\
44093 (!j. ~(i = j) ==> (cls (f j) INTER cls A INTER cls B = EMPTY)))`;;
44095 let k33_rectagon_two_even = prove_by_refinement(
44096 `!R f i. k33_rectagon_hyp R f /\
44097 f i SUBSET par_cell F R ==>
44098 (!j. ~(j = i) ==> (f j SUBSET par_cell T R))`,
44102 FULL_REWRITE_TAC [k33_rectagon_hyp];
44105 TYPE_THEN `R` UNABBREV_TAC;
44107 THM_INTRO_TAC[`f i`;`A`;`B`] outer_segment_even;
44108 IMATCH_MP_TAC psegment_triple3;
44109 IMATCH_MP_TAC psegment_triple3;
44110 THM_INTRO_TAC[`f i`;`B`;`A`] outer_segment_even;
44111 FULL_REWRITE_TAC[UNION_ACI];
44112 IMATCH_MP_TAC psegment_triple2;
44115 FULL_REWRITE_TAC[EMPTY_EXISTS];
44116 USE 7 (REWRITE_RULE[INTER]);
44117 USE 11(REWRITE_RULE[INTER]);
44119 THM_INTRO_TAC[`f i UNION A`;`B`;`f j`;`u`;`T`] meeting_lemma;
44121 FULL_REWRITE_TAC[psegment_triple];
44122 FULL_REWRITE_TAC[UNION_COMM];
44123 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
44126 FIRST_ASSUM IMATCH_MP_TAC ;
44127 TYPE_THEN `j` UNABBREV_TAC;
44128 FULL_REWRITE_TAC[psegment_triple];
44129 FULL_REWRITE_TAC[UNION_COMM];
44131 REWRITE_TAC[GSYM SUBSET_EMPTY];
44132 IMATCH_MP_TAC SUBSET_TRANS;
44133 TYPE_THEN `f j INTER (A' UNION B')` EXISTS_TAC;
44136 IMATCH_MP_TAC subset_inter_pair;
44137 REWRITE_TAC[SUBSET_REFL];
44138 REWRITE_TAC[SUBSET;UNION];
44139 REWRITE_TAC[SUBSET_EMPTY;UNION_OVER_INTER;EMPTY_UNION];
44140 FULL_REWRITE_TAC[INTER_COMM];
44141 REWRITE_TAC[cls_union];
44145 USE 2 (REWRITE_RULE[INTER;EQ_EMPTY]);
44149 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
44150 TYPE_THEN `i` UNABBREV_TAC;
44151 USE 4(REWRITE_RULE [EQ_EMPTY;INTER]);
44155 TYPE_THEN `B SUBSET edge` SUBAGOAL_TAC;
44156 USE 8 (REWRITE_RULE[psegment_triple]);
44157 USE 26(REWRITE_RULE[psegment;segment]);
44159 TYPE_THEN `segment (f j)` SUBAGOAL_TAC;
44161 USE 17 (REWRITE_RULE[psegment_triple]);
44162 FULL_REWRITE_TAC[psegment];
44164 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
44166 USE 17 (REWRITE_RULE[UNION]);
44169 ONCE_REWRITE_TAC[INTER_COMM];
44170 REWRITE_TAC[UNION_OVER_INTER];
44171 REWRITE_TAC[union_subset];
44173 UND 14 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`]);
44174 TYPE_THEN `j` UNABBREV_TAC;
44177 IMATCH_MP_TAC SUBSET_TRANS;
44178 TYPE_THEN `cls (f j) INTER cls(A' UNION B')` EXISTS_TAC;
44180 IMATCH_MP_TAC subset_inter_pair;
44181 REWRITE_TAC[SUBSET_REFL];
44183 IMATCH_MP_TAC cls_subset;
44184 REWRITE_TAC[SUBSET;UNION];
44185 USE 18(REWRITE_RULE[psegment_triple]);
44186 REWRITE_TAC[cls_union;UNION_OVER_INTER];
44187 REWRITE_TAC[union_subset];
44188 FULL_REWRITE_TAC[INTER_COMM];
44189 TYPE_THEN `endpoint (f j)` UNABBREV_TAC;
44190 REWRITE_TAC[SUBSET_REFL];
44192 THM_INTRO_TAC[`f i UNION B`;`A`;`f j`;`u'`;`T`] meeting_lemma;
44194 FULL_REWRITE_TAC[psegment_triple];
44195 FULL_REWRITE_TAC[UNION_COMM];
44196 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
44199 FIRST_ASSUM IMATCH_MP_TAC ;
44200 TYPE_THEN `j` UNABBREV_TAC;
44201 FULL_REWRITE_TAC[psegment_triple];
44202 FULL_REWRITE_TAC[UNION_COMM];
44204 REWRITE_TAC[GSYM SUBSET_EMPTY];
44205 IMATCH_MP_TAC SUBSET_TRANS;
44206 TYPE_THEN `f j INTER (A' UNION B')` EXISTS_TAC;
44209 IMATCH_MP_TAC subset_inter_pair;
44210 REWRITE_TAC[SUBSET_REFL];
44211 REWRITE_TAC[SUBSET;UNION];
44212 REWRITE_TAC[SUBSET_EMPTY;UNION_OVER_INTER;EMPTY_UNION];
44213 FULL_REWRITE_TAC[INTER_COMM];
44214 REWRITE_TAC[cls_union];
44218 USE 2 (REWRITE_RULE[INTER;EQ_EMPTY]);
44222 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
44223 TYPE_THEN `i` UNABBREV_TAC;
44224 USE 4(REWRITE_RULE [EQ_EMPTY;INTER]);
44228 TYPE_THEN `A SUBSET edge` SUBAGOAL_TAC;
44229 USE 8 (REWRITE_RULE[psegment_triple]);
44230 USE 28(REWRITE_RULE[psegment;segment]);
44232 TYPE_THEN `segment (f j)` SUBAGOAL_TAC;
44234 USE 18 (REWRITE_RULE[psegment_triple]);
44235 FULL_REWRITE_TAC[psegment];
44237 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
44239 USE 18 (REWRITE_RULE[UNION]);
44242 ONCE_REWRITE_TAC[INTER_COMM];
44243 REWRITE_TAC[UNION_OVER_INTER];
44244 REWRITE_TAC[union_subset];
44246 UND 15 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`]);
44247 TYPE_THEN `j` UNABBREV_TAC;
44250 IMATCH_MP_TAC SUBSET_TRANS;
44251 TYPE_THEN `cls (f j) INTER cls(A' UNION B')` EXISTS_TAC;
44253 IMATCH_MP_TAC subset_inter_pair;
44254 REWRITE_TAC[SUBSET_REFL];
44256 IMATCH_MP_TAC cls_subset;
44257 REWRITE_TAC[SUBSET;UNION];
44258 USE 19(REWRITE_RULE[psegment_triple]);
44259 REWRITE_TAC[cls_union;UNION_OVER_INTER];
44260 REWRITE_TAC[union_subset];
44261 FULL_REWRITE_TAC[INTER_COMM];
44262 TYPE_THEN `endpoint (f j)` UNABBREV_TAC;
44263 REWRITE_TAC[SUBSET_REFL];
44265 IMATCH_MP_TAC par_cell_even_imp;
44266 TYPE_THEN `f i` EXISTS_TAC;
44267 FULL_REWRITE_TAC[UNION_ACI];
44270 USE 17 (REWRITE_RULE [psegment_triple]);
44271 USE 29(REWRITE_RULE[psegment]);
44275 FULL_REWRITE_TAC[psegment_triple];
44276 REWRITE_TAC[cls_union ;];
44277 ONCE_REWRITE_TAC[INTER_COMM];
44278 REWRITE_TAC[UNION_OVER_INTER];
44279 REWRITE_TAC[union_subset];
44280 FULL_REWRITE_TAC[INTER_COMM];
44281 TYPE_THEN `endpoint A'` UNABBREV_TAC;
44282 TYPE_THEN `endpoint B'` UNABBREV_TAC;
44283 REWRITE_TAC[SUBSET_REFL];
44284 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`]);
44285 TYPE_THEN `j` UNABBREV_TAC;
44288 UND 17 THEN UND 18 THEN (POP_ASSUM_LIST (fun t -> ALL_TAC));
44289 TYPE_THEN `!C. C SUBSET (A' UNION B') ==> (C INTER f j = EMPTY)` SUBAGOAL_TAC;
44290 FULL_REWRITE_TAC[psegment_triple];
44291 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
44292 FULL_REWRITE_TAC[SUBSET;UNION ];
44295 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN (ASM_REWRITE_TAC[SUBSET ]) THEN ASM_REWRITE_TAC[UNION];
44299 let psegment_triple_odd_even = prove_by_refinement(
44300 `!A B C. psegment_triple A B C /\ C SUBSET par_cell T (A UNION B) ==>
44301 (?A' B'. psegment_triple A' B' C /\ C SUBSET par_cell T (A' UNION B')
44302 /\ A' SUBSET par_cell F (B' UNION C)
44303 /\ B' SUBSET par_cell T (A' UNION C)
44304 /\ (A UNION B = A' UNION B')
44305 /\ (cls A INTER cls B = cls A' INTER cls B') /\
44306 (!P. (P A /\ P B ) ==> P A' /\ P B'))`,
44310 TYPE_THEN `A SUBSET par_cell F (B UNION C)` ASM_CASES_TAC;
44311 TYPE_THEN `A` EXISTS_TAC;
44312 TYPE_THEN `B` EXISTS_TAC;
44313 IMATCH_MP_TAC outer_segment_even;
44314 FULL_REWRITE_TAC[UNION_COMM];
44315 IMATCH_MP_TAC psegment_triple3;
44316 IMATCH_MP_TAC psegment_triple3;
44317 IMATCH_MP_TAC psegment_triple2;
44318 THM_INTRO_TAC[`A`;`B`;`C`] trap_odd_cell;
44319 UND 3 THEN REP_CASES_TAC;
44321 TYPE_THEN `B` EXISTS_TAC;
44322 TYPE_THEN `A` EXISTS_TAC;
44323 FULL_REWRITE_TAC[UNION_COMM;INTER_COMM;];
44325 IMATCH_MP_TAC psegment_triple3;
44326 IMATCH_MP_TAC psegment_triple2;
44327 IMATCH_MP_TAC outer_segment_even;
44328 FULL_REWRITE_TAC[UNION_COMM];
44329 IMATCH_MP_TAC psegment_triple3;
44331 TYPE_THEN `~(C = EMPTY)` SUBAGOAL_TAC;
44332 FULL_REWRITE_TAC[psegment_triple];
44333 TYPE_THEN `C` UNABBREV_TAC;
44334 USE 15 (REWRITE_RULE[psegment;segment]);
44336 FULL_REWRITE_TAC[EMPTY_EXISTS];
44337 THM_INTRO_TAC[`A UNION B`;`T`] par_cell_disjoint;
44338 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
44339 ASM_MESON_TAC[subset_imp];
44343 let k33_rectagon_two_odd = prove_by_refinement(
44344 `!R f i. k33_rectagon_hyp R f /\
44345 f i SUBSET par_cell T R ==>
44346 (!j. ~(j = i) ==> (f j SUBSET par_cell F R))`,
44350 FULL_REWRITE_TAC [k33_rectagon_hyp];
44353 TYPE_THEN `R` UNABBREV_TAC;
44355 THM_INTRO_TAC[`A`;`B`;`f i`] psegment_triple_odd_even;
44356 TYPE_THEN `A UNION B` UNABBREV_TAC;
44357 TYPE_THEN `cls A INTER cls B` UNABBREV_TAC;
44358 TYPE_THEN `!j. ~(cls (f j) INTER cls A' = {}) /\ ~(cls (f j) INTER cls B' = {})` SUBAGOAL_TAC;
44359 FIRST_ASSUM IMATCH_MP_TAC ;
44360 KILL 7; (* 7 -> 10 *)
44365 FULL_REWRITE_TAC[EMPTY_EXISTS];
44366 USE 7 (REWRITE_RULE[INTER]);
44367 USE 8(REWRITE_RULE[INTER]);
44369 THM_INTRO_TAC[`f i UNION A'`;`B'`;`f j`;`u`;`T`] meeting_lemma;
44371 FULL_REWRITE_TAC[psegment_triple];
44372 FULL_REWRITE_TAC[UNION_COMM];
44373 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
44374 FULL_REWRITE_TAC[UNION_COMM];
44377 FIRST_ASSUM IMATCH_MP_TAC ;
44378 TYPE_THEN `j` UNABBREV_TAC;
44379 FULL_REWRITE_TAC[psegment_triple];
44380 FULL_REWRITE_TAC[UNION_COMM];
44382 FULL_REWRITE_TAC[UNION_COMM];
44383 REWRITE_TAC[GSYM SUBSET_EMPTY];
44384 IMATCH_MP_TAC SUBSET_TRANS;
44385 TYPE_THEN `f j INTER (A'' UNION B'')` EXISTS_TAC;
44388 IMATCH_MP_TAC subset_inter_pair;
44389 REWRITE_TAC[SUBSET_REFL];
44390 REWRITE_TAC[SUBSET;UNION];
44391 REWRITE_TAC[SUBSET_EMPTY;UNION_OVER_INTER;EMPTY_UNION];
44392 FULL_REWRITE_TAC[INTER_COMM];
44393 REWRITE_TAC[cls_union];
44397 USE 2 (REWRITE_RULE[INTER;EQ_EMPTY]);
44401 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
44402 TYPE_THEN `i` UNABBREV_TAC;
44403 USE 4(REWRITE_RULE [EQ_EMPTY;INTER]);
44407 TYPE_THEN `B' SUBSET edge` SUBAGOAL_TAC;
44408 USE 15 (REWRITE_RULE[psegment_triple]);
44409 USE 27(REWRITE_RULE[psegment;segment]);
44411 TYPE_THEN `segment (f j)` SUBAGOAL_TAC;
44413 USE 18 (REWRITE_RULE[psegment_triple]);
44414 FULL_REWRITE_TAC[psegment];
44416 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
44418 USE 18 (REWRITE_RULE[UNION]);
44421 ONCE_REWRITE_TAC[INTER_COMM];
44422 REWRITE_TAC[UNION_OVER_INTER];
44423 REWRITE_TAC[union_subset];
44424 UND 11 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`]);
44425 TYPE_THEN `j` UNABBREV_TAC;
44428 IMATCH_MP_TAC SUBSET_TRANS;
44429 TYPE_THEN `cls (f j) INTER cls(A'' UNION B'')` EXISTS_TAC;
44431 IMATCH_MP_TAC subset_inter_pair;
44432 REWRITE_TAC[SUBSET_REFL];
44434 IMATCH_MP_TAC cls_subset;
44435 REWRITE_TAC[SUBSET;UNION];
44436 USE 19(REWRITE_RULE[psegment_triple]);
44437 REWRITE_TAC[cls_union;UNION_OVER_INTER];
44438 REWRITE_TAC[union_subset];
44439 FULL_REWRITE_TAC[INTER_COMM];
44440 TYPE_THEN `endpoint (f j)` UNABBREV_TAC;
44441 REWRITE_TAC[SUBSET_REFL];
44443 THM_INTRO_TAC[`f i UNION B'`;`A'`;`f j`;`u'`;`F`] meeting_lemma;
44445 FULL_REWRITE_TAC[psegment_triple];
44446 FULL_REWRITE_TAC[UNION_COMM];
44447 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
44448 FULL_REWRITE_TAC[UNION_COMM];
44451 FIRST_ASSUM IMATCH_MP_TAC ;
44452 TYPE_THEN `j` UNABBREV_TAC;
44453 FULL_REWRITE_TAC[psegment_triple];
44454 FULL_REWRITE_TAC[UNION_COMM];
44456 REWRITE_TAC[GSYM SUBSET_EMPTY];
44457 IMATCH_MP_TAC SUBSET_TRANS;
44458 TYPE_THEN `f j INTER (A'' UNION B'')` EXISTS_TAC;
44461 IMATCH_MP_TAC subset_inter_pair;
44462 REWRITE_TAC[SUBSET_REFL];
44463 REWRITE_TAC[SUBSET;UNION];
44464 REWRITE_TAC[SUBSET_EMPTY;UNION_OVER_INTER;EMPTY_UNION];
44465 FULL_REWRITE_TAC[INTER_COMM];
44466 REWRITE_TAC[cls_union];
44470 USE 2 (REWRITE_RULE[INTER;EQ_EMPTY]);
44474 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
44475 TYPE_THEN `i` UNABBREV_TAC;
44476 USE 4(REWRITE_RULE [EQ_EMPTY;INTER]);
44480 TYPE_THEN `A' SUBSET edge` SUBAGOAL_TAC;
44481 USE 15 (REWRITE_RULE[psegment_triple]);
44482 USE 29(REWRITE_RULE[psegment;segment]);
44484 TYPE_THEN `segment (f j)` SUBAGOAL_TAC;
44486 USE 19 (REWRITE_RULE[psegment_triple]);
44487 FULL_REWRITE_TAC[psegment];
44489 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
44491 USE 19 (REWRITE_RULE[UNION]);
44494 ONCE_REWRITE_TAC[INTER_COMM];
44495 REWRITE_TAC[UNION_OVER_INTER];
44496 REWRITE_TAC[union_subset];
44497 UND 16 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`]);
44498 TYPE_THEN `j` UNABBREV_TAC;
44501 IMATCH_MP_TAC SUBSET_TRANS;
44502 TYPE_THEN `cls (f j) INTER cls(A'' UNION B'')` EXISTS_TAC;
44504 IMATCH_MP_TAC subset_inter_pair;
44505 REWRITE_TAC[SUBSET_REFL];
44507 IMATCH_MP_TAC cls_subset;
44508 REWRITE_TAC[SUBSET;UNION];
44509 USE 20(REWRITE_RULE[psegment_triple]);
44510 REWRITE_TAC[cls_union;UNION_OVER_INTER];
44511 REWRITE_TAC[union_subset];
44512 FULL_REWRITE_TAC[INTER_COMM];
44513 TYPE_THEN `endpoint (f j)` UNABBREV_TAC;
44514 REWRITE_TAC[SUBSET_REFL];
44516 IMATCH_MP_TAC par_cell_odd_imp;
44517 TYPE_THEN `f i` EXISTS_TAC;
44518 FULL_REWRITE_TAC[UNION_ACI];
44521 USE 18 (REWRITE_RULE [psegment_triple]);
44522 USE 30(REWRITE_RULE[psegment]);
44526 FULL_REWRITE_TAC[psegment_triple];
44527 REWRITE_TAC[cls_union ;];
44528 ONCE_REWRITE_TAC[INTER_COMM];
44529 REWRITE_TAC[UNION_OVER_INTER];
44530 REWRITE_TAC[union_subset];
44531 FULL_REWRITE_TAC[INTER_COMM];
44532 TYPE_THEN `endpoint A''` UNABBREV_TAC;
44533 TYPE_THEN `endpoint B''` UNABBREV_TAC;
44534 REWRITE_TAC[SUBSET_REFL];
44535 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`]);
44536 TYPE_THEN `j` UNABBREV_TAC;
44539 UND 19 THEN UND 18 THEN (POP_ASSUM_LIST (fun t -> ALL_TAC));
44540 TYPE_THEN `!C. C SUBSET (A'' UNION B'') ==> (C INTER f j = EMPTY)` SUBAGOAL_TAC;
44541 FULL_REWRITE_TAC[psegment_triple];
44542 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
44543 FULL_REWRITE_TAC[SUBSET;UNION ];
44546 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN (ASM_REWRITE_TAC[SUBSET ]) THEN ASM_REWRITE_TAC[UNION];
44550 let ABS3_012 = prove_by_refinement(
44551 `(REP3 (ABS3 0) = 0) /\ (REP3(ABS3 1) = 1) /\ (REP3(ABS3 2) = 2)`,
44554 ASSUME_TAC three_t;
44555 USE 0(ONCE_REWRITE_RULE[EQ_SYM_EQ]);
44560 let three_t_not_sing = prove_by_refinement(
44561 `!i. ?(j:three_t). ~(i = j)`,
44565 TYPE_THEN `i = ABS3 0` ASM_CASES_TAC;
44566 TYPE_THEN `ABS3 1` EXISTS_TAC;
44567 USE 1(AP_TERM `REP3`);
44568 FULL_REWRITE_TAC[ABS3_012];
44569 UND 1 THEN ARITH_TAC;
44570 TYPE_THEN `ABS3 0` EXISTS_TAC;
44575 let ABS3_onto = prove_by_refinement(
44576 `!(i:three_t). ?j. (i = ABS3 j) /\ (j < 3)`,
44580 TYPE_THEN `REP3 i` EXISTS_TAC;
44581 REWRITE_TAC[BETA_RULE three_t];
44585 let three_t_eq = prove_by_refinement(
44586 `!i j. (i = j) <=> (REP3 i = REP3 j)`,
44590 IMATCH_MP_TAC EQ_ANTISYM;
44592 USE 0(AP_TERM `ABS3`);
44593 FULL_REWRITE_TAC[three_t];
44597 let rep3_lt = prove_by_refinement(
44598 `!i. (REP3 i < 3)`,
44602 REWRITE_TAC[BETA_RULE three_t];
44606 let three_t_not_pair = prove_by_refinement(
44607 `!i j. ?(k:three_t). ~(k = i) /\ ~(k = j)`,
44611 REWRITE_TAC[three_t_eq];
44612 TYPE_THEN `?k'. (k' < 3) /\ ~(k' = REP3 i) /\ ~(k' = REP3 j)` SUBAGOAL_TAC;
44613 TYPE_THEN ` ~(0 = REP3 i) /\ ~(0 = REP3 j)` ASM_CASES_TAC;
44614 ASM_MESON_TAC[ARITH_RULE `0 < 3`];
44615 TYPE_THEN ` ~(1 = REP3 i) /\ ~(1 = REP3 j)` ASM_CASES_TAC;
44616 ASM_MESON_TAC[ARITH_RULE `1 < 3`];
44617 TYPE_THEN ` ~(2 = REP3 i) /\ ~(2 = REP3 j)` ASM_CASES_TAC;
44618 ASM_MESON_TAC[ARITH_RULE `2 < 3`];
44619 FULL_REWRITE_TAC[DE_MORGAN_THM];
44620 PROOF_BY_CONTR_TAC;
44621 UND 0 THEN UND 1 THEN UND 2 THEN ARITH_TAC;
44622 TYPE_THEN` ABS3 k'` EXISTS_TAC;
44623 ASM_MESON_TAC [BETA_RULE three_t];
44627 let bool_size = prove_by_refinement(
44628 `(UNIV:bool->bool) HAS_SIZE 2`,
44631 REWRITE_TAC[has_size_bij2];
44632 TYPE_THEN `\ u. if u then 0 else 1` EXISTS_TAC;
44637 COND_CASES_TAC THEN ARITH_TAC ;
44638 UND 0 THEN COND_CASES_TAC THEN COND_CASES_TAC THEN ASM_MESON_TAC[ARITH_RULE `~(0 =1) /\ ~(1 = 0)`];
44639 FULL_REWRITE_TAC[SURJ;INJ];
44641 USE 2 (REWRITE_RULE[ARITH_RULE `x <| 2 <=> (x = 0)\/ (x = 1)`]);
44642 FIRST_ASSUM DISJ_CASES_TAC;
44643 TYPE_THEN `T` EXISTS_TAC;
44644 TYPE_THEN `F` EXISTS_TAC;
44648 let three_delete_size = prove_by_refinement(
44649 `!(i:three_t). (UNIV DELETE i) HAS_SIZE 2`,
44652 REWRITE_TAC[HAS_SIZE;FINITE_DELETE];
44653 THM_INTRO_TAC[] thr_finite;
44654 FULL_REWRITE_TAC[HAS_SIZE];
44655 IMATCH_MP_TAC (ARITH_RULE `(SUC x = 3) ==> (x = 2)`);
44657 IMATCH_MP_TAC CARD_SUC_DELETE;
44662 let has_size_bij_set = prove_by_refinement(
44663 `!(A:A->bool) (B:B->bool) n. A HAS_SIZE n /\ B HAS_SIZE n ==>
44668 USE 0(REWRITE_RULE [has_size_bij]);
44669 USE 1(REWRITE_RULE[has_size_bij2]);
44670 TYPE_THEN `compose f f'` EXISTS_TAC;
44671 IMATCH_MP_TAC COMP_BIJ;
44676 let bool_three_delete_bij = prove_by_refinement(
44677 `!i. ?b. BIJ b (UNIV:bool->bool) ((UNIV:three_t->bool) DELETE i)`,
44681 IMATCH_MP_TAC has_size_bij_set;
44682 TYPE_THEN`2` EXISTS_TAC;
44683 REWRITE_TAC[bool_size;three_delete_size];
44687 let k33_rectagon_hyp_odd_exist = prove_by_refinement(
44688 `!R f. k33_rectagon_hyp R f ==>
44689 (?i. (f i SUBSET par_cell F R))`,
44692 REWRITE_TAC[k33_rectagon_hyp];
44693 TYPE_THEN `j = ABS3 0` ABBREV_TAC ;
44694 TYPE_THEN `f j SUBSET par_cell F R` ASM_CASES_TAC;
44696 TYPE_THEN `k = ABS3 1` ABBREV_TAC ;
44697 TYPE_THEN `k` EXISTS_TAC;
44698 THM_INTRO_TAC[`R`;`f`;`j`] k33_rectagon_two_odd;
44700 ASM_REWRITE_TAC[k33_rectagon_hyp];
44701 THM_INTRO_TAC[`R`;`f j`] segment_in_comp;
44703 USE 8 (REWRITE_RULE[psegment_triple]);
44705 USE 20(REWRITE_RULE[psegment]);
44706 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
44707 FULL_REWRITE_TAC[INTER_COMM];
44708 REWRITE_TAC[cls_union];
44709 REWRITE_TAC[UNION_OVER_INTER;union_subset];
44710 FULL_REWRITE_TAC[INTER_COMM];
44711 TYPE_THEN `endpoint (f j)` UNABBREV_TAC;
44712 REWRITE_TAC[SUBSET_REFL];
44713 TYPE_THEN `eps = F` ASM_CASES_TAC;
44715 TYPE_THEN `eps = T` SUBAGOAL_TAC;
44717 TYPE_THEN `eps` UNABBREV_TAC;
44720 FIRST_ASSUM IMATCH_MP_TAC ;
44721 TYPE_THEN `j` UNABBREV_TAC;
44722 TYPE_THEN `k` UNABBREV_TAC;
44723 USE 4 (AP_TERM `REP3`);
44724 FULL_REWRITE_TAC[ABS3_012];
44725 UND 4 THEN ARITH_TAC;
44729 let k33_rectagon_hyp_false = prove_by_refinement(
44730 `!R f. ~k33_rectagon_hyp R f`,
44734 THM_INTRO_TAC[`R`;`f`] k33_rectagon_hyp_odd_exist;
44735 THM_INTRO_TAC[`R`;`f`;`i`] k33_rectagon_two_even;
44736 THM_INTRO_TAC[`i`] three_t_not_sing;
44738 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`j`]);
44739 TYPE_THEN `j` UNABBREV_TAC;
44741 THM_INTRO_TAC[`i`;`j`] three_t_not_pair;
44743 THM_INTRO_TAC[`R`;`f`;`j`] k33_rectagon_two_odd;
44745 TYPE_THEN `~(f k = EMPTY)` SUBAGOAL_TAC;
44746 FULL_REWRITE_TAC[k33_rectagon_hyp];
44748 FULL_REWRITE_TAC[psegment_triple];
44749 USE 25(REWRITE_RULE[psegment;segment]);
44750 TYPE_THEN `f k` UNABBREV_TAC;
44751 FULL_REWRITE_TAC[EMPTY_EXISTS];
44752 THM_INTRO_TAC[`R`;`T`] par_cell_disjoint;
44753 FULL_REWRITE_TAC[EQ_EMPTY;INTER ];
44754 FULL_REWRITE_TAC[SUBSET];
44759 let k33_graph_edge = prove_by_refinement(
44760 `graph_edge (k33_graph) = cartesian UNIV UNIV`,
44763 REWRITE_TAC[k33_graph;graph_edge_mk_graph];
44767 let k33_graph_vertex = prove_by_refinement(
44768 `graph_vertex (k33_graph) = cartesian UNIV UNIV`,
44771 REWRITE_TAC[k33_graph;graph_vertex_mk_graph];
44775 let k33_graph_inc = prove_by_refinement(
44776 `!e v. graph_inc (k33_graph) e v <=> (v = (FST e,T)) \/ (v = (SND e,F))`,
44779 REWRITE_TAC[k33_graph;graph_inc_mk_graph;INR in_pair ];
44784 let cartesian_univ = prove_by_refinement(
44785 `!x. cartesian (UNIV:A->bool) (UNIV:B->bool) x`,
44788 REWRITE_TAC[cartesian;PAIR_SPLIT];
44793 let rectagonal_graph_k33 = prove_by_refinement(
44794 `rectagonal_graph k33_graph <=> (?f uA uB.
44795 INJ uA UNIV UNIV /\
44796 INJ uB UNIV UNIV /\
44797 (!(i:three_t#three_t).
44798 segment_end (f i) (uA (FST i)) (uB (SND i))) /\
44799 (!i j. ~(f i INTER f j = EMPTY) ==> (i = j)) /\
44800 (!i j. ~(i = j) ==> (cls (f i) INTER cls (f j) =
44801 endpoint (f i) INTER endpoint (f j))))
44805 REWRITE_TAC[rectagonal_graph];
44806 IMATCH_MP_TAC EQ_ANTISYM;
44809 THM_INTRO_TAC[`H`;`k33_graph`] graph_isomorphic_symm;
44810 FULL_REWRITE_TAC[rectagon_graph];
44812 FULL_REWRITE_TAC [graph_isomorphic;graph_iso];
44813 FULL_REWRITE_TAC[rectagon_graph];
44814 FULL_REWRITE_TAC[k33_graph_edge;k33_graph_vertex;k33_graph_inc];
44816 TYPE_THEN `v` EXISTS_TAC;
44817 TYPE_THEN `uA = (\ i. u (i,T))` ABBREV_TAC ;
44818 TYPE_THEN `uB = (\ i. u (i,F))` ABBREV_TAC ;
44819 TYPE_THEN `uA` EXISTS_TAC;
44820 TYPE_THEN `uB` EXISTS_TAC;
44824 TYPE_THEN `uA` UNABBREV_TAC;
44825 USE 3(REWRITE_RULE[BIJ;INJ]);
44826 TYPE_THEN`(x,T) = (y,T)` BACK_TAC;
44827 USE 12 (REWRITE_RULE[PAIR_SPLIT]);
44828 FIRST_ASSUM IMATCH_MP_TAC ;
44829 REWRITE_TAC[cartesian_univ];
44833 TYPE_THEN `uB` UNABBREV_TAC;
44834 USE 3(REWRITE_RULE[BIJ;INJ]);
44835 TYPE_THEN`(x,F) = (y,F)` BACK_TAC;
44836 USE 12 (REWRITE_RULE[PAIR_SPLIT]);
44837 FIRST_ASSUM IMATCH_MP_TAC ;
44838 REWRITE_TAC[cartesian_univ];
44840 TYPE_THEN `!i. graph_edge H (v i)` SUBAGOAL_TAC;
44841 FULL_REWRITE_TAC[BIJ;SURJ];
44842 FIRST_ASSUM IMATCH_MP_TAC ;
44843 REWRITE_TAC[cartesian_univ];
44844 FULL_REWRITE_TAC[cartesian_univ];
44847 REWRITE_TAC[segment_end];
44849 USE 7(REWRITE_RULE[SUBSET]);
44852 IMATCH_MP_TAC EQ_EXT;
44853 REWRITE_TAC[IMAGE;k33_graph_inc;INR in_pair];
44854 TYPE_THEN `uA` UNABBREV_TAC;
44855 TYPE_THEN `uB` UNABBREV_TAC;
44857 IMATCH_MP_TAC EQ_ANTISYM;
44859 FIRST_ASSUM DISJ_CASES_TAC;
44860 FIRST_ASSUM DISJ_CASES_TAC;
44861 TYPE_THEN `(SND i,F)` EXISTS_TAC;
44862 TYPE_THEN `(FST i,T)` EXISTS_TAC;
44865 PROOF_BY_CONTR_TAC;
44866 UND 5 THEN DISCH_THEN (THM_INTRO_TAC[`v i`;`v j`]);
44867 PROOF_BY_CONTR_TAC;
44868 UND 13 THEN REWRITE_TAC[];
44869 USE 2 (REWRITE_RULE[BIJ;INJ]);
44870 FIRST_ASSUM IMATCH_MP_TAC ;
44871 ASM_MESON_TAC[cartesian_univ];
44874 FIRST_ASSUM IMATCH_MP_TAC ;
44876 UND 12 THEN REWRITE_TAC[];
44877 USE 2 (REWRITE_RULE[BIJ;INJ]);
44878 FIRST_ASSUM IMATCH_MP_TAC ;
44879 ASM_MESON_TAC[cartesian_univ];
44881 TYPE_THEN `?H. rectagon_graph H /\ graph_isomorphic k33_graph H` BACK_TAC;
44882 TYPE_THEN `H` EXISTS_TAC;
44883 IMATCH_MP_TAC graph_isomorphic_symm;
44884 REWRITE_TAC[k33_isgraph];
44885 REWRITE_TAC[rectagon_graph;graph_isomorphic;graph_iso];
44886 REWRITE_TAC[k33_graph_vertex;k33_graph_edge];
44887 TYPE_THEN `H = mk_graph_t (IMAGE uA UNIV UNION IMAGE uB UNIV ,IMAGE f (cartesian UNIV UNIV), endpoint)` ABBREV_TAC ;
44888 TYPE_THEN `H` EXISTS_TAC;
44889 TYPE_THEN `graph_edge H = IMAGE f (cartesian UNIV UNIV)` SUBAGOAL_TAC;
44890 TYPE_THEN `H` UNABBREV_TAC;
44891 REWRITE_TAC[graph_edge_mk_graph];
44892 TYPE_THEN `graph_vertex H = IMAGE uA UNIV UNION IMAGE uB UNIV ` SUBAGOAL_TAC;
44893 TYPE_THEN `H` UNABBREV_TAC;
44894 REWRITE_TAC[graph_vertex_mk_graph];
44895 TYPE_THEN `graph_inc H = endpoint` SUBAGOAL_TAC;
44896 TYPE_THEN `H` UNABBREV_TAC;
44897 REWRITE_TAC[graph_inc_mk_graph];
44899 REWRITE_TAC[GSYM CONJ_ASSOC];
44901 REWRITE_TAC[graph];
44902 REWRITE_TAC[SUBSET];
44904 REWRITE_TAC[UNION];
44905 USE 9(REWRITE_RULE[IMAGE]);
44906 TYPE_THEN `x'` UNABBREV_TAC;
44909 USE 2(REWRITE_RULE[segment_end]);
44911 USE 10 (REWRITE_RULE[INR in_pair]);
44912 FIRST_ASSUM DISJ_CASES_TAC;
44913 REWRITE_TAC[IMAGE];
44915 REWRITE_TAC[IMAGE];
44917 IMATCH_MP_TAC endpoint_size2;
44919 USE 2(REWRITE_RULE[segment_end]);
44922 REWRITE_TAC[IMAGE;SUBSET;cartesian_univ];
44923 USE 2(REWRITE_RULE[segment_end]);
44930 FULL_REWRITE_TAC[IMAGE;cartesian_univ];
44931 PROOF_BY_CONTR_TAC;
44932 UND 5 THEN REWRITE_TAC[];
44934 FIRST_ASSUM IMATCH_MP_TAC ;
44938 FULL_REWRITE_TAC[IMAGE;cartesian_univ];
44939 FIRST_ASSUM IMATCH_MP_TAC ;
44940 TYPE_THEN `x'` UNABBREV_TAC;
44941 TYPE_THEN `e'` UNABBREV_TAC;
44944 TYPE_THEN `u = (\ x. (if (SND x) then (uA (FST x)) else uB(FST x)))` ABBREV_TAC ;
44945 TYPE_THEN `u` EXISTS_TAC;
44947 TYPE_THEN `f` EXISTS_TAC;
44948 TYPE_THEN `(u,f)` EXISTS_TAC;
44950 TYPE_THEN `!i j. ~(uA i = uB j)` SUBAGOAL_TAC;
44952 USE 2(MATCH_MP segment_end_disj);
44953 UND 2 THEN ASM_REWRITE_TAC[];
44958 REWRITE_TAC[INJ;cartesian_univ];
44960 TYPE_THEN `u` UNABBREV_TAC;
44962 REWRITE_TAC[IMAGE;UNION];
44964 REWRITE_TAC[IMAGE;UNION];
44966 REWRITE_TAC[PAIR_SPLIT];
44967 PROOF_BY_CONTR_TAC;
44968 FULL_REWRITE_TAC[DE_MORGAN_THM];
44970 TYPE_THEN `u` UNABBREV_TAC;
44971 TYPE_THEN `!x y. (uA (x) = uA (y)) ==> (x = y)` SUBAGOAL_TAC;
44972 USE 4 (REWRITE_RULE[INJ]);
44973 FIRST_ASSUM IMATCH_MP_TAC ;
44974 TYPE_THEN `!x y. (uB (x) = uB (y)) ==> (x = y)` SUBAGOAL_TAC;
44975 USE 3 (REWRITE_RULE[INJ]);
44976 FIRST_ASSUM IMATCH_MP_TAC ;
44977 UND 8 THEN REWRITE_TAC[DE_MORGAN_THM];
44978 KILL 0 THEN KILL 1 THEN KILL 2;
44979 UND 7 THEN COND_CASES_TAC THEN COND_CASES_TAC THEN ASM_MESON_TAC[];
44983 USE 7(REWRITE_RULE[INJ]);
44984 REWRITE_TAC[cartesian_univ];
44985 TYPE_THEN `u` UNABBREV_TAC;
44986 USE 8 (REWRITE_RULE[UNION]);
44987 FIRST_ASSUM DISJ_CASES_TAC;
44988 USE 8(REWRITE_RULE[IMAGE]);
44989 TYPE_THEN `(x',T)` EXISTS_TAC;
44990 USE 8(REWRITE_RULE[IMAGE]);
44991 TYPE_THEN `(x',F)` EXISTS_TAC;
44994 IMATCH_MP_TAC inj_bij;
44996 FIRST_ASSUM IMATCH_MP_TAC ;
44997 TYPE_THEN `f x` UNABBREV_TAC;
44998 FULL_REWRITE_TAC[INTER_IDEMPOT];
45000 FULL_REWRITE_TAC[segment_end;psegment;segment];
45004 FULL_REWRITE_TAC[segment_end];
45005 IMATCH_MP_TAC EQ_EXT;
45006 REWRITE_TAC[INR in_pair;IMAGE;k33_graph_inc];
45008 THM_INTRO_TAC[`u`;`cartesian (UNIV:three_t->bool) (UNIV:bool->bool)`;`(IMAGE uA UNIV UNION IMAGE uB UNIV)`] bij_imp_image;
45009 USE 10 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
45010 USE 10 (REWRITE_RULE[IMAGE ;cartesian_univ;UNION]);
45011 USE 10 (CONV_RULE (NAME_CONFLICT_CONV));
45012 IMATCH_MP_TAC EQ_ANTISYM;
45014 FIRST_ASSUM DISJ_CASES_TAC;
45015 TYPE_THEN `x` UNABBREV_TAC;
45016 TSPEC `uB (SND e)` 10;
45017 USE 10 (MATCH_MP (TAUT `(a <=> (b \/ c)) ==> (c ==> a)`));
45018 UND 10 THEN DISCH_THEN (THM_INTRO_TAC[]);
45020 TYPE_THEN`(SND e,F)` EXISTS_TAC;
45021 TYPE_THEN `u x'` UNABBREV_TAC;
45022 TYPE_THEN `u` UNABBREV_TAC;
45024 TYPE_THEN `x` UNABBREV_TAC;
45025 TSPEC `uA (FST e)` 10;
45026 USE 10 (MATCH_MP (TAUT `(a <=> (b \/ c)) ==> (b ==> a)`));
45027 UND 10 THEN DISCH_THEN (THM_INTRO_TAC[]);
45029 TYPE_THEN`(FST e,T)` EXISTS_TAC;
45030 TYPE_THEN `u x'` UNABBREV_TAC;
45031 TYPE_THEN `u` UNABBREV_TAC;
45033 FIRST_ASSUM DISJ_CASES_TAC ;
45034 TYPE_THEN `u` UNABBREV_TAC;
45035 TYPE_THEN `u` UNABBREV_TAC;
45039 let eq_exchange = prove_by_refinement(
45040 `!x a (b:A). (x = a) /\ (x = b) <=> (x = a) /\ (a = b)`,
45048 let rectagon_graph_k33_false = prove_by_refinement(
45049 `~(rectagonal_graph k33_graph)`,
45053 FULL_REWRITE_TAC[rectagonal_graph_k33];
45054 ASSUME_TAC k33_rectagon_hyp_false;
45056 TYPE_THEN `diag = (\ (i:three_t). f (i,i))` ABBREV_TAC ;
45057 TYPE_THEN `!i. diag i = f(i,i)` SUBAGOAL_TAC;
45058 TYPE_THEN `diag` UNABBREV_TAC;
45062 UND 5 THEN REWRITE_TAC[];
45063 REWRITE_TAC[k33_rectagon_hyp];
45064 TYPE_THEN `R = UNIONS { e | (?i j. ~(i = j) /\ (e = f (i,j)) ) }` ABBREV_TAC ;
45065 TYPE_THEN `R` EXISTS_TAC;
45067 TYPE_THEN `!i j. ~(uA i = uB j)` SUBAGOAL_TAC;
45069 USE 2(MATCH_MP segment_end_disj);
45072 TYPE_THEN `!i j. (uA i = uA j) <=> (i = j)` SUBAGOAL_TAC;
45073 IMATCH_MP_TAC EQ_ANTISYM ;
45074 USE 4 (REWRITE_RULE[INJ]);
45075 FIRST_ASSUM IMATCH_MP_TAC ;
45077 TYPE_THEN `!i j. (uB i = uB j) <=> (i = j)` SUBAGOAL_TAC;
45078 IMATCH_MP_TAC EQ_ANTISYM ;
45079 USE 3 (REWRITE_RULE[INJ]);
45080 FIRST_ASSUM IMATCH_MP_TAC ;
45082 TYPE_THEN `(!i j. ~(i = j) ==> (cls (f (i,i)) INTER cls (f (j,j)) = {}))` SUBAGOAL_TAC;
45083 UND 0 THEN DISCH_THEN ( THM_INTRO_TAC[`(i,i)`;`j,j`]);
45084 USE 0 (REWRITE_RULE[PAIR_SPLIT]);
45089 FULL_REWRITE_TAC[segment_end];
45090 IMATCH_MP_TAC EQ_EXT;
45091 REWRITE_TAC[INTER;INR in_pair];
45092 FIRST_ASSUM DISJ_CASES_TAC THEN (TYPE_THEN `x` UNABBREV_TAC);
45097 TYPE_THEN `(!i j. ~(i = j) ==> (f (i,i) INTER f (j,j) = {}))` SUBAGOAL_TAC;
45098 PROOF_BY_CONTR_TAC;
45099 UND 11 THEN ASM_REWRITE_TAC[];
45100 TYPE_THEN `(i,i) = (j,j)` BACK_TAC;
45101 USE 11(REWRITE_RULE[PAIR_SPLIT]);
45102 FIRST_ASSUM IMATCH_MP_TAC ;
45106 (* -B start main reduction *)
45107 TYPE_THEN `?A. (cls (A T) INTER cls (A F) SUBSET endpoint (f (i,i))) /\ (A T INTER A F = EMPTY ) /\ (A T UNION A F = R) /\ (!eps. psegment (A eps)) /\ (!j eps. ~(cls (f (j,j)) INTER cls (A eps) = EMPTY)) /\ (!eps. A eps INTER (f (i,i)) = EMPTY) /\ (!eps. endpoint (A eps) = endpoint (f(i,i))) /\ (!eps. (cls (A eps) INTER cls (f(i,i)) = endpoint (f(i,i))))` BACK_TAC;
45110 TYPE_THEN `A T` EXISTS_TAC;
45111 TYPE_THEN `A F` EXISTS_TAC;
45112 TYPE_THEN `(!j. ~(i = j) ==> (cls (f (j,j)) INTER cls (A T) INTER cls (A F) = {}))` SUBAGOAL_TAC;
45113 REWRITE_TAC[GSYM SUBSET_EMPTY];
45114 IMATCH_MP_TAC SUBSET_TRANS;
45115 TYPE_THEN `cls (f (j,j)) INTER cls(f (i,i))` EXISTS_TAC;
45116 REWRITE_TAC[SUBSET_EMPTY];
45118 IMATCH_MP_TAC subset_inter_pair;
45119 ASM_REWRITE_TAC[SUBSET_REFL];
45120 IMATCH_MP_TAC SUBSET_TRANS;
45121 TYPE_THEN `endpoint (f (i,i))` EXISTS_TAC;
45122 IMATCH_MP_TAC endpoint_cls;
45123 USE 2(REWRITE_RULE[segment_end;psegment;segment]);
45124 FIRST_ASSUM IMATCH_MP_TAC ;
45125 TYPE_THEN `j` UNABBREV_TAC;
45128 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
45130 ASM_REWRITE_TAC[psegment_triple];
45131 TYPE_THEN `cls (A T) INTER cls (A F) = endpoint (f (i,i))` SUBAGOAL_TAC;
45132 IMATCH_MP_TAC SUBSET_ANTISYM ;
45136 REWRITE_TAC[SUBSET_INTER];
45137 TYPE_THEN `FINITE (f(i,i))` SUBAGOAL_TAC;
45138 USE 2 (REWRITE_RULE[segment_end;psegment;segment]);
45141 IMATCH_MP_TAC endpoint_cls;
45142 USE 16(REWRITE_RULE[psegment;segment]);
45144 IMATCH_MP_TAC endpoint_cls;
45145 USE 16(REWRITE_RULE[psegment;segment]);
45147 FULL_REWRITE_TAC[segment_end];
45149 TYPE_THEN `endpoint (f (i,i)) = {(uA (i)), (uB(i))}` SUBAGOAL_TAC;
45150 USE 2 (REWRITE_RULE[segment_end]);
45152 TYPE_THEN `R` UNABBREV_TAC;
45154 IMATCH_MP_TAC segment_end_union_rectagon;
45155 TYPE_THEN `uA i` EXISTS_TAC;
45156 TYPE_THEN `uB i` EXISTS_TAC;
45157 ASM_REWRITE_TAC[segment_end];
45159 CONJ_TAC THEN IMATCH_MP_TAC segment_end_union_rectagon THEN TYPE_THEN `uA i` EXISTS_TAC THEN TYPE_THEN `uB i` EXISTS_TAC THEN ASM_REWRITE_TAC[segment_end];
45161 FULL_REWRITE_TAC[psegment_triple];
45163 TYPE_THEN `R` UNABBREV_TAC;
45165 THM_INTRO_TAC[`i`] bool_three_delete_bij;
45166 TYPE_THEN `!e. ~(b e = i)` SUBAGOAL_TAC;
45167 USE 12(REWRITE_RULE[BIJ;SURJ;DELETE ]);
45169 TYPE_THEN `!e e'. (b e = b e') <=> (e = e')` SUBAGOAL_TAC;
45170 USE 12 (REWRITE_RULE[BIJ;INJ]);
45171 IMATCH_MP_TAC EQ_ANTISYM;
45173 TYPE_THEN `!j. ~(j = i) ==> (?e. (j = b e))` SUBAGOAL_TAC;
45174 USE 12(REWRITE_RULE[BIJ;SURJ]);
45176 FIRST_ASSUM IMATCH_MP_TAC ;
45177 REWRITE_TAC[DELETE];
45178 TYPE_THEN `j` UNABBREV_TAC;
45180 TYPE_THEN `A = (\ (e: bool). f(i, b e) UNION f (b (~e),b e) UNION f (b(~e),i))` ABBREV_TAC ;
45181 TYPE_THEN `A` EXISTS_TAC;
45182 (* - now satisfy constraints *)
45183 TYPE_THEN `(!eps. A eps INTER f (i,i) = {})` SUBAGOAL_TAC;
45184 TYPE_THEN `A` UNABBREV_TAC;
45185 ONCE_REWRITE_TAC[INTER_COMM];
45186 REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
45187 REPEAT CONJ_TAC THEN PROOF_BY_CONTR_TAC THEN (UND 1 THEN DISCH_THEN (fun t -> RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT] o (TRY_RULE (MATCH_MP t))))) THEN ASM_MESON_TAC[];
45189 TYPE_THEN `(!eps. cls (A eps) INTER cls (f (i,i)) = endpoint (f (i,i)))` SUBAGOAL_TAC ;
45190 TYPE_THEN `A` UNABBREV_TAC;
45191 ONCE_REWRITE_TAC[INTER_COMM];
45192 FULL_REWRITE_TAC[UNION_OVER_INTER;cls_union];
45194 UND 0 THEN DISCH_THEN( THM_INTRO_TAC[`(i,i)`;`(i, b eps)`]);
45195 USE 0 (REWRITE_RULE[PAIR_SPLIT]);
45198 UND 16 THEN DISCH_THEN( THM_INTRO_TAC[`(i,i)`;`(b (~eps),i)`]);
45199 USE 16 (REWRITE_RULE[PAIR_SPLIT]);
45202 UND 18 THEN DISCH_THEN( THM_INTRO_TAC[`(i,i)`;`(b (~eps),b eps)`]);
45203 USE 18 (REWRITE_RULE[PAIR_SPLIT]);
45205 REWRITE_TAC[GSYM UNION_OVER_INTER];
45206 REWRITE_TAC[ONCE_REWRITE_RULE[EQ_SYM_EQ] SUBSET_INTER_ABSORPTION];
45207 USE 2 (REWRITE_RULE[segment_end]);
45208 REWRITE_TAC[SUBSET;UNION;INR in_pair ];
45209 FIRST_ASSUM DISJ_CASES_TAC;
45211 TYPE_THEN `(!j eps. ~(cls (f (j,j)) INTER cls (A eps) = {}))` SUBAGOAL_TAC;
45212 TYPE_THEN `j = i` ASM_CASES_TAC;
45213 TYPE_THEN `i` UNABBREV_TAC;
45214 USE 19 (ONCE_REWRITE_RULE[INTER_COMM]);
45218 FULL_REWRITE_TAC[segment_end];
45221 USE 2(REWRITE_RULE[EQ_EMPTY;INR in_pair]);
45223 TYPE_THEN `A` UNABBREV_TAC;
45224 FULL_REWRITE_TAC[cls_union];
45225 FULL_REWRITE_TAC[UNION_OVER_INTER;EMPTY_UNION];
45226 UND 15 THEN DISCH_THEN (THM_INTRO_TAC[`j`]);
45227 TYPE_THEN `j` UNABBREV_TAC;
45228 TYPE_THEN `j` UNABBREV_TAC;
45229 TYPE_THEN `(e = eps) \/ (e = ~eps)` SUBAGOAL_TAC;
45231 FIRST_ASSUM DISJ_CASES_TAC;
45232 TYPE_THEN `e` UNABBREV_TAC;
45233 UND 0 THEN DISCH_THEN ( THM_INTRO_TAC[`(b eps,b eps)`;`(i,b eps)`] );
45234 USE 0 (REWRITE_RULE[PAIR_SPLIT]);
45235 TYPE_THEN `i` UNABBREV_TAC;
45237 UND 21 THEN REWRITE_TAC[EMPTY_EXISTS ];
45238 REWRITE_TAC[INTER];
45239 FULL_REWRITE_TAC[segment_end;INR in_pair];
45240 FULL_REWRITE_TAC[segment_end;INR in_pair];
45241 TYPE_THEN `uB (b eps)` EXISTS_TAC;
45243 TYPE_THEN `e` UNABBREV_TAC;
45244 UND 0 THEN DISCH_THEN ( THM_INTRO_TAC[`(b (~eps),b (~eps))`;`(b (~eps),i)`] );
45245 USE 0 (REWRITE_RULE[PAIR_SPLIT]);
45246 TYPE_THEN `i` UNABBREV_TAC;
45248 UND 16 THEN REWRITE_TAC[EMPTY_EXISTS ];
45249 REWRITE_TAC[INTER];
45250 FULL_REWRITE_TAC[segment_end;INR in_pair];
45251 FULL_REWRITE_TAC[segment_end;INR in_pair];
45252 TYPE_THEN `uA (b (~eps))` EXISTS_TAC;
45254 TYPE_THEN `A T INTER A F = EMPTY ` SUBAGOAL_TAC;
45255 TYPE_THEN `A` UNABBREV_TAC;
45256 REWRITE_TAC[UNION_OVER_INTER];
45257 ONCE_REWRITE_TAC[INTER_COMM];
45258 REWRITE_TAC[UNION_OVER_INTER];
45259 REWRITE_TAC[EMPTY_UNION];
45260 TYPE_THEN `!i j. (f i INTER f j = EMPTY) <=> ~( i = j)` SUBAGOAL_TAC;
45261 IMATCH_MP_TAC EQ_ANTISYM;
45263 TYPE_THEN `i'` UNABBREV_TAC;
45264 FULL_REWRITE_TAC[INTER_IDEMPOT];
45266 TYPE_THEN `f j` UNABBREV_TAC;
45267 FULL_REWRITE_TAC[segment_end;psegment;segment];
45268 PROOF_BY_CONTR_TAC;
45269 UND 16 THEN REWRITE_TAC[];
45270 FIRST_ASSUM IMATCH_MP_TAC ;
45272 REWRITE_TAC[PAIR_SPLIT];
45274 TYPE_THEN `A T UNION A F = R` SUBAGOAL_TAC;
45275 TYPE_THEN `A` UNABBREV_TAC;
45276 TYPE_THEN `R` UNABBREV_TAC;
45277 IMATCH_MP_TAC SUBSET_ANTISYM;
45279 REWRITE_TAC[SUBSET;UNION;UNIONS];
45280 CONV_TAC (dropq_conv "u");
45281 UND 5 THEN REP_CASES_TAC THEN UNIFY_EXISTS_TAC;
45282 REWRITE_TAC[SUBSET;UNION;UNIONS];
45283 TYPE_THEN `u` UNABBREV_TAC;
45284 TYPE_THEN `!i'. (i' = i) \/ (i' = b T) \/ (i' = b F)` SUBAGOAL_TAC;
45285 TYPE_THEN`i'' = i` ASM_CASES_TAC;
45286 UND 15 THEN DISCH_THEN ( THM_INTRO_TAC[`i''`]);
45288 TYPE_THEN `e = T` ASM_CASES_TAC;
45294 JOIN 16 22 THEN FULL_REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
45295 UND 16 THEN REP_CASES_TAC THEN REWR 5 ;
45296 TYPE_THEN `j` UNABBREV_TAC;
45297 TYPE_THEN `i'` UNABBREV_TAC;
45299 TYPE_THEN `j` UNABBREV_TAC;
45300 TYPE_THEN `i'` UNABBREV_TAC;
45302 TYPE_THEN `j` UNABBREV_TAC;
45303 TYPE_THEN `i'` UNABBREV_TAC;
45307 TYPE_THEN `A` UNABBREV_TAC;
45308 REWRITE_TAC[cls_union];
45309 REWRITE_TAC[UNION_OVER_INTER];
45310 ONCE_REWRITE_TAC[INTER_COMM];
45311 REWRITE_TAC[UNION_OVER_INTER];
45312 REWRITE_TAC[union_subset];
45313 USE 2(REWRITE_RULE[segment_end]);
45314 USE 0 (REWRITE_RULE[PAIR_SPLIT]);
45316 REWRITE_TAC[INTER;SUBSET;INR in_pair];
45317 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
45318 ONCE_REWRITE_TAC[eq_exchange];
45326 TYPE_THEN `!eps. segment_end (A eps) (uA i) (uB i)` SUBAGOAL_TAC;
45327 TYPE_THEN `A` UNABBREV_TAC;
45328 THM_INTRO_TAC[`f (b (~eps),i)`;`f (b (~eps),b eps)`;`uB i`;`uA(b (~eps))`;`uB(b eps)`] segment_end_union;
45330 ONCE_REWRITE_TAC[segment_end_symm];
45331 TSPEC `(b (~eps),i)` 2;
45334 TSPEC `(b (~eps),b eps)` 2;
45336 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`(b (~eps),i)`;`(b (~eps),b eps)`]);
45337 USE 0(REWRITE_RULE[PAIR_SPLIT]);
45339 USE 2(REWRITE_RULE[segment_end]);
45340 IMATCH_MP_TAC EQ_EXT;
45341 REWRITE_TAC[INTER;INR in_pair;INR IN_SING;];
45342 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
45343 ONCE_REWRITE_TAC[eq_exchange];
45346 THM_INTRO_TAC[`f (i,b eps)`;`f (b (~eps),i) UNION f (b (~eps),b eps)`;`uA i`;`uB (b eps)`;`uB i`] segment_end_union;
45348 TSPEC `(i,b eps)` 2;
45351 ONCE_REWRITE_TAC[segment_end_symm];
45352 REWRITE_TAC[cls_union];
45354 UND 0 THEN DISCH_THEN ( THM_INTRO_TAC[`(i,b eps)`;`b (~eps),i`]);
45355 USE 0 (REWRITE_RULE[PAIR_SPLIT]);
45358 REWRITE_TAC[UNION_OVER_INTER];
45359 UND 17 THEN DISCH_THEN ( THM_INTRO_TAC[`(i,b eps)`;`b (~eps),(b eps)`]);
45360 USE 17 (REWRITE_RULE[PAIR_SPLIT]);
45362 USE 2(REWRITE_RULE[segment_end]);
45363 IMATCH_MP_TAC EQ_EXT;
45364 REWRITE_TAC[INTER;UNION;INR in_pair;INR IN_SING;];
45365 REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
45366 ONCE_REWRITE_TAC[eq_exchange];
45368 FULL_REWRITE_TAC[UNION_COMM];
45370 USE 17(REWRITE_RULE[segment_end]);
45371 USE 2 (REWRITE_RULE[segment_end]);
45378 (* ------------------------------------------------------------------ *)
45380 (* ------------------------------------------------------------------ *)
45383 (* Continue from SECTION Q.
45384 1.0.2 Rational approximation. *)
45386 (* work out homeo on graph_support_set properties *)
45387 (* apply h_translate (-- &1) o r_scale (&1/z) *)
45390 (* Let's go back and do it in a symmetric way for both cases. *)
45392 let eps_translate_def = jordan_def `eps_translate eps =
45393 if eps then h_translate else v_translate`;;
45395 let eps_translate = prove_by_refinement(
45396 `!eps r. eps_translate eps r = if eps then h_translate r else
45400 REWRITE_TAC[eps_translate_def];
45405 let homeomorphism_eps_translate = prove_by_refinement(
45406 `!eps r. homeomorphism (eps_translate eps r) top2 top2`,
45410 REWRITE_TAC[eps_translate];
45411 COND_CASES_TAC THEN REWRITE_TAC[h_translate_hom;v_translate_hom];
45415 let eps_hyper = jordan_def `eps_hyper eps z =
45416 if eps then hyperplane 2 e1 z else hyperplane 2 e2 z`;;
45418 let eps_hyper_translate = prove_by_refinement(
45419 `!eps r z. IMAGE (eps_translate eps r) (eps_hyper eps z) =
45420 (eps_hyper eps (z + r)) `,
45424 REWRITE_TAC[eps_translate;eps_hyper];
45425 COND_CASES_TAC THEN REWRITE_TAC[hyperplane1_h_translate;hyperplane2_v_translate];
45429 let eps_hyper_translate_perp = prove_by_refinement(
45430 `!eps r z. IMAGE (eps_translate eps r) (eps_hyper (~eps) z) =
45431 (eps_hyper (~eps) z) `,
45435 REWRITE_TAC[eps_translate;eps_hyper];
45436 COND_CASES_TAC THEN REWRITE_TAC[hyperplane2_h_translate;hyperplane1_v_translate];
45440 let eps_scale = jordan_def `eps_scale eps r =
45441 if eps then r_scale r else u_scale r`;;
45443 let eps_hyper_scale_perp = prove_by_refinement(
45444 `!eps r z. (&0 < r) ==>
45445 (IMAGE (eps_scale eps r) (eps_hyper (~eps) z) =
45446 (eps_hyper (~eps) z)) `,
45449 REWRITE_TAC[eps_scale;eps_hyper];
45450 COND_CASES_TAC THEN ASM_SIMP_TAC[hyperplane1_u_scale;hyperplane2_r_scale];
45454 let eps_hyper_scale = prove_by_refinement(
45455 `!eps r z. (&0 < r) ==>
45456 (IMAGE (eps_scale eps r) (eps_hyper (eps) z) =
45457 (eps_hyper (eps) (if (&0 < z) then r*z else z))) `,
45460 REWRITE_TAC[eps_scale;eps_hyper];
45461 COND_CASES_TAC THEN ASM_SIMP_TAC[hyperplane2_u_scale;hyperplane1_r_scale];
45465 let homeomorphism_eps_scale = prove_by_refinement(
45466 `!eps r. (&0 < r) ==> homeomorphism (eps_scale eps r) top2 top2`,
45469 REWRITE_TAC[eps_scale];
45470 COND_CASES_TAC THEN ASM_SIMP_TAC [u_scale_hom;r_scale_hom];
45474 let graph_support_eps = jordan_def `graph_support_eps G E <=>
45475 good_plane_graph G /\ FINITE E /\
45476 (!e. (graph_edge G e ==> e SUBSET UNIONS E)) /\
45477 (!v. (graph_vertex G v ==>
45478 E (eps_hyper T (v 0)) /\ E (eps_hyper F (v 1)))) /\
45479 (!e. (E e ==> (?z eps. (e = eps_hyper eps z)))) /\
45480 (!z eps. (z <= &0 /\ E (eps_hyper eps z) ==> (?j. z = -- &j)))`;;
45482 let iso_support_eps_pair = jordan_def
45483 `iso_support_eps_pair (G:(A,B)graph_t) =
45484 { (H,E) | (graph_isomorphic G H) /\ graph_support_eps H E }`;;
45486 let eps_hyper_ne = prove_by_refinement(
45487 `!z z' eps. ~(eps_hyper eps z = eps_hyper (~eps) z')`,
45490 REWRITE_TAC[eps_hyper];
45491 UND 0 THEN REPEAT COND_CASES_TAC THEN REWRITE_TAC[hyperplane_ne;GSYM hyperplane_ne] ;
45496 let eps_hyper_inj = prove_by_refinement(
45497 `!z z' eps eps'. (eps_hyper eps z = eps_hyper eps' z') <=>
45498 ((eps = eps') /\ (z = z'))`,
45502 TYPE_THEN`eps' = ~eps` ASM_CASES_TAC;
45503 TYPE_THEN `eps'` UNABBREV_TAC;
45504 REWRITE_TAC [eps_hyper_ne];
45506 TYPE_THEN `eps' = eps` SUBAGOAL_TAC;
45508 TYPE_THEN `eps'` UNABBREV_TAC;
45509 REWRITE_TAC[eps_hyper];
45510 COND_CASES_TAC THEN IMATCH_MP_TAC EQ_ANTISYM THEN CONJ_TAC;
45511 IMATCH_MP_TAC hyperplane1_inj;
45512 IMATCH_MP_TAC hyperplane2_inj;
45516 let iso_support_eps_nonempty = prove_by_refinement(
45517 `!(G:(A,B)graph_t). (planar_graph G) /\
45518 FINITE (graph_edge G) /\
45519 FINITE (graph_vertex G) /\
45520 ~(graph_edge G = {}) /\
45521 (!v. CARD (graph_edge_around G v) <=| 4) ==>
45522 ~(iso_support_eps_pair G = EMPTY) `,
45525 REWRITE_TAC[iso_support_eps_pair];
45526 TH_INTRO_TAC [`G`] graph_support_init;
45527 UND 0 THEN REWRITE_TAC[EMPTY_EXISTS];
45528 CONV_TAC (dropq_conv "u");
45529 REWRITE_TAC[graph_support_eps];
45533 REWRITE_TAC[eps_hyper];
45535 TYPE_THEN `(!e. E e ==> (?z eps. (&0 < z) /\ (e = eps_hyper eps z)))` SUBAGOAL_TAC;
45536 UND 6 THEN DISCH_THEN (THM_INTRO_TAC[`e`]);
45537 FIRST_ASSUM DISJ_CASES_TAC ;
45538 TYPE_THEN`z` EXISTS_TAC;
45539 TYPE_THEN `T` EXISTS_TAC;
45540 REWRITE_TAC[eps_hyper];
45541 TYPE_THEN`z` EXISTS_TAC;
45542 TYPE_THEN `F` EXISTS_TAC;
45543 REWRITE_TAC[eps_hyper];
45546 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`e`]);
45549 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`eps_hyper eps z`]);
45550 FULL_REWRITE_TAC[eps_hyper_inj];
45551 TYPE_THEN `z'` UNABBREV_TAC;
45552 PROOF_BY_CONTR_TAC;
45553 UND 14 THEN UND 13 THEN REAL_ARITH_TAC;
45557 let count_iso_eps_pair = jordan_def
45558 `count_iso_eps_pair ((H:(A,B)graph_t),E) =
45559 CARD { e | (?z eps. (&0 < z) /\ E e /\ (e = eps_hyper eps z)) }`;;
45561 let iso_support_eps_finite = prove_by_refinement(
45562 `!(G:(A,B)graph_t) H E. iso_support_eps_pair G (H,E) ==> FINITE
45563 { e | (?z eps. (&0 < z) /\ E e /\ (e = eps_hyper eps z)) }`,
45566 REWRITE_TAC[iso_support_eps_pair ;PAIR_SPLIT; graph_support_eps;];
45567 TYPE_THEN `E'` UNABBREV_TAC;
45568 IMATCH_MP_TAC FINITE_SUBSET;
45569 TYPE_THEN `E` EXISTS_TAC;
45570 REWRITE_TAC[SUBSET];
45574 let iso_eps_support0 = prove_by_refinement(
45575 `!(G:(A,B)graph_t) H E. iso_support_eps_pair G (H,E) /\
45576 (count_iso_eps_pair (H,E) = 0) ==>
45577 good_plane_graph H /\ FINITE E /\
45578 (!e. (graph_edge H e ==> e SUBSET UNIONS E)) /\
45579 (!v. (graph_vertex H v ==>
45580 E (eps_hyper T (v 0)) /\ E (eps_hyper F (v 1)))) /\
45581 (!e. (E e ==> (?z eps. (e = eps_hyper eps z) ))) /\
45582 (!z eps. (E (eps_hyper eps z) ==> (?j. z = -- &j)))
45586 REWRITE_TAC[count_iso_eps_pair;];
45587 TYPE_THEN `A = { e | (?z eps. (&0 < z) /\ E e /\ (e = eps_hyper eps z)) }` ABBREV_TAC ;
45588 TYPE_THEN `A HAS_SIZE 0` SUBAGOAL_TAC;
45589 REWRITE_TAC[HAS_SIZE];
45590 TYPE_THEN `A` UNABBREV_TAC;
45591 TH_INTRO_TAC[`G`;`H`;`E`] iso_support_eps_finite;
45592 RULE_ASSUM_TAC (REWRITE_RULE[PAIR_SPLIT;graph_support_eps;iso_support_eps_pair]);
45593 TYPE_THEN `E'` UNABBREV_TAC;
45594 TYPE_THEN `H'` UNABBREV_TAC;
45595 FIRST_ASSUM IMATCH_MP_TAC ;
45596 TYPE_THEN`eps` EXISTS_TAC;
45597 FULL_REWRITE_TAC[HAS_SIZE_0];
45598 TYPE_THEN `A` UNABBREV_TAC;
45599 PROOF_BY_CONTR_TAC;
45600 USE 2 (MATCH_MP (REAL_ARITH `~( z <= &0) ==> (&0 < z)`));
45601 UND 3 THEN REWRITE_TAC[EMPTY_EXISTS];
45602 CONV_TAC (dropq_conv "u");
45607 let iso_support_eps_min = prove_by_refinement(
45608 `!(G:(A,B)graph_t) H E. iso_support_eps_pair G (H,E) /\
45609 (0 < count_iso_eps_pair (H,E)) ==>
45610 (?z eps. (&0 < z) /\ E (eps_hyper eps z) /\
45611 (!w. (&0 < w /\ w < z) ==> ~(E (eps_hyper eps w))))`,
45614 REWRITE_TAC[count_iso_eps_pair];
45615 TYPE_THEN `A = {e | ?z eps. &0 < z /\ E e /\ (e = eps_hyper eps z)}` ABBREV_TAC ;
45616 TYPE_THEN `FINITE A` SUBAGOAL_TAC;
45617 TH_INTRO_TAC[`G`;`H`;`E`] iso_support_eps_finite;
45618 TYPE_THEN `A` UNABBREV_TAC;
45619 TYPE_THEN `~(A HAS_SIZE 0) ` SUBAGOAL_TAC;
45620 RULE_ASSUM_TAC (REWRITE_RULE[HAS_SIZE]);
45621 UND 4 THEN UND 0 THEN ARITH_TAC;
45622 RULE_ASSUM_TAC (REWRITE_RULE[HAS_SIZE_0;EMPTY_EXISTS]);
45623 TYPE_THEN `?r eps. (u = eps_hyper eps r)` SUBAGOAL_TAC;
45624 TYPE_THEN `A` UNABBREV_TAC;
45626 TYPE_THEN `u` UNABBREV_TAC;
45628 TH_INTRO_TAC[`{z | &0 < z}`;`eps_hyper eps`;`{e | ?z. (&0 < z) /\ E e /\ (e = eps_hyper eps z)}`] finite_subset;
45629 REWRITE_TAC[SUBSET;IMAGE];
45631 TYPE_THEN `z` EXISTS_TAC;
45633 IMATCH_MP_TAC FINITE_SUBSET;
45634 TYPE_THEN `A` EXISTS_TAC;
45635 TYPE_THEN `A` UNABBREV_TAC;
45636 REWRITE_TAC[SUBSET];
45639 TYPE_THEN `~(C = EMPTY)` SUBAGOAL_TAC;
45640 TYPE_THEN `C` UNABBREV_TAC;
45641 RULE_ASSUM_TAC (REWRITE_RULE[IMAGE_CLAUSES;SUBSET_EMPTY]);
45642 UND 5 THEN REWRITE_TAC[EMPTY_EXISTS];
45643 TYPE_THEN `A` UNABBREV_TAC;
45645 FULL_REWRITE_TAC[eps_hyper_inj];
45646 TYPE_THEN `inf C` EXISTS_TAC;
45648 TYPE_THEN `C (inf C)` SUBAGOAL_TAC;
45649 IMATCH_MP_TAC finite_inf;
45651 TYPE_THEN `(!z. C z ==> inf C <= z)` SUBAGOAL_TAC THENL[IMATCH_MP_TAC finite_inf_min;ALL_TAC ];
45652 TYPE_THEN `z = inf C` ABBREV_TAC ;
45656 TYPE_THEN `eps` EXISTS_TAC;
45657 USE 5(REWRITE_RULE[IMAGE]);
45658 USE 5(ONCE_REWRITE_RULE[FUN_EQ_THM]);
45660 TSPEC `eps_hyper eps z` 5;
45661 USE 5(REWRITE_RULE[INR IN_SING]);
45662 USE 5(MATCH_MP (TAUT `(a <=> b) ==> (b ==> a)`));
45663 UND 5 THEN DISCH_THEN (THM_INTRO_TAC[]);
45666 FULL_REWRITE_TAC[eps_hyper_inj];
45667 TYPE_THEN `z'` UNABBREV_TAC;
45670 TSPEC `eps_hyper eps w` 8;
45671 USE 8(MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`));
45672 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[]);
45673 TYPE_THEN `w` EXISTS_TAC;
45675 FULL_REWRITE_TAC[eps_hyper_inj];
45676 TYPE_THEN `x` UNABBREV_TAC;
45677 UND 10 THEN DISCH_THEN (THM_INTRO_TAC[`w`]);
45678 UND 8 THEN UND 13 THEN REAL_ARITH_TAC;
45682 let graph_eps_scale_image = prove_by_refinement(
45683 `!G E eps r. (&0 < r) /\ graph_support_eps G E ==> graph_support_eps
45684 (plane_graph_image (eps_scale eps r)G)
45685 (IMAGE2 (eps_scale eps r) E)
45689 REWRITE_TAC[graph_support_eps];
45690 THM_INTRO_TAC[`eps`;`r`] homeomorphism_eps_scale;
45692 IMATCH_MP_TAC plane_graph_image_plane;
45694 REWRITE_TAC[plane_graph_image_e;plane_graph_image_v];
45696 REWRITE_TAC[IMAGE2];
45697 IMATCH_MP_TAC FINITE_IMAGE;
45700 FULL_REWRITE_TAC[IMAGE2];
45701 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45702 USE 10 (REWRITE_RULE[IMAGE]);
45703 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45704 FULL_REWRITE_TAC [SUBSET;UNIONS];
45705 REWRITE_TAC[IMAGE];
45706 CONV_TAC (dropq_conv "u");
45707 TYPE_THEN `im` UNABBREV_TAC;
45708 USE 3(CONV_RULE NAME_CONFLICT_CONV);
45709 USE 13 (REWRITE_RULE[IMAGE]);
45710 TYPE_THEN `x'` UNABBREV_TAC;
45713 TYPE_THEN `u'` EXISTS_TAC;
45714 REWRITE_TAC[IMAGE];
45719 FULL_REWRITE_TAC[IMAGE2];
45720 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45721 REWRITE_TAC[IMAGE];
45722 TYPE_THEN `im` UNABBREV_TAC;
45723 USE 11(REWRITE_RULE[IMAGE]);
45724 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45728 TYPE_THEN `eps = T` ASM_CASES_TAC;
45729 ASM_SIMP_TAC [eps_hyper_scale;eps_hyper_inj];
45730 REWRITE_TAC[eps_scale;r_scale];
45732 TYPE_THEN `eps = F` SUBAGOAL_TAC;
45734 TYPE_THEN `eps` UNABBREV_TAC;
45735 THM_INTRO_TAC[`F`;`r`;`x 0`] eps_hyper_scale_perp;
45737 REWRITE_TAC[eps_scale;u_scale];
45740 TYPE_THEN `eps_hyper F (x 1)` EXISTS_TAC;
45741 TYPE_THEN `eps = F` ASM_CASES_TAC;
45742 ASM_SIMP_TAC [eps_hyper_scale;eps_hyper_inj];
45743 REWRITE_TAC[eps_scale;u_scale];
45745 TYPE_THEN `eps = T` SUBAGOAL_TAC;
45747 TYPE_THEN `eps` UNABBREV_TAC;
45748 THM_INTRO_TAC[`T`;`r`;`x 1`] eps_hyper_scale_perp;
45750 REWRITE_TAC[eps_scale;r_scale];
45754 USE 12(REWRITE_RULE[IMAGE2]);
45755 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45756 USE 12(REWRITE_RULE[IMAGE]);
45757 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45758 TYPE_THEN `im` UNABBREV_TAC;
45760 TYPE_THEN `eps'` EXISTS_TAC;
45761 TYPE_THEN `eps' = ~eps` ASM_CASES_TAC;
45762 ASM_SIMP_TAC [eps_hyper_scale_perp];
45764 TYPE_THEN `eps' = eps` SUBAGOAL_TAC;
45765 UND 13 THEN MESON_TAC[];
45766 ASM_SIMP_TAC[eps_hyper_scale];
45769 FIRST_ASSUM IMATCH_MP_TAC ;
45770 TYPE_THEN `eps'` EXISTS_TAC;
45771 FULL_REWRITE_TAC[IMAGE2];
45772 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45773 USE 12 (REWRITE_RULE[IMAGE]);
45774 TYPE_THEN `im` UNABBREV_TAC;
45775 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45777 TYPE_THEN `eps'' = ~eps` ASM_CASES_TAC;
45778 UND 12 THEN ASM_SIMP_TAC[eps_hyper_scale_perp];
45779 TYPE_THEN `x` UNABBREV_TAC;
45780 TYPE_THEN `eps''` UNABBREV_TAC;
45781 TYPE_THEN `eps'' = eps` SUBAGOAL_TAC;
45782 UND 14 THEN MESON_TAC[];
45783 TYPE_THEN `eps''` UNABBREV_TAC;
45784 UND 12 THEN ASM_SIMP_TAC[eps_hyper_scale];
45785 FULL_REWRITE_TAC[eps_hyper_inj];
45786 UND 12 THEN COND_CASES_TAC;
45787 TYPE_THEN `z` UNABBREV_TAC;
45788 TYPE_THEN `&0 < r * z'` SUBAGOAL_TAC;
45789 IMATCH_MP_TAC REAL_LT_MUL;
45790 PROOF_BY_CONTR_TAC;
45791 UND 12 THEN UND 13 THEN REAL_ARITH_TAC;
45792 TYPE_THEN `z'` UNABBREV_TAC;
45793 TYPE_THEN `x` UNABBREV_TAC;
45797 let graph_eps_scale_image = prove_by_refinement(
45798 `!G E eps r. (&0 < r) /\ graph_support_eps G E ==> graph_support_eps
45799 (plane_graph_image (eps_scale eps r)G)
45800 (IMAGE2 (eps_scale eps r) E)
45804 REWRITE_TAC[graph_support_eps];
45805 THM_INTRO_TAC[`eps`;`r`] homeomorphism_eps_scale;
45807 IMATCH_MP_TAC plane_graph_image_plane;
45809 REWRITE_TAC[plane_graph_image_e;plane_graph_image_v];
45811 REWRITE_TAC[IMAGE2];
45812 IMATCH_MP_TAC FINITE_IMAGE;
45815 FULL_REWRITE_TAC[IMAGE2];
45816 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45817 USE 10 (REWRITE_RULE[IMAGE]);
45818 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45819 FULL_REWRITE_TAC [SUBSET;UNIONS];
45820 REWRITE_TAC[IMAGE];
45821 CONV_TAC (dropq_conv "u");
45822 TYPE_THEN `im` UNABBREV_TAC;
45823 USE 3(CONV_RULE NAME_CONFLICT_CONV);
45824 USE 13 (REWRITE_RULE[IMAGE]);
45825 TYPE_THEN `x'` UNABBREV_TAC;
45828 TYPE_THEN `u'` EXISTS_TAC;
45829 REWRITE_TAC[IMAGE];
45834 FULL_REWRITE_TAC[IMAGE2];
45835 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45836 REWRITE_TAC[IMAGE];
45837 TYPE_THEN `im` UNABBREV_TAC;
45838 USE 11(REWRITE_RULE[IMAGE]);
45839 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45843 TYPE_THEN `eps = T` ASM_CASES_TAC;
45844 ASM_SIMP_TAC [eps_hyper_scale;eps_hyper_inj];
45845 REWRITE_TAC[eps_scale;r_scale];
45847 TYPE_THEN `eps = F` SUBAGOAL_TAC;
45849 TYPE_THEN `eps` UNABBREV_TAC;
45850 THM_INTRO_TAC[`F`;`r`;`x 0`] eps_hyper_scale_perp;
45852 REWRITE_TAC[eps_scale;u_scale];
45855 TYPE_THEN `eps_hyper F (x 1)` EXISTS_TAC;
45856 TYPE_THEN `eps = F` ASM_CASES_TAC;
45857 ASM_SIMP_TAC [eps_hyper_scale;eps_hyper_inj];
45858 REWRITE_TAC[eps_scale;u_scale];
45860 TYPE_THEN `eps = T` SUBAGOAL_TAC;
45862 TYPE_THEN `eps` UNABBREV_TAC;
45863 THM_INTRO_TAC[`T`;`r`;`x 1`] eps_hyper_scale_perp;
45865 REWRITE_TAC[eps_scale;r_scale];
45869 USE 12(REWRITE_RULE[IMAGE2]);
45870 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45871 USE 12(REWRITE_RULE[IMAGE]);
45872 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45873 TYPE_THEN `im` UNABBREV_TAC;
45875 TYPE_THEN `eps'` EXISTS_TAC;
45876 TYPE_THEN `eps' = ~eps` ASM_CASES_TAC;
45877 ASM_SIMP_TAC [eps_hyper_scale_perp];
45879 TYPE_THEN `eps' = eps` SUBAGOAL_TAC;
45880 UND 13 THEN MESON_TAC[];
45881 ASM_SIMP_TAC[eps_hyper_scale];
45884 FIRST_ASSUM IMATCH_MP_TAC ;
45885 TYPE_THEN `eps'` EXISTS_TAC;
45886 FULL_REWRITE_TAC[IMAGE2];
45887 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
45888 USE 12 (REWRITE_RULE[IMAGE]);
45889 TYPE_THEN `im` UNABBREV_TAC;
45890 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45892 TYPE_THEN `eps'' = ~eps` ASM_CASES_TAC;
45893 UND 12 THEN ASM_SIMP_TAC[eps_hyper_scale_perp];
45894 TYPE_THEN `x` UNABBREV_TAC;
45895 TYPE_THEN `eps''` UNABBREV_TAC;
45896 TYPE_THEN `eps'' = eps` SUBAGOAL_TAC;
45897 UND 14 THEN MESON_TAC[];
45898 TYPE_THEN `eps''` UNABBREV_TAC;
45899 UND 12 THEN ASM_SIMP_TAC[eps_hyper_scale];
45900 FULL_REWRITE_TAC[eps_hyper_inj];
45901 UND 12 THEN COND_CASES_TAC;
45902 TYPE_THEN `z` UNABBREV_TAC;
45903 TYPE_THEN `&0 < r * z'` SUBAGOAL_TAC;
45904 IMATCH_MP_TAC REAL_LT_MUL;
45905 PROOF_BY_CONTR_TAC;
45906 UND 12 THEN UND 13 THEN REAL_ARITH_TAC;
45907 TYPE_THEN `z'` UNABBREV_TAC;
45908 TYPE_THEN `x` UNABBREV_TAC;
45912 let graph_eps_translate_image = prove_by_refinement(
45913 `!G E eps r. (?j. -- &j = r) /\
45914 (!w. (&0 < w /\ w < -- r) ==> ~(E (eps_hyper eps w))) /\
45915 graph_support_eps G E ==>
45917 (plane_graph_image (eps_translate eps r)G)
45918 (IMAGE2 (eps_translate eps r) E)
45922 REWRITE_TAC[graph_support_eps];
45923 THM_INTRO_TAC[`eps`;`r`] homeomorphism_eps_translate;
45925 IMATCH_MP_TAC plane_graph_image_plane;
45927 REWRITE_TAC[plane_graph_image_e;plane_graph_image_v];
45929 REWRITE_TAC[IMAGE2];
45930 IMATCH_MP_TAC FINITE_IMAGE;
45933 FULL_REWRITE_TAC[IMAGE2];
45934 TYPE_THEN `im = IMAGE (eps_translate eps r)` ABBREV_TAC ;
45935 USE 11 (REWRITE_RULE[IMAGE]);
45936 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45937 FULL_REWRITE_TAC [SUBSET;UNIONS];
45938 REWRITE_TAC[IMAGE];
45939 CONV_TAC (dropq_conv "u");
45940 TYPE_THEN `im` UNABBREV_TAC;
45941 USE 3(CONV_RULE NAME_CONFLICT_CONV);
45942 USE 14 (REWRITE_RULE[IMAGE]);
45943 TYPE_THEN `x'` UNABBREV_TAC;
45946 TYPE_THEN `u'` EXISTS_TAC;
45947 REWRITE_TAC[IMAGE];
45952 FULL_REWRITE_TAC[IMAGE2];
45953 TYPE_THEN `im = IMAGE (eps_translate eps r)` ABBREV_TAC ;
45954 REWRITE_TAC[IMAGE];
45955 TYPE_THEN `im` UNABBREV_TAC;
45956 USE 12(REWRITE_RULE[IMAGE]);
45957 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45961 TYPE_THEN `eps = T` ASM_CASES_TAC;
45962 ASM_SIMP_TAC [eps_hyper_translate;eps_hyper_inj];
45963 REWRITE_TAC[eps_translate;h_translate];
45964 REWRITE_TAC[euclid_plus;e1;point_scale];
45966 TYPE_THEN `eps = F` SUBAGOAL_TAC;
45968 TYPE_THEN `eps` UNABBREV_TAC;
45969 THM_INTRO_TAC[`F`;`r`;`x 0`] eps_hyper_translate_perp;
45970 FULL_REWRITE_TAC [];
45972 REWRITE_TAC[eps_translate;v_translate];
45973 REWRITE_TAC[euclid_plus;e2;point_scale];
45976 TYPE_THEN `eps_hyper F (x 1)` EXISTS_TAC;
45977 TYPE_THEN `eps = F` ASM_CASES_TAC;
45978 ASM_SIMP_TAC [eps_hyper_translate;eps_hyper_inj];
45979 REWRITE_TAC[eps_translate;v_translate];
45980 REWRITE_TAC[euclid_plus;e2;point_scale];
45982 TYPE_THEN `eps = T` SUBAGOAL_TAC;
45984 TYPE_THEN `eps` UNABBREV_TAC;
45985 THM_INTRO_TAC[`T`;`r`;`x 1`] eps_hyper_translate_perp;
45986 FULL_REWRITE_TAC[];
45988 REWRITE_TAC[eps_translate;h_translate];
45989 REWRITE_TAC[euclid_plus;e1;point_scale];
45993 USE 13(REWRITE_RULE[IMAGE2]);
45994 TYPE_THEN `im = IMAGE (eps_translate eps r)` ABBREV_TAC ;
45995 USE 13(REWRITE_RULE[IMAGE]);
45996 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
45997 TYPE_THEN `im` UNABBREV_TAC;
45999 TYPE_THEN `eps'` EXISTS_TAC;
46000 TYPE_THEN `eps' = ~eps` ASM_CASES_TAC;
46001 ASM_SIMP_TAC [eps_hyper_translate_perp];
46003 TYPE_THEN `eps' = eps` SUBAGOAL_TAC;
46004 UND 14 THEN MESON_TAC[];
46005 ASM_SIMP_TAC[eps_hyper_translate];
46008 TYPE_THEN `eps' = ~eps` ASM_CASES_TAC;
46009 TYPE_THEN `eps'` UNABBREV_TAC;
46010 FIRST_ASSUM IMATCH_MP_TAC ;
46011 TYPE_THEN `~eps` EXISTS_TAC;
46012 FULL_REWRITE_TAC[IMAGE2];
46013 TYPE_THEN `im = IMAGE (eps_translate eps r)` ABBREV_TAC ;
46014 USE 13 (REWRITE_RULE[IMAGE]);
46015 TYPE_THEN `im` UNABBREV_TAC;
46016 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
46018 TYPE_THEN `eps' = ~eps` ASM_CASES_TAC;
46019 UND 13 THEN ASM_SIMP_TAC[eps_hyper_translate_perp];
46020 TYPE_THEN `x` UNABBREV_TAC;
46021 TYPE_THEN `eps'` UNABBREV_TAC;
46022 TYPE_THEN `eps' = eps` SUBAGOAL_TAC;
46023 UND 15 THEN MESON_TAC[];
46024 TYPE_THEN `eps'` UNABBREV_TAC;
46025 UND 13 THEN ASM_SIMP_TAC[eps_hyper_translate];
46026 FULL_REWRITE_TAC[eps_hyper_inj];
46027 UND 17 THEN MESON_TAC[];
46029 TYPE_THEN `eps' = eps` SUBAGOAL_TAC;
46030 UND 15 THEN MESON_TAC[];
46031 TYPE_THEN`eps'` UNABBREV_TAC;
46032 TYPE_THEN `E(eps_hyper eps (z + &j))` SUBAGOAL_TAC;
46033 FULL_REWRITE_TAC[IMAGE2];
46034 TYPE_THEN `im = IMAGE (eps_translate eps r)` ABBREV_TAC ;
46035 USE 13 (REWRITE_RULE[IMAGE]);
46036 TYPE_THEN `im` UNABBREV_TAC;
46037 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
46039 TYPE_THEN `eps'' = ~eps` ASM_CASES_TAC;
46040 UND 13 THEN ASM_SIMP_TAC[eps_hyper_translate_perp];
46041 FULL_REWRITE_TAC[eps_hyper_inj];
46042 UND 18 THEN MESON_TAC[];
46043 TYPE_THEN `eps'' = eps` SUBAGOAL_TAC;
46044 UND 16 THEN MESON_TAC[];
46045 TYPE_THEN `eps''` UNABBREV_TAC;
46046 FULL_REWRITE_TAC[eps_hyper_translate;eps_hyper_inj];
46047 TYPE_THEN `r` UNABBREV_TAC;
46048 TYPE_THEN `x` UNABBREV_TAC;
46049 TYPE_THEN `!a. (z' + (-- a)) + a = z'` SUBAGOAL_TAC;
46052 TYPE_THEN `z = &0` ASM_CASES_TAC;
46053 TYPE_THEN `0` EXISTS_TAC;
46055 UND 0 THEN DISCH_THEN ( THM_INTRO_TAC[`z + &j`;`eps`]);
46056 IMATCH_MP_TAC (REAL_ARITH `~(&0 < z + &j) ==> (z + &j <= &0)`);
46057 UND 6 THEN DISCH_THEN (THM_INTRO_TAC[`z + &j`]);
46058 TYPE_THEN `r` UNABBREV_TAC;
46059 UND 17 THEN UND 14 THEN REAL_ARITH_TAC;
46060 UND 6 THEN REWRITE_TAC[];
46061 TYPE_THEN `j +| j'` EXISTS_TAC;
46062 UND 0 THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC;
46066 let count_iso_scale = prove_by_refinement(
46067 `!G E eps r. (&0 < r) /\ graph_support_eps G E ==>
46068 (count_iso_eps_pair (G,E) = count_iso_eps_pair
46069 ((plane_graph_image(eps_scale eps r) G),
46070 (IMAGE2 (eps_scale eps r) E))) `,
46073 REWRITE_TAC[count_iso_eps_pair];
46074 THM_INTRO_TAC[`G`;`E`;`eps`;`r`] graph_eps_scale_image;
46075 FULL_REWRITE_TAC[graph_support_eps];
46076 IMATCH_MP_TAC BIJ_CARD;
46077 TYPE_THEN `IMAGE (eps_scale eps r)` EXISTS_TAC;
46079 IMATCH_MP_TAC FINITE_SUBSET ;
46080 TYPE_THEN `E` EXISTS_TAC;
46081 REWRITE_TAC[SUBSET];
46083 FULL_REWRITE_TAC [plane_graph_image_e;plane_graph_image_v];
46084 FULL_REWRITE_TAC[IMAGE2];
46085 TYPE_THEN `im = IMAGE (eps_scale eps r)` ABBREV_TAC ;
46091 TYPE_THEN `if (eps = eps') then r* z else z` EXISTS_TAC;
46092 TYPE_THEN `eps'` EXISTS_TAC;
46095 IMATCH_MP_TAC REAL_LT_MUL;
46097 IMATCH_MP_TAC image_imp;
46098 TYPE_THEN `x` UNABBREV_TAC;
46099 TYPE_THEN `im` UNABBREV_TAC;
46101 ASM_SIMP_TAC[eps_hyper_scale];
46102 TYPE_THEN `eps' = ~eps` SUBAGOAL_TAC;
46103 UND 13 THEN MESON_TAC[];
46104 ASM_SIMP_TAC[eps_hyper_scale_perp];
46105 TYPE_THEN `x` UNABBREV_TAC;
46106 TYPE_THEN `y` UNABBREV_TAC;
46107 TYPE_THEN `im` UNABBREV_TAC;
46108 TYPE_THEN `(eps' = eps) \/ (eps' = ~eps)` SUBAGOAL_TAC;
46110 TYPE_THEN `(eps'' = eps) \/ (eps'' = ~eps)` SUBAGOAL_TAC;
46112 REWRITE_TAC[eps_hyper_inj];
46113 JOIN 13 15 THEN FULL_REWRITE_TAC[LEFT_AND_OVER_OR;RIGHT_AND_OVER_OR];
46114 UND 13 THEN REP_CASES_TAC THEN UND 14 THEN ASM_SIMP_TAC[eps_hyper_scale;eps_hyper_scale_perp;eps_hyper_inj] THEN REWRITE_TAC[TAUT `((eps = ~eps) <=> F) /\ ((~eps = eps) <=> F)`];
46115 IMATCH_MP_TAC REAL_EQ_LCANCEL_IMP;
46116 TYPE_THEN `r` EXISTS_TAC;
46117 UND 1 THEN REAL_ARITH_TAC;
46121 FULL_REWRITE_TAC[INJ];
46122 FIRST_ASSUM IMATCH_MP_TAC ;
46125 CONV_TAC (dropq_conv "y");
46126 TYPE_THEN `x` UNABBREV_TAC;
46128 TYPE_THEN `eps'` EXISTS_TAC;
46129 USE 16 (REWRITE_RULE[IMAGE]);
46130 UND 8 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
46131 TYPE_THEN `x` UNABBREV_TAC;
46132 TYPE_THEN `z'` EXISTS_TAC;
46133 TYPE_THEN `(eps'' = eps') /\ (z = if (eps = eps'') then r*z' else z')` SUBAGOAL_TAC;
46134 TYPE_THEN `im` UNABBREV_TAC;
46136 TYPE_THEN `eps''` UNABBREV_TAC;
46137 UND 15 THEN ASM_SIMP_TAC [eps_hyper_scale;eps_hyper_inj];
46140 TYPE_THEN `eps'' = ~eps` SUBAGOAL_TAC;
46141 UND 8 THEN MESON_TAC[];
46142 TYPE_THEN `eps''` UNABBREV_TAC;
46143 UND 15 THEN ASM_SIMP_TAC [eps_hyper_scale_perp;eps_hyper_inj];
46145 TYPE_THEN `eps''` UNABBREV_TAC;
46147 UND 17 THEN COND_CASES_TAC;
46148 THM_INTRO_TAC[`r`;`z'`] REAL_LT_LMUL_0;
46154 let count_iso_translate = prove_by_refinement(
46155 `!G E eps . graph_support_eps G E /\
46156 (!w. (&0 < w /\ w < &1) ==> ~(E (eps_hyper eps w))) /\
46157 E (eps_hyper eps (&1)) ==>
46158 (count_iso_eps_pair (G,E) = SUC(count_iso_eps_pair
46159 ((plane_graph_image(eps_translate eps (-- &1)) G),
46160 (IMAGE2 (eps_translate eps (-- &1)) E)))) `,
46163 REWRITE_TAC[count_iso_eps_pair];
46164 TYPE_THEN `A = {e | ?z eps. &0 < z /\ E e /\ (e = eps_hyper eps z)}` ABBREV_TAC ;
46165 TYPE_THEN `A (eps_hyper eps (&1))` SUBAGOAL_TAC;
46166 TYPE_THEN`A` UNABBREV_TAC;
46167 TYPE_THEN `&1` EXISTS_TAC;
46170 TYPE_THEN`FINITE A` SUBAGOAL_TAC;
46171 FULL_REWRITE_TAC[graph_support_eps];
46172 IMATCH_MP_TAC FINITE_SUBSET;
46173 TYPE_THEN `E` EXISTS_TAC;
46174 TYPE_THEN `A` UNABBREV_TAC;
46175 REWRITE_TAC[SUBSET];
46177 THM_INTRO_TAC[`(eps_hyper eps (&1))`;`A`]CARD_SUC_DELETE;
46178 TYPE_THEN `CARD A` UNABBREV_TAC;
46179 REWRITE_TAC[SUC_INJ];
46180 THM_INTRO_TAC[`G`;`E`;`eps`;`-- &1`] graph_eps_translate_image;
46183 FULL_REWRITE_TAC[REAL_ARITH `-- -- x = x`];
46185 FULL_REWRITE_TAC[graph_support_eps];
46187 IMATCH_MP_TAC BIJ_CARD;
46188 TYPE_THEN `IMAGE (eps_translate eps (-- &1))` EXISTS_TAC;
46190 IMATCH_MP_TAC FINITE_DELETE_IMP;
46192 FULL_REWRITE_TAC [plane_graph_image_e;plane_graph_image_v];
46193 FULL_REWRITE_TAC[IMAGE2];
46194 TYPE_THEN `im = IMAGE (eps_translate eps (-- &1))` ABBREV_TAC ;
46200 TYPE_THEN `A` UNABBREV_TAC;
46201 FULL_REWRITE_TAC[DELETE];
46202 TYPE_THEN `x` UNABBREV_TAC;
46203 FULL_REWRITE_TAC[eps_hyper_inj];
46204 TYPE_THEN `z` UNABBREV_TAC;
46205 TYPE_THEN `if (eps = eps'') then z' - &1 else z'` EXISTS_TAC;
46206 TYPE_THEN `eps''` EXISTS_TAC;
46207 TYPE_THEN `eps'` UNABBREV_TAC;
46210 TYPE_THEN `eps''` UNABBREV_TAC;
46211 IMATCH_MP_TAC (REAL_ARITH `~((z' = &1) \/ (z' < &1)) ==> (&0 < z' - &1)`);
46213 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`z'`]);
46214 UND 1 THEN ASM_REWRITE_TAC[];
46217 IMATCH_MP_TAC image_imp;
46218 TYPE_THEN `im` UNABBREV_TAC;
46220 ASM_SIMP_TAC[eps_hyper_translate];
46223 TYPE_THEN `eps'' = ~eps` SUBAGOAL_TAC;
46224 UND 3 THEN MESON_TAC[];
46225 ASM_SIMP_TAC[eps_hyper_translate_perp];
46226 TYPE_THEN `A` UNABBREV_TAC;
46227 FULL_REWRITE_TAC[DELETE];
46228 TYPE_THEN `x` UNABBREV_TAC; (* -// *)
46229 TYPE_THEN `y` UNABBREV_TAC;
46230 TYPE_THEN `im` UNABBREV_TAC;
46231 TYPE_THEN `(eps''' = eps) \/ (eps''' = ~eps)` SUBAGOAL_TAC;
46233 TYPE_THEN `(eps'' = eps) \/ (eps'' = ~eps)` SUBAGOAL_TAC;
46235 REWRITE_TAC[eps_hyper_inj];
46236 JOIN 17 20 THEN FULL_REWRITE_TAC[LEFT_AND_OVER_OR;RIGHT_AND_OVER_OR];
46237 UND 17 THEN REP_CASES_TAC THEN UND 18 THEN ASM_SIMP_TAC[eps_hyper_translate;eps_hyper_translate_perp;eps_hyper_inj] THEN REWRITE_TAC[TAUT `((eps = ~eps) <=> F) /\ ((~eps = eps) <=> F)`];
46238 UND 17 THEN REAL_ARITH_TAC;
46241 FULL_REWRITE_TAC[INJ];
46244 TYPE_THEN `x` UNABBREV_TAC;
46245 TYPE_THEN `A` UNABBREV_TAC;
46246 REWRITE_TAC[DELETE];
46247 CONV_TAC (dropq_conv "y"); (* -// *)
46249 TYPE_THEN `eps'` EXISTS_TAC;
46252 FULL_REWRITE_TAC[eps_hyper_inj];
46253 TYPE_THEN `z'` UNABBREV_TAC;
46254 TYPE_THEN `eps''` UNABBREV_TAC;
46256 USE 21 (REWRITE_RULE[IMAGE]);
46257 UND 12 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
46258 TYPE_THEN `x` UNABBREV_TAC;
46259 TYPE_THEN `z''` EXISTS_TAC;
46260 TYPE_THEN `(eps'' = eps') /\ (z = if (eps = eps'') then z'' - &1 else z'')` SUBAGOAL_TAC;
46261 TYPE_THEN `im` UNABBREV_TAC;
46263 TYPE_THEN `eps''` UNABBREV_TAC;
46264 USE 3 (REWRITE_RULE [eps_hyper_translate;eps_hyper_inj]);
46266 TYPE_THEN `eps'' = ~eps` SUBAGOAL_TAC;
46267 UND 12 THEN MESON_TAC[];
46268 TYPE_THEN `eps''` UNABBREV_TAC;
46269 USE 3 (REWRITE_RULE[ eps_hyper_translate_perp;eps_hyper_inj]);
46271 TYPE_THEN `eps''` UNABBREV_TAC;
46272 TYPE_THEN `z` UNABBREV_TAC;
46274 UND 22 THEN COND_CASES_TAC;
46275 UND 12 THEN REAL_ARITH_TAC;
46276 TYPE_THEN `z''` UNABBREV_TAC;
46277 TYPE_THEN `eps'` UNABBREV_TAC;
46278 UND 22 THEN REAL_ARITH_TAC;
46282 let iso_support_min_int = prove_by_refinement(
46283 `!G:(A,B)graph_t H E. iso_support_eps_pair G (H,E) /\
46284 (0 <| count_iso_eps_pair (H,E)) ==>
46285 (?H' E'. iso_support_eps_pair G (H',E') /\
46286 (count_iso_eps_pair(H',E') = count_iso_eps_pair(H,E)) /\
46287 (?eps. E' (eps_hyper eps (&1)) /\
46288 (!w. (&0 < w /\ w < &1) ==> ~(E'(eps_hyper eps w)))))`,
46292 THM_INTRO_TAC[`G`;`H`;`E`] iso_support_eps_min;
46293 TYPE_THEN `z' = &1/z` ABBREV_TAC ;
46294 TYPE_THEN `H' = plane_graph_image (eps_scale eps z') H` ABBREV_TAC ;
46295 TYPE_THEN `E' = IMAGE2 (eps_scale eps z') E` ABBREV_TAC ;
46296 TYPE_THEN `H'` EXISTS_TAC;
46297 TYPE_THEN `E'` EXISTS_TAC;
46299 TYPE_THEN `&0 < z'` SUBAGOAL_TAC;
46300 TYPE_THEN `z'` UNABBREV_TAC;
46302 TYPE_THEN `z' * z = &1` SUBAGOAL_TAC;
46303 TYPE_THEN `z'` UNABBREV_TAC;
46304 IMATCH_MP_TAC REAL_DIV_RMUL;
46305 UND 5 THEN UND 4 THEN REAL_ARITH_TAC;
46308 FULL_REWRITE_TAC[iso_support_eps_pair];
46309 FULL_REWRITE_TAC[PAIR_SPLIT];
46310 TYPE_THEN `E''` UNABBREV_TAC;
46311 TYPE_THEN `H''` UNABBREV_TAC;
46312 TYPE_THEN `H'` EXISTS_TAC;
46313 TYPE_THEN `E'` EXISTS_TAC;
46314 TYPE_THEN `H'` UNABBREV_TAC;
46315 TYPE_THEN `E'` UNABBREV_TAC;
46317 THM_INTRO_TAC[`eps_scale eps z'`;`H`] plane_graph_image_iso;
46318 ASM_SIMP_TAC [homeomorphism_eps_scale];
46319 FULL_REWRITE_TAC[graph_support_eps;good_plane_graph];
46320 THM_INTRO_TAC[`G`;`H`;`(plane_graph_image (eps_scale eps z') H)`] graph_isomorphic_trans;
46321 IMATCH_MP_TAC graph_eps_scale_image;
46324 ONCE_REWRITE_TAC[EQ_SYM_EQ];
46325 TYPE_THEN `E'` UNABBREV_TAC;
46326 TYPE_THEN `H'` UNABBREV_TAC;
46327 IMATCH_MP_TAC count_iso_scale;
46328 FULL_REWRITE_TAC[iso_support_eps_pair;PAIR_SPLIT];
46330 TYPE_THEN `eps` EXISTS_TAC;
46331 TYPE_THEN `E'` UNABBREV_TAC;
46334 REWRITE_TAC[IMAGE2];
46335 TYPE_THEN `im = IMAGE (eps_scale eps z')` ABBREV_TAC ;
46336 REWRITE_TAC[IMAGE];
46337 TYPE_THEN `eps_hyper eps z` EXISTS_TAC;
46338 TYPE_THEN `im` UNABBREV_TAC;
46339 ASM_SIMP_TAC [eps_hyper_scale];
46341 FULL_REWRITE_TAC[IMAGE2];
46342 TYPE_THEN `im = IMAGE (eps_scale eps z')` ABBREV_TAC ;
46343 USE 7(REWRITE_RULE[IMAGE]);
46344 TYPE_THEN `im` UNABBREV_TAC;
46345 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[ `z*w` ]);
46347 IMATCH_MP_TAC REAL_LT_MUL;
46348 IMATCH_MP_TAC (REAL_ARITH `z * w < z* &1 ==> z*w < z`);
46349 IMATCH_MP_TAC REAL_LT_LMUL;
46350 TYPE_THEN `x = eps_hyper eps (z * w)` SUBAGOAL_TAC;
46351 USE 1 (REWRITE_RULE[iso_support_eps_pair;PAIR_SPLIT]);
46352 TYPE_THEN `E''` UNABBREV_TAC;
46353 USE 17 (REWRITE_RULE[graph_support_eps]);
46354 UND 17 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
46355 TYPE_THEN `x` UNABBREV_TAC;
46356 REWRITE_TAC[eps_hyper_inj];
46357 TYPE_THEN `eps' = eps` ASM_CASES_TAC;
46358 TYPE_THEN `eps'` UNABBREV_TAC;
46359 UND 7 THEN ASM_SIMP_TAC[eps_hyper_scale;eps_hyper_inj];
46361 UND 9 THEN REWRITE_TAC[REAL_MUL_AC];
46362 ASM_REWRITE_TAC [REAL_MUL_ASSOC];
46365 TYPE_THEN `eps' = ~eps` SUBAGOAL_TAC;
46366 UND 17 THEN MESON_TAC[];
46367 TYPE_THEN `eps'` UNABBREV_TAC;
46368 UND 7 THEN ASM_SIMP_TAC[eps_hyper_scale_perp;eps_hyper_inj];
46369 TYPE_THEN `x` UNABBREV_TAC;
46370 UND 2 THEN ASM_REWRITE_TAC[];
46376 let iso_int_model_lemma = prove_by_refinement(
46377 `!(G:(A,B)graph_t) . (planar_graph G) /\
46378 FINITE (graph_edge G) /\
46379 FINITE (graph_vertex G) /\
46380 ~(graph_edge G = {}) /\
46381 (!v. CARD (graph_edge_around G v) <=| 4) ==>
46382 (?H E. iso_support_eps_pair G (H,E) /\
46383 (count_iso_eps_pair (H,E) = 0))`,
46387 TYPE_THEN `c = count_iso_eps_pair:((num->real,(num->real)->bool)graph_t#(((num->real)->bool)->bool))->num` ABBREV_TAC ;
46388 THM_INTRO_TAC[`G`] iso_support_eps_nonempty;
46389 THM_INTRO_TAC[`iso_support_eps_pair G`;`c`] select_image_num_min;
46390 UND 6 THEN ASM_REWRITE_TAC[];
46391 TYPE_THEN `?H E. z = H,E` SUBAGOAL_TAC ;
46392 REWRITE_TAC[PAIR_SPLIT];
46394 TYPE_THEN `z` UNABBREV_TAC;
46395 TYPE_THEN `H` EXISTS_TAC;
46396 TYPE_THEN `E` EXISTS_TAC;
46397 TYPE_THEN `c` UNABBREV_TAC;
46398 IMATCH_MP_TAC (ARITH_RULE `~(0 < x) ==> (x = 0)`);
46399 THM_INTRO_TAC[`G`;`H`;`E`] iso_support_min_int;
46400 THM_INTRO_TAC[`H'`;`E'`;`eps`] count_iso_translate;
46402 FULL_REWRITE_TAC[iso_support_eps_pair;PAIR_SPLIT];
46404 TYPE_THEN `H'' = plane_graph_image (eps_translate eps (-- &1)) H'` ABBREV_TAC ;
46405 TYPE_THEN `E'' = IMAGE2 (eps_translate eps ( -- &1)) E'`ABBREV_TAC ;
46406 UND 7 THEN DISCH_THEN (THM_INTRO_TAC[ `(H'',E'')`]);
46407 TYPE_THEN `H''` UNABBREV_TAC;
46408 TYPE_THEN `E''` UNABBREV_TAC;
46409 REWRITE_TAC[iso_support_eps_pair;PAIR_SPLIT];
46410 CONV_TAC (dropq_conv "H");
46411 CONV_TAC (dropq_conv "E");
46414 TYPE_THEN `graph_isomorphic H' (plane_graph_image (eps_translate eps (-- &1)) H')` SUBAGOAL_TAC;
46415 IMATCH_MP_TAC plane_graph_image_iso;
46416 REWRITE_TAC[homeomorphism_eps_translate;];
46417 USE 12 (REWRITE_RULE[iso_support_eps_pair;graph_support_eps;good_plane_graph;PAIR_SPLIT]);
46419 THM_INTRO_TAC[`G`;`H'`;`(plane_graph_image (eps_translate eps (-- &1)) H')`] graph_isomorphic_trans;
46420 USE 12 (REWRITE_RULE[iso_support_eps_pair;PAIR_SPLIT]);
46423 IMATCH_MP_TAC graph_eps_translate_image;
46426 ASM_REWRITE_TAC[ARITH_RULE `-- (-- x) = x`];
46427 USE 12 (REWRITE_RULE[iso_support_eps_pair;PAIR_SPLIT]);
46429 UND 7 THEN UND 13 THEN UND 11 THEN ARITH_TAC;
46434 let graph_int_model = prove_by_refinement(
46435 `!(G:(A,B)graph_t) . (planar_graph G) /\
46436 FINITE (graph_edge G) /\
46437 FINITE (graph_vertex G) /\
46438 ~(graph_edge G = {}) /\
46439 (!v. CARD (graph_edge_around G v) <=| 4) ==>
46441 graph_isomorphic G H /\
46442 good_plane_graph H /\
46444 (!e. graph_edge H e ==> e SUBSET UNIONS E) /\
46445 (!v. graph_vertex H v
46446 ==> E (eps_hyper T (v 0)) /\ E (eps_hyper F (v 1))) /\
46447 (!e. E e ==> (?z eps. e = eps_hyper eps z)) /\
46448 (!z eps. E (eps_hyper eps z) ==> (?j. z = -- &j))
46453 THM_INTRO_TAC[`G`]iso_int_model_lemma;
46454 TYPE_THEN `H` EXISTS_TAC;
46455 TYPE_THEN `E` EXISTS_TAC;
46456 THM_INTRO_TAC[`G`;`H`;`E`] iso_eps_support0;
46458 FULL_REWRITE_TAC[iso_support_eps_pair;PAIR_SPLIT];
46463 (* ------------------------------------------------------------------ *)
46465 (* ------------------------------------------------------------------ *)
46467 (* if a graph has an int model then it is a rectagonal graph *)
46468 (* k33_nonplanar proved! *)
46471 let h_edge_ball = prove_by_refinement(
46472 `!m. h_edge m SUBSET open_ball
46473 (euclid 2,d_euclid)
46474 (pointI m + (&1/ &2)*# e1) (&1 / &2)`,
46478 REWRITE_TAC[h_edge;open_ball;SUBSET;euclid_point;e1;point_scale;pointI;point_add];
46479 REWRITE_TAC[euclid_point;];
46480 TYPE_THEN `v` UNABBREV_TAC;
46482 REWRITE_TAC[d_euclid_point];
46484 TYPE_THEN `0 **| 2 = 0` SUBAGOAL_TAC;
46485 REWRITE_TAC[EXP_EQ_0];
46486 UND 0 THEN ARITH_TAC;
46488 REWRITE_TAC[POW_2_SQRT_ABS];
46489 FULL_REWRITE_TAC[int_add_th;int_of_num_th];
46490 REWRITE_TAC[GSYM REAL_ABS_BETWEEN];
46492 REWRITE_TAC[REAL_LT_HALF1];
46494 REWRITE_TAC[REAL_LT_SUB_RADD];
46495 REWRITE_TAC[GSYM REAL_ADD_ASSOC;REAL_HALF_DOUBLE];
46496 UND 2 THEN REAL_ARITH_TAC;
46501 let v_edge_ball = prove_by_refinement(
46502 `!m. v_edge m SUBSET open_ball
46503 (euclid 2,d_euclid)
46504 (pointI m + (&1/ &2)*# e2) (&1 / &2)`,
46507 REWRITE_TAC[v_edge;open_ball;SUBSET;euclid_point;e2;point_scale;pointI;point_add];
46508 REWRITE_TAC[euclid_point;];
46509 TYPE_THEN `u` UNABBREV_TAC;
46511 REWRITE_TAC[d_euclid_point];
46513 TYPE_THEN `0 **| 2 = 0` SUBAGOAL_TAC;
46514 REWRITE_TAC[EXP_EQ_0];
46515 UND 0 THEN ARITH_TAC;
46517 REWRITE_TAC[POW_2_SQRT_ABS];
46518 FULL_REWRITE_TAC[int_add_th;int_of_num_th];
46519 REWRITE_TAC[GSYM REAL_ABS_BETWEEN];
46521 REWRITE_TAC[REAL_LT_HALF1];
46523 REWRITE_TAC[REAL_LT_SUB_RADD];
46524 REWRITE_TAC[GSYM REAL_ADD_ASSOC;REAL_HALF_DOUBLE];
46525 UND 2 THEN REAL_ARITH_TAC;
46529 let sqrt_frac = prove_by_refinement(
46530 `!n m. sqrt ((&n/ &m) pow 2) = &n/ (&m) `,
46534 IMATCH_MP_TAC POW_2_SQRT;
46535 IMATCH_MP_TAC REAL_LE_DIV;
46536 REWRITE_TAC[REAL_POS];
46540 let abs_dest_int_half = prove_by_refinement(
46541 `!m. &1 / &2 <= abs (real_of_int m - &1 / &2)`,
46545 IMATCH_MP_TAC REAL_LE_LCANCEL_IMP;
46546 TYPE_THEN `&2` EXISTS_TAC;
46549 TYPE_THEN `&2 * (&1/ &2) = &1` SUBAGOAL_TAC;
46550 IMATCH_MP_TAC REAL_DIV_LMUL;
46551 UND 0 THEN REAL_ARITH_TAC;
46552 TYPE_THEN `&2 = abs (&2)` SUBAGOAL_TAC;
46554 TYPE_THEN`!x. &2 * abs x = abs (&2 * x)` SUBAGOAL_TAC;
46555 UND 1 THEN REAL_ARITH_TAC;
46557 REWRITE_TAC[REAL_SUB_LDISTRIB];
46558 REWRITE_TAC[GSYM int_of_num_th;GSYM int_mul_th;GSYM int_sub_th;GSYM int_abs_th;GSYM int_le];
46559 TYPE_THEN `!x. ~(&:0 = ||: x) ==> (&:1 <= ||: x)` SUBAGOAL_TAC;
46560 THM_INTRO_TAC[`x`] INT_ABS_POS;
46561 UND 3 THEN UND 4 THEN INT_ARITH_TAC;
46562 FIRST_ASSUM IMATCH_MP_TAC ;
46564 FULL_REWRITE_TAC[INT_ABS_ZERO];
46565 THM_INTRO_TAC[`m`] INT_REP;
46566 TYPE_THEN`m` UNABBREV_TAC;
46567 FULL_REWRITE_TAC[INT_OF_NUM_MUL;INT_SUB_LDISTRIB;INT_EQ_SUB_RADD;INT_OF_NUM_ADD;INT_OF_NUM_EQ;];
46568 UND 4 THEN REDUCE_TAC ;
46569 TYPE_THEN `ODD (2 *| n)` SUBAGOAL_TAC;
46570 REWRITE_TAC[ODD_EXISTS];
46571 TYPE_THEN `m'` EXISTS_TAC;
46574 TYPE_THEN `EVEN (2 *| n)` SUBAGOAL_TAC;
46575 REWRITE_TAC[EVEN_EXISTS];
46577 ASM_MESON_TAC[EVEN_AND_ODD];
46581 let REAL_LT_SQUARE_ABS = prove_by_refinement(
46582 `!x y. abs x < abs y <=> x pow 2 < y pow 2`,
46586 REWRITE_TAC[REAL_ARITH `x < y <=> (x <= y /\ ~(y <= x))`];
46587 MESON_TAC[REAL_LE_SQUARE_ABS];
46591 let h_edge_closed_ball = prove_by_refinement(
46592 `!e m. edge e /\ ~(e INTER closed_ball
46593 (euclid 2,d_euclid)
46594 (pointI m + (&1/ &2)*# e1) (&1 / &2) = EMPTY) ==>
46598 REWRITE_TAC[edge;closed_ball;SUBSET;euclid_point;point_add;e1;e2;INTER;point_scale;EMPTY_EXISTS ;d_euclid_point ] THEN REDUCE_TAC;
46600 FIRST_ASSUM DISJ_CASES_TAC;
46601 TYPE_THEN `e` UNABBREV_TAC;
46602 PROOF_BY_CONTR_TAC;
46603 USE 1 (MATCH_MP point_onto);
46604 TYPE_THEN `u` UNABBREV_TAC;
46606 FULL_REWRITE_TAC[point_add;pointI;d_euclid_point;v_edge;point_inj];
46607 TYPE_THEN `p` UNABBREV_TAC;
46608 TYPE_THEN `u'` UNABBREV_TAC;
46609 USE 0 (MATCH_MP (REAL_ARITH `x <= y ==> ~( y < x)`));
46610 UND 0 THEN REWRITE_TAC[];
46611 TYPE_THEN `!x. (&1/ &2 < x) <=> sqrt((&1/ &2) pow 2) < x` SUBAGOAL_TAC;
46612 REWRITE_TAC[sqrt_frac];
46613 IMATCH_MP_TAC SQRT_MONO_LT;
46614 IMATCH_MP_TAC (REAL_ARITH `(x <= u /\ &0 < v) ==> x < u + v` );
46617 REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS];
46618 TYPE_THEN `abs (&1/ &2) = &1 / &2` SUBAGOAL_TAC;
46619 REWRITE_TAC[REAL_ABS_DIV;ABS_N];
46620 ONCE_REWRITE_TAC [GSYM REAL_ABS_NEG];
46621 TYPE_THEN `--((real_of_int (FST m) + &1 / &2) - real_of_int (FST m')) = (real_of_int (FST m' - FST m)) - &1 / &2 ` SUBAGOAL_TAC;
46622 REWRITE_TAC[int_sub_th];
46624 REWRITE_TAC[abs_dest_int_half];
46626 IMATCH_MP_TAC (REAL_ARITH `&0 <= y /\ ~(y = &0) ==> &0 < y`);
46628 USE 1 (MATCH_MP POW_ZERO);
46629 TYPE_THEN `v = real_of_int (SND m)` SUBAGOAL_TAC;
46630 UND 1 THEN REAL_ARITH_TAC;
46631 TYPE_THEN `v` UNABBREV_TAC;
46632 FULL_REWRITE_TAC[GSYM int_lt];
46633 UND 3 THEN UND 5 THEN INT_ARITH_TAC;
46635 REWRITE_TAC[cell_clauses];
46636 TYPE_THEN `e` UNABBREV_TAC;
46637 FULL_REWRITE_TAC[h_edge];
46638 TYPE_THEN `v` UNABBREV_TAC;
46639 TYPE_THEN `u` UNABBREV_TAC;
46640 FULL_REWRITE_TAC[edge;closed_ball;SUBSET;euclid_point;pointI;point_add;e1;e2;INTER;point_scale;EMPTY_EXISTS ;d_euclid_point ] THEN REDUCE_TAC;
46641 REWRITE_TAC[PAIR_SPLIT];
46642 PROOF_BY_CONTR_TAC;
46643 FULL_REWRITE_TAC[DE_MORGAN_THM];
46645 USE 0 (MATCH_MP (REAL_ARITH `x <= y ==> ~( y < x)`));
46646 UND 0 THEN REWRITE_TAC[];
46647 TYPE_THEN `!x. (&1/ &2 < x) <=> sqrt((&1/ &2) pow 2) < x` SUBAGOAL_TAC;
46648 REWRITE_TAC[sqrt_frac];
46649 IMATCH_MP_TAC SQRT_MONO_LT;
46651 FIRST_ASSUM DISJ_CASES_TAC;
46652 IMATCH_MP_TAC (REAL_ARITH `(x < u /\ &0 <= v) ==> x < u + v` );
46654 REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS];
46655 TYPE_THEN `abs (&1/ &2) = &1 / &2` SUBAGOAL_TAC;
46656 REWRITE_TAC[REAL_ABS_DIV;ABS_N];
46658 TYPE_THEN `!x y. x < abs y <=> (&0 <= y /\ x < y) \/ (y < &0 /\ x < -- y)` SUBAGOAL_TAC;
46660 TYPE_THEN `&1 / &2 < (real_of_int (FST m) + &1 / &2) - u'` ASM_CASES_TAC;
46662 IMATCH_MP_TAC REAL_LE_TRANS;
46663 TYPE_THEN `&1 / &2` EXISTS_TAC;
46665 IMATCH_MP_TAC REAL_LE_DIV;
46667 UND 9 THEN REAL_ARITH_TAC;
46669 TYPE_THEN `real_of_int (FST m) + &1 < u'` BACK_TAC;
46671 IMATCH_MP_TAC REAL_LT_TRANS;
46672 TYPE_THEN `real_of_int (FST m) + &1 - u'` EXISTS_TAC;
46674 TYPE_THEN `&1 / &2 < &1` SUBAGOAL_TAC;
46675 REWRITE_TAC[REAL_LT_HALF2];
46676 UND 11 THEN REAL_ARITH_TAC;
46677 UND 10 THEN REAL_ARITH_TAC;
46678 THM_INTRO_TAC[`&1`] REAL_HALF_DOUBLE;
46679 UND 11 THEN DISCH_THEN (fun t-> USE 10 (ONCE_REWRITE_RULE[GSYM t]));
46680 UND 10 THEN REAL_ARITH_TAC;
46682 PROOF_BY_CONTR_TAC;
46683 TYPE_THEN `u' <= real_of_int (FST m) + &1` SUBAGOAL_TAC;
46684 UND 10 THEN REAL_ARITH_TAC;
46685 TYPE_THEN `real_of_int (FST m) <= u'` SUBAGOAL_TAC;
46686 UND 9 THEN REAL_ARITH_TAC;
46687 TYPE_THEN `~(u' = real_of_int (FST m) + &1)` SUBAGOAL_TAC;
46688 TYPE_THEN `u'` UNABBREV_TAC;
46689 FULL_REWRITE_TAC[GSYM int_le;GSYM int_lt;GSYM int_of_num_th;GSYM int_add_th;];
46690 UND 7 THEN UND 5 THEN UND 6 THEN INT_ARITH_TAC;
46691 TYPE_THEN `u' < real_of_int (FST m) + &1` SUBAGOAL_TAC;
46692 UND 13 THEN UND 11 THEN ARITH_TAC;
46694 TYPE_THEN `floor u' = (FST m')` SUBAGOAL_TAC;
46695 FULL_REWRITE_TAC[int_add_th;int_of_num_th];
46696 ASM_REWRITE_TAC[floor_range];
46697 UND 6 THEN REAL_ARITH_TAC;
46699 TYPE_THEN `floor u' = FST m` SUBAGOAL_TAC;
46700 REWRITE_TAC[floor_range];
46702 (* -C different second coord *)
46703 IMATCH_MP_TAC (REAL_ARITH `x < z /\ &0 <= y ==> x < y + z`);
46704 REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS];
46706 IMATCH_MP_TAC REAL_LTE_TRANS;
46707 TYPE_THEN `&1` EXISTS_TAC;
46710 REWRITE_TAC[REAL_ABS_DIV;REAL_ABS_NUM];
46711 REWRITE_TAC[REAL_LT_HALF2];
46712 REWRITE_TAC[GSYM int_sub_th;GSYM int_abs_th;GSYM int_le; GSYM int_of_num_th;];
46713 UND 7 THEN INT_ARITH_TAC;
46717 let v_edge_closed_ball = prove_by_refinement(
46718 `!e m. edge e /\ ~(e INTER closed_ball
46719 (euclid 2,d_euclid)
46720 (pointI m + (&1/ &2)*# e2) (&1 / &2) = EMPTY) ==>
46724 REWRITE_TAC[edge;closed_ball;SUBSET;euclid_point;point_add;e1;e2;INTER;point_scale;EMPTY_EXISTS ;d_euclid_point ] THEN REDUCE_TAC;
46726 USE 4 (MATCH_MP (TAUT `a \/ b ==> b \/ a`));
46727 FIRST_ASSUM DISJ_CASES_TAC;
46728 TYPE_THEN `e` UNABBREV_TAC;
46729 PROOF_BY_CONTR_TAC;
46730 USE 1 (MATCH_MP point_onto);
46731 TYPE_THEN `u` UNABBREV_TAC;
46733 FULL_REWRITE_TAC[point_add;pointI;d_euclid_point;h_edge;point_inj];
46734 TYPE_THEN `p` UNABBREV_TAC;
46735 TYPE_THEN `v ` UNABBREV_TAC;
46736 USE 0 (MATCH_MP (REAL_ARITH `x <= y ==> ~( y < x)`));
46737 UND 0 THEN REWRITE_TAC[];
46738 TYPE_THEN `!x. (&1/ &2 < x) <=> sqrt((&1/ &2) pow 2) < x` SUBAGOAL_TAC;
46739 REWRITE_TAC[sqrt_frac];
46740 IMATCH_MP_TAC SQRT_MONO_LT;
46741 IMATCH_MP_TAC (REAL_ARITH `(x <= v /\ &0 < u) ==> x < u + v` );
46744 REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS];
46745 TYPE_THEN `abs (&1/ &2) = &1 / &2` SUBAGOAL_TAC;
46746 REWRITE_TAC[REAL_ABS_DIV;ABS_N];
46747 ONCE_REWRITE_TAC [GSYM REAL_ABS_NEG];
46748 TYPE_THEN `--((real_of_int (SND m) + &1 / &2) - real_of_int (SND m')) = (real_of_int (SND m' - SND m)) - &1 / &2 ` SUBAGOAL_TAC;
46749 REWRITE_TAC[int_sub_th];
46751 REWRITE_TAC[abs_dest_int_half];
46753 IMATCH_MP_TAC (REAL_ARITH `&0 <= y /\ ~(y = &0) ==> &0 < y`);
46755 USE 1 (MATCH_MP POW_ZERO);
46756 TYPE_THEN `u' = real_of_int (FST m)` SUBAGOAL_TAC;
46757 UND 1 THEN REAL_ARITH_TAC;
46758 TYPE_THEN `u'` UNABBREV_TAC;
46759 FULL_REWRITE_TAC[GSYM int_lt];
46760 UND 3 THEN UND 5 THEN INT_ARITH_TAC;
46762 REWRITE_TAC[cell_clauses];
46763 TYPE_THEN `e` UNABBREV_TAC;
46764 FULL_REWRITE_TAC[v_edge];
46765 TYPE_THEN `u` UNABBREV_TAC;
46766 TYPE_THEN `u'` UNABBREV_TAC;
46767 FULL_REWRITE_TAC[edge;closed_ball;SUBSET;euclid_point;pointI;point_add;e1;e2;INTER;point_scale;EMPTY_EXISTS ;d_euclid_point ] THEN REDUCE_TAC;
46768 REWRITE_TAC[PAIR_SPLIT];
46769 PROOF_BY_CONTR_TAC;
46770 FULL_REWRITE_TAC[DE_MORGAN_THM];
46772 USE 0 (MATCH_MP (REAL_ARITH `x <= y ==> ~( y < x)`));
46773 UND 0 THEN REWRITE_TAC[];
46774 TYPE_THEN `!x. (&1/ &2 < x) <=> sqrt((&1/ &2) pow 2) < x` SUBAGOAL_TAC;
46775 REWRITE_TAC[sqrt_frac];
46776 IMATCH_MP_TAC SQRT_MONO_LT;
46778 USE 3 (MATCH_MP (TAUT `a \/ b ==> b \/ a`));
46779 FIRST_ASSUM DISJ_CASES_TAC;
46780 IMATCH_MP_TAC (REAL_ARITH `(x < v /\ &0 <= u) ==> x < u + v` );
46782 REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS];
46783 TYPE_THEN `abs (&1/ &2) = &1 / &2` SUBAGOAL_TAC;
46784 REWRITE_TAC[REAL_ABS_DIV;ABS_N];
46786 TYPE_THEN `!x y. x < abs y <=> (&0 <= y /\ x < y) \/ (y < &0 /\ x < -- y)` SUBAGOAL_TAC;
46788 TYPE_THEN `&1 / &2 < (real_of_int (SND m) + &1 / &2) - v` ASM_CASES_TAC;
46790 IMATCH_MP_TAC REAL_LE_TRANS;
46791 TYPE_THEN `&1 / &2` EXISTS_TAC;
46793 IMATCH_MP_TAC REAL_LE_DIV;
46795 UND 9 THEN REAL_ARITH_TAC;
46797 TYPE_THEN `real_of_int (SND m) + &1 < v` BACK_TAC;
46799 IMATCH_MP_TAC REAL_LT_TRANS;
46800 TYPE_THEN `real_of_int (SND m) + &1 - v` EXISTS_TAC;
46802 TYPE_THEN `&1 / &2 < &1` SUBAGOAL_TAC;
46803 REWRITE_TAC[REAL_LT_HALF2];
46804 UND 11 THEN REAL_ARITH_TAC;
46805 UND 10 THEN REAL_ARITH_TAC;
46806 THM_INTRO_TAC[`&1`] REAL_HALF_DOUBLE;
46807 UND 11 THEN DISCH_THEN (fun t-> USE 10 (ONCE_REWRITE_RULE[GSYM t]));
46808 UND 10 THEN REAL_ARITH_TAC;
46810 PROOF_BY_CONTR_TAC;
46811 TYPE_THEN `v <= real_of_int (SND m) + &1` SUBAGOAL_TAC;
46812 UND 10 THEN REAL_ARITH_TAC;
46813 TYPE_THEN `real_of_int (SND m) <= v` SUBAGOAL_TAC;
46814 UND 9 THEN REAL_ARITH_TAC;
46815 TYPE_THEN `~(v = real_of_int (SND m) + &1)` SUBAGOAL_TAC;
46816 TYPE_THEN `v` UNABBREV_TAC;
46817 FULL_REWRITE_TAC[GSYM int_le;GSYM int_lt;GSYM int_of_num_th;GSYM int_add_th;];
46818 UND 7 THEN UND 5 THEN UND 6 THEN INT_ARITH_TAC;
46819 TYPE_THEN `v < real_of_int (SND m) + &1` SUBAGOAL_TAC;
46820 UND 13 THEN UND 11 THEN ARITH_TAC;
46822 TYPE_THEN `floor v = (SND m')` SUBAGOAL_TAC;
46823 FULL_REWRITE_TAC[int_add_th;int_of_num_th];
46824 ASM_REWRITE_TAC[floor_range];
46825 UND 6 THEN REAL_ARITH_TAC;
46827 TYPE_THEN `floor v = SND m` SUBAGOAL_TAC;
46828 REWRITE_TAC[floor_range];
46830 (* -C different second coord *)
46831 IMATCH_MP_TAC (REAL_ARITH `x < y /\ &0 <= z ==> x < y + z`);
46832 REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS];
46834 IMATCH_MP_TAC REAL_LTE_TRANS;
46835 TYPE_THEN `&1` EXISTS_TAC;
46838 REWRITE_TAC[REAL_ABS_DIV;REAL_ABS_NUM];
46839 REWRITE_TAC[REAL_LT_HALF2];
46840 REWRITE_TAC[GSYM int_sub_th;GSYM int_abs_th;GSYM int_le; GSYM int_of_num_th;];
46841 UND 7 THEN INT_ARITH_TAC;
46845 let connected_in_edge = prove_by_refinement(
46846 `!C. connected top2 C /\ C SUBSET (UNIONS edge) ==>
46847 (?e. edge e /\ C SUBSET e)`,
46851 TYPE_THEN `C = EMPTY` ASM_CASES_TAC ;
46852 REWRITE_TAC[connected_empty];
46853 TYPE_THEN `C` UNABBREV_TAC;
46854 TYPE_THEN `h_edge (&:0,&:0)` EXISTS_TAC;
46855 REWRITE_TAC[edge_h];
46857 TYPE_THEN `?e. edge e /\ ~(C INTER e = EMPTY)` SUBAGOAL_TAC;
46858 FULL_REWRITE_TAC[SUBSET;UNIONS;EMPTY_EXISTS];
46860 REWRITE_TAC[INTER ];
46863 TYPE_THEN `e` EXISTS_TAC;
46864 FULL_REWRITE_TAC[connected;edge];
46865 FIRST_ASSUM DISJ_CASES_TAC;
46866 TYPE_THEN `e` UNABBREV_TAC;
46867 TYPE_THEN `A = open_ball (euclid 2,d_euclid) (pointI m + (&1/ &2)*# e2) (&1 / &2)` ABBREV_TAC ;
46868 TYPE_THEN `B = closed_ball (euclid 2,d_euclid) (pointI m + (&1/ &2)*# e2) (&1 / &2)` ABBREV_TAC ;
46869 TYPE_THEN `E = euclid 2 DIFF B` ABBREV_TAC ;
46870 UND 1 THEN (DISCH_THEN (THM_INTRO_TAC[`A`;`E`]));
46872 TYPE_THEN `A` UNABBREV_TAC;
46874 IMATCH_MP_TAC open_ball_open;
46876 TYPE_THEN `E` UNABBREV_TAC;
46878 THM_INTRO_TAC[`top2`;`B`] closed_open ;
46879 TYPE_THEN `B` UNABBREV_TAC;
46881 IMATCH_MP_TAC closed_ball_closed;
46882 FULL_REWRITE_TAC[open_DEF;top2_unions;];
46883 FULL_REWRITE_TAC[top2];
46885 TYPE_THEN `E` UNABBREV_TAC;
46886 REWRITE_TAC[EQ_EMPTY;INTER;DIFF];
46887 UND 1 THEN REWRITE_TAC[];
46888 ASM_MESON_TAC[open_ball_sub_closed;subset_imp;];
46889 USE 0 (REWRITE_RULE[SUBSET;UNIONS]);
46890 REWRITE_TAC[SUBSET;UNION];
46893 TYPE_THEN `u = v_edge m` ASM_CASES_TAC;
46894 TYPE_THEN `u` UNABBREV_TAC;
46896 ASM_MESON_TAC[v_edge_ball;subset_imp ];
46898 TYPE_THEN `E` UNABBREV_TAC;
46901 FULL_REWRITE_TAC[top2_unions];
46902 ASM_MESON_TAC[subset_imp];
46903 UND 10 THEN REWRITE_TAC[];
46904 IMATCH_MP_TAC v_edge_closed_ball;
46905 REWRITE_TAC[EMPTY_EXISTS;INTER];
46907 FIRST_ASSUM DISJ_CASES_TAC;
46908 USE 0 (REWRITE_RULE[SUBSET;UNIONS]);
46909 REWRITE_TAC[SUBSET];
46912 TYPE_THEN `u = v_edge m` BACK_TAC ;
46914 IMATCH_MP_TAC v_edge_closed_ball;
46915 REWRITE_TAC[INTER;EMPTY_EXISTS ];
46916 TYPE_THEN `x` EXISTS_TAC;
46917 ASM_MESON_TAC[open_ball_sub_closed;subset_imp];
46918 USE 3 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
46919 PROOF_BY_CONTR_TAC;
46920 UND 9 THEN (TYPE_THEN `E` UNABBREV_TAC) THEN REWRITE_TAC[DIFF;SUBSET];
46922 UND 8 THEN REWRITE_TAC[DE_MORGAN_THM];
46924 ASM_MESON_TAC[v_edge_ball;subset_imp;open_ball_sub_closed];
46926 TYPE_THEN `e` UNABBREV_TAC;
46927 TYPE_THEN `A = open_ball (euclid 2,d_euclid) (pointI m + (&1/ &2)*# e1) (&1 / &2)` ABBREV_TAC ;
46928 TYPE_THEN `B = closed_ball (euclid 2,d_euclid) (pointI m + (&1/ &2)*# e1) (&1 / &2)` ABBREV_TAC ;
46929 TYPE_THEN `E = euclid 2 DIFF B` ABBREV_TAC ;
46930 UND 1 THEN (DISCH_THEN (THM_INTRO_TAC[`A`;`E`]));
46932 TYPE_THEN `A` UNABBREV_TAC;
46934 IMATCH_MP_TAC open_ball_open;
46936 TYPE_THEN `E` UNABBREV_TAC;
46938 THM_INTRO_TAC[`top2`;`B`] closed_open ;
46939 TYPE_THEN `B` UNABBREV_TAC;
46941 IMATCH_MP_TAC closed_ball_closed;
46942 FULL_REWRITE_TAC[open_DEF;top2_unions;];
46943 FULL_REWRITE_TAC[top2];
46945 TYPE_THEN `E` UNABBREV_TAC;
46946 REWRITE_TAC[EQ_EMPTY;INTER;DIFF];
46947 UND 1 THEN REWRITE_TAC[];
46948 ASM_MESON_TAC[open_ball_sub_closed;subset_imp;];
46949 USE 0 (REWRITE_RULE[SUBSET;UNIONS]);
46950 REWRITE_TAC[SUBSET;UNION];
46954 TYPE_THEN `u = h_edge m` ASM_CASES_TAC;
46955 TYPE_THEN `u` UNABBREV_TAC;
46957 ASM_MESON_TAC[h_edge_ball;subset_imp ];
46959 TYPE_THEN `E` UNABBREV_TAC;
46962 FULL_REWRITE_TAC[top2_unions];
46963 ASM_MESON_TAC[subset_imp];
46964 UND 10 THEN REWRITE_TAC[];
46965 IMATCH_MP_TAC h_edge_closed_ball;
46966 REWRITE_TAC[EMPTY_EXISTS;INTER];
46968 FIRST_ASSUM DISJ_CASES_TAC;
46969 USE 0 (REWRITE_RULE[SUBSET;UNIONS]);
46970 REWRITE_TAC[SUBSET];
46973 TYPE_THEN `u = h_edge m` BACK_TAC ;
46975 IMATCH_MP_TAC h_edge_closed_ball;
46976 REWRITE_TAC[INTER;EMPTY_EXISTS ];
46977 TYPE_THEN `x` EXISTS_TAC;
46978 ASM_MESON_TAC[open_ball_sub_closed;subset_imp];
46979 USE 3 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
46980 PROOF_BY_CONTR_TAC;
46982 UND 9 THEN (TYPE_THEN `E` UNABBREV_TAC) THEN REWRITE_TAC[DIFF;SUBSET];
46984 UND 8 THEN REWRITE_TAC[DE_MORGAN_THM];
46986 ASM_MESON_TAC[h_edge_ball;subset_imp;open_ball_sub_closed];
46988 (* Mon Dec 20 15:16:18 EST 2004 *)
46993 let int_pow2_gt1 = prove_by_refinement(
46994 `!x. ~(x = &:0) ==> &1 <= (real_of_int x) pow 2`,
46997 TYPE_THEN `&1 = &1 pow 2` SUBAGOAL_TAC ;
46999 UND 1 THEN DISCH_THEN (fun t -> ONCE_REWRITE_TAC[t]);
47000 REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS;GSYM int_le;GSYM int_abs_th ;GSYM int_of_num_th;];
47001 UND 0 THEN INT_ARITH_TAC;
47005 let d_euclid_pointI_pos = prove_by_refinement(
47006 `!m n. d_euclid (pointI m) (pointI n) < &1 ==> (m = n)`,
47009 REWRITE_TAC[pointI;d_euclid_point;PAIR_SPLIT];
47010 PROOF_BY_CONTR_TAC;
47011 FULL_REWRITE_TAC[DE_MORGAN_THM];
47012 USE 0 (MATCH_MP (REAL_ARITH `x < y ==> ~(y <= x)`));
47013 UND 0 THEN REWRITE_TAC[];
47014 TYPE_THEN `&1 = sqrt(&1)` SUBAGOAL_TAC;
47015 ONCE_REWRITE_TAC [EQ_SYM_EQ];
47016 IMATCH_MP_TAC SQRT_POS_UNIQ;
47018 UND 0 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC [t]);
47019 IMATCH_MP_TAC SQRT_MONO_LE;
47021 FULL_REWRITE_TAC[GSYM int_sub_th];
47022 USE 1 (ONCE_REWRITE_RULE[ONCE_REWRITE_RULE[EQ_SYM_EQ] INT_SUB_0]);
47023 FIRST_ASSUM DISJ_CASES_TAC;
47024 IMATCH_MP_TAC (REAL_ARITH `&1 <= x /\ &0 <= y ==> &1 <= x + y`);
47025 IMATCH_MP_TAC int_pow2_gt1;
47027 IMATCH_MP_TAC (REAL_ARITH `&1 <= x /\ &0 <= y ==> &1 <= y + x`);
47028 IMATCH_MP_TAC int_pow2_gt1;
47033 extend_simp_rewrites[prove_by_refinement(
47037 REWRITE_TAC[REAL_LT_HALF1];
47041 extend_simp_rewrites[prove_by_refinement(
47042 `&2 * &1/ &2 = &1`,
47045 IMATCH_MP_TAC REAL_DIV_LMUL;
47046 UND 0 THEN REAL_ARITH_TAC;
47050 let totally_bounded_pointI = prove_by_refinement(
47051 `?eps. !x m n. (&0 <eps ) /\
47052 (open_ball(euclid 2,d_euclid) x eps (pointI m) /\
47053 open_ball(euclid 2,d_euclid) x eps (pointI n) ==>
47057 TYPE_THEN `&1/ &2` EXISTS_TAC;
47059 IMATCH_MP_TAC d_euclid_pointI_pos;
47060 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`pointI m`;`pointI n`;`x`;`&1 / &2`] BALL_DIST;
47061 TYPE_THEN `&2 * &1 / &2 = &1` SUBAGOAL_TAC;
47066 let simple_arc_finite_pointI = prove_by_refinement(
47068 simple_arc top2 e ==>
47069 (?X. FINITE X /\ (!m. e (pointI m) ==> X m))`,
47073 THM_INTRO_TAC[`e`] simple_arc_compact;
47074 THM_INTRO_TAC[`e`] simple_arc_euclid;
47075 THM_INTRO_TAC[`e`;`d_euclid`] compact_totally_bounded;
47077 THM_INTRO_TAC[`euclid 2`;`e`;`d_euclid`] metric_subspace;
47078 THM_INTRO_TAC[`euclid 2`;`e`;`d_euclid`] compact_subset;
47079 FULL_REWRITE_TAC[top2];
47082 FULL_REWRITE_TAC[totally_bounded];
47083 THM_INTRO_TAC[] totally_bounded_pointI;
47089 TYPE_THEN `X = { m | ?b. B b /\ b (pointI m) }` ABBREV_TAC ;
47090 TYPE_THEN `X` EXISTS_TAC;
47092 TYPE_THEN `!m. ?b. (X m) ==> (B b /\ b (pointI m))` SUBAGOAL_TAC;
47093 TYPE_THEN `X` UNABBREV_TAC;
47097 THM_INTRO_TAC[`X`;`B`;`b`] FINITE_INJ;
47100 FIRST_ASSUM IMATCH_MP_TAC ;
47107 TYPE_THEN `x'` EXISTS_TAC;
47109 TYPE_THEN `b y` UNABBREV_TAC;
47110 TYPE_THEN `b x` UNABBREV_TAC;
47111 THM_INTRO_TAC[`euclid 2`;`e`;`d_euclid`] metric_subspace;
47112 THM_INTRO_TAC[`euclid 2`;`e`;`d_euclid`;`x'`;`eps`] open_ball_subspace;
47113 CONJ_TAC THEN ASM_MESON_TAC[subset_imp];
47115 TYPE_THEN `X` UNABBREV_TAC;
47116 FULL_REWRITE_TAC[UNIONS];
47118 (* Mon Dec 20 18:39:42 EST 2004 *)
47124 let simple_arc_finite_lemma1 = prove_by_refinement(
47125 `!e v v'. simple_arc_end e v v' ==>
47126 (?X f. (X SUBSET {x | &0 <= x /\ x <= &1}) /\ FINITE X /\
47127 (f (&0) = v) /\ (f (&1) = v') /\
47128 (e = IMAGE f {x | &0 <= x /\ x <= &1}) /\
47129 continuous f (top_of_metric (UNIV,d_real)) top2 /\
47130 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) /\
47131 (!x. &0 <= x /\ x <= &1 ==> ( (?m. f x = pointI m) <=> (X x))))`,
47135 THM_INTRO_TAC[`e`;`v`;`v'`] simple_arc_end_simple;
47136 THM_INTRO_TAC[`e`] simple_arc_finite_pointI;
47137 THM_INTRO_TAC[`e`;`v`;`v'`] simple_arc_end;
47139 TYPE_THEN `Y = {x | &0 <= x /\ x <= &1 /\ (?m. (f x = pointI m))}` ABBREV_TAC ;
47140 TYPE_THEN `Y` EXISTS_TAC;
47141 TYPE_THEN `f` EXISTS_TAC;
47144 TYPE_THEN`Y` UNABBREV_TAC;
47145 REWRITE_TAC[SUBSET];
47147 FULL_REWRITE_TAC[top2_unions];
47149 THM_INTRO_TAC[`Y`;`IMAGE (pointI) X`;`f`] FINITE_INJ;
47151 IMATCH_MP_TAC FINITE_IMAGE;
47152 FULL_REWRITE_TAC[INJ];
47154 REWRITE_TAC[IMAGE];
47155 TYPE_THEN `Y` UNABBREV_TAC;
47156 TYPE_THEN `m` EXISTS_TAC;
47157 FIRST_ASSUM IMATCH_MP_TAC ;
47159 IMATCH_MP_TAC image_imp;
47161 FIRST_ASSUM IMATCH_MP_TAC ;
47162 TYPE_THEN `Y` UNABBREV_TAC;
47164 TYPE_THEN `Y` UNABBREV_TAC;
47168 let simple_arc_finite_lemma2 = prove_by_refinement(
47169 `!e v v'. simple_arc_end e v v'==>
47171 (IMAGE t {i | i < N} SUBSET {x | &0 <= x /\ x <= &1}) /\
47172 (f (&0) = v) /\ (f (&1) = v') /\
47173 (e = IMAGE f {x | &0 <= x /\ x <= &1}) /\
47174 (!i j. (i < j) /\ (i < N) /\ (j < N) ==> (t i < t j)) /\
47175 continuous f (top_of_metric (UNIV,d_real)) top2 /\
47176 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) /\
47177 (!x. &0 <= x /\ x <= &1 ==>
47178 ( (?m. f x = pointI m) <=> (?k. (k < N) /\ (x = t k)))))`,
47182 THM_INTRO_TAC[`e`;`v`;`v'`] simple_arc_finite_lemma1;
47183 THM_INTRO_TAC[`X`] real_finite_increase;
47184 TYPE_THEN `CARD X` EXISTS_TAC;
47185 TYPE_THEN `u` EXISTS_TAC;
47186 TYPE_THEN `f` EXISTS_TAC;
47189 FULL_REWRITE_TAC[BIJ;IMAGE;SURJ];
47190 FULL_REWRITE_TAC[SUBSET];
47194 FIRST_ASSUM IMATCH_MP_TAC ;
47198 FULL_REWRITE_TAC[BIJ;SURJ];
47199 IMATCH_MP_TAC EQ_ANTISYM;
47201 ONCE_REWRITE_TAC[EQ_SYM_EQ];
47202 FIRST_ASSUM IMATCH_MP_TAC ;
47206 let connected_unions_common = prove_by_refinement(
47207 `!U (ZZ:(A->bool)->bool). (!Z. ZZ Z ==> connected U Z) /\
47208 (!Z Z'. ZZ Z /\ ZZ Z' ==> ~(Z INTER Z' = EMPTY)) ==>
47209 (connected U (UNIONS ZZ))`,
47212 REWRITE_TAC[connected];
47214 TYPE_THEN `UU = UNIONS U` ABBREV_TAC ;
47215 REWRITE_TAC[UNIONS;SUBSET];
47218 ASM_MESON_TAC[subset_imp];
47220 TYPE_THEN `!Z. ZZ Z ==> Z SUBSET A \/ Z SUBSET B` SUBAGOAL_TAC;
47223 FIRST_ASSUM IMATCH_MP_TAC ;
47224 USE 2 (REWRITE_RULE[UNIONS;SUBSET]);
47225 REWRITE_TAC[SUBSET];
47226 FIRST_ASSUM IMATCH_MP_TAC ;
47229 TYPE_THEN `AA = {Z | ZZ Z /\ Z SUBSET A}` ABBREV_TAC ;
47230 TYPE_THEN `BB = {Z | ZZ Z /\ Z SUBSET B}` ABBREV_TAC ;
47231 TYPE_THEN `ZZ = AA UNION BB` SUBAGOAL_TAC;
47232 IMATCH_MP_TAC EQ_EXT;
47233 REWRITE_TAC[UNION];
47234 TYPE_THEN `AA` UNABBREV_TAC;
47235 TYPE_THEN `BB` UNABBREV_TAC;
47237 PROOF_BY_CONTR_TAC;
47238 USE 11 (REWRITE_RULE[DE_MORGAN_THM;UNIONS;SUBSET;UNION]);
47241 TYPE_THEN `AA` UNABBREV_TAC;
47242 TYPE_THEN `BB` UNABBREV_TAC;
47248 TYPE_THEN `ZZ u` SUBAGOAL_TAC;
47250 TYPE_THEN `ZZ u'` SUBAGOAL_TAC;
47252 TYPE_THEN `u SUBSET A` SUBAGOAL_TAC;
47254 FIRST_ASSUM DISJ_CASES_TAC ;
47255 USE 13(REWRITE_RULE[SUBSET]);
47258 TYPE_THEN `u' SUBSET B` SUBAGOAL_TAC;
47260 FIRST_ASSUM DISJ_CASES_TAC ;
47261 USE 14(REWRITE_RULE[SUBSET]);
47265 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`u`;`u'`]);
47266 USE 0 (REWRITE_RULE[EMPTY_EXISTS;INTER ]);
47267 USE 3(REWRITE_RULE[INTER;EQ_EMPTY]);
47269 ASM_MESON_TAC[subset_imp];
47273 let connect_real_open = prove_by_refinement(
47275 (top_of_metric (UNIV,d_real)) {x | a < x /\ x < b}`,
47279 TYPE_THEN `{x | a < x /\ x < b} = EMPTY` ASM_CASES_TAC;
47280 REWRITE_TAC[connected_empty];
47281 FULL_REWRITE_TAC[EMPTY_EXISTS];
47282 TYPE_THEN `ZZ = {Z | ?a' b'. a < a' /\ a' < u /\ u < b' /\ b' < b /\ (Z = {x | a' <= x /\ x <= b'})}` ABBREV_TAC ;
47283 TYPE_THEN `{x | a < x /\ x < b} = UNIONS ZZ` SUBAGOAL_TAC;
47284 TYPE_THEN `ZZ` UNABBREV_TAC;
47285 REWRITE_TAC[UNIONS];
47286 IMATCH_MP_TAC EQ_EXT;
47287 IMATCH_MP_TAC EQ_ANTISYM;
47289 CONV_TAC (dropq_conv "u");
47290 CONV_TAC (dropq_conv "x'");
47291 TYPE_THEN `u < x` ASM_CASES_TAC;
47292 TYPE_THEN `(a + u)/ &2` EXISTS_TAC;
47293 TYPE_THEN `x` EXISTS_TAC;
47295 IMATCH_MP_TAC real_middle1_lt;
47297 IMATCH_MP_TAC real_middle2_lt;
47298 UND 6 THEN UND 4 THEN REAL_ARITH_TAC;
47299 TYPE_THEN `(a + x)/ &2` EXISTS_TAC;
47300 TYPE_THEN `(u + b)/ &2` EXISTS_TAC;
47302 IMATCH_MP_TAC real_middle1_lt;
47304 IMATCH_MP_TAC REAL_LTE_TRANS;
47305 TYPE_THEN `x` EXISTS_TAC;
47306 USE 4 (MATCH_MP (REAL_ARITH `~(u < x) ==> (x <= u)`));
47307 IMATCH_MP_TAC real_middle2_lt;
47309 IMATCH_MP_TAC real_middle1_lt;
47311 IMATCH_MP_TAC real_middle2_lt;
47313 IMATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`);
47314 IMATCH_MP_TAC real_middle2_lt;
47315 UND 4 THEN UND 7 THEN REAL_ARITH_TAC;
47317 TYPE_THEN `u'` UNABBREV_TAC;
47318 UND 7 THEN UND 3 THEN UND 2 THEN UND 4 THEN REAL_ARITH_TAC;
47320 IMATCH_MP_TAC connected_unions_common;
47322 TYPE_THEN `ZZ` UNABBREV_TAC;
47323 REWRITE_TAC[connect_real];
47324 TYPE_THEN `ZZ` UNABBREV_TAC;
47325 TYPE_THEN `Z` UNABBREV_TAC;
47326 TYPE_THEN `Z'` UNABBREV_TAC;
47327 USE 4(REWRITE_RULE[EQ_EMPTY;INTER]);
47330 REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;
47334 let int_neg_num_th = prove_by_refinement(
47335 `!j. real_of_int (--: (&: j)) = -- (&j)`,
47338 REWRITE_TAC[int_neg_th;int_of_num_th;];
47342 let closed_ball_subset_larger_open = prove_by_refinement(
47344 (r < r') ==> closed_ball (euclid n,d_euclid) a r SUBSET
47345 open_ball (euclid n,d_euclid) a r'`,
47348 REWRITE_TAC[closed_ball;open_ball;SUBSET];
47349 UND 3 THEN UND 0 THEN REAL_ARITH_TAC;
47353 let simple_arc_end_edge_closure = prove_by_refinement(
47354 `!C e m n. edge e /\ simple_arc_end C (pointI m) (pointI n) /\
47355 (!x. C x /\ ~(x = pointI m) /\ ~(x = pointI n) ==> e x) ==>
47356 (closure top2 e (pointI m))`,
47360 THM_INTRO_TAC[`e`] edge_euclid2;
47361 FULL_REWRITE_TAC[edge];
47362 TYPE_THEN `connected top2 C` SUBAGOAL_TAC;
47363 USE 1 (MATCH_MP simple_arc_end_simple);
47364 USE 1(MATCH_MP simple_arc_connected);
47365 PROOF_BY_CONTR_TAC;
47366 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`e`] closure_open_ball;
47367 USE 6 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
47368 TSPEC `(pointI m)` 6;
47369 USE 5 (REWRITE_RULE[top2]);
47370 UND 6 THEN ASM_REWRITE_TAC[];
47371 PROOF_BY_CONTR_TAC;
47373 TYPE_THEN `?r. &0 < r /\ (r < &1/ &2) /\ (e INTER closed_ball (euclid 2, d_euclid) (pointI m) r = EMPTY)` SUBAGOAL_TAC;
47374 TYPE_THEN `?s. &0 < s /\ s <= r /\ s <= &1/ &2` SUBAGOAL_TAC;
47375 TYPE_THEN `min_real r (&1 / &2)` EXISTS_TAC;
47376 REWRITE_TAC[min_real_le];
47377 REWRITE_TAC[min_real];
47379 TYPE_THEN `s/ &2` EXISTS_TAC;
47380 ASM_REWRITE_TAC[REAL_LT_HALF1];
47382 IMATCH_MP_TAC REAL_LTE_TRANS;
47383 TYPE_THEN `s` EXISTS_TAC;
47384 REWRITE_TAC[REAL_LT_HALF2];
47385 REWRITE_TAC[EQ_EMPTY;INTER];
47388 UND 7 THEN ASM_REWRITE_TAC[];
47390 TYPE_THEN `s/ &2 < r` SUBAGOAL_TAC;
47391 IMATCH_MP_TAC REAL_LTE_TRANS;
47392 TYPE_THEN `s` EXISTS_TAC;
47393 REWRITE_TAC[REAL_LT_HALF2];
47394 THM_INTRO_TAC[`2`;`pointI m`;`s / &2`;`r`] closed_ball_subset_larger_open;
47395 ASM_MESON_TAC[subset_imp];
47397 THM_INTRO_TAC[`C`;`pointI m`;`pointI n`] simple_arc_end_distinct;
47398 FULL_REWRITE_TAC[connected];
47399 TYPE_THEN `A = open_ball(euclid 2,d_euclid) (pointI m) r'` ABBREV_TAC ;
47400 TYPE_THEN `B = closed_ball(euclid 2,d_euclid) (pointI m) r'` ABBREV_TAC ;
47401 TYPE_THEN `E = euclid 2 DIFF B` ABBREV_TAC ;
47403 TYPE_THEN `top2 A /\ top2 E /\ (A INTER E = {}) /\ C SUBSET A UNION E /\ A (pointI m) /\ E (pointI n)` SUBAGOAL_TAC;
47405 TYPE_THEN `A` UNABBREV_TAC;
47407 IMATCH_MP_TAC open_ball_open;
47409 TYPE_THEN `E` UNABBREV_TAC;
47411 THM_INTRO_TAC[`top2`;`B`] closed_open;
47412 TYPE_THEN `B` UNABBREV_TAC;
47414 IMATCH_MP_TAC closed_ball_closed;
47415 FULL_REWRITE_TAC[open_DEF;top2_unions ];
47416 FULL_REWRITE_TAC[top2];
47419 TYPE_THEN `A` UNABBREV_TAC;
47420 TYPE_THEN `E` UNABBREV_TAC;
47421 TYPE_THEN `B` UNABBREV_TAC;
47422 REWRITE_TAC[INTER;EQ_EMPTY;DIFF];
47423 ASM_MESON_TAC[subset_imp;open_ball_sub_closed];
47425 TYPE_THEN `A (pointI m)` SUBAGOAL_TAC;
47426 TYPE_THEN `A` UNABBREV_TAC;
47427 IMATCH_MP_TAC (INR open_ball_nonempty);
47428 REWRITE_TAC[pointI];
47430 TYPE_THEN `E (pointI n)` SUBAGOAL_TAC;
47431 TYPE_THEN `E` UNABBREV_TAC;
47433 TYPE_THEN `B` UNABBREV_TAC;
47435 REWRITE_TAC[pointI];
47436 FULL_REWRITE_TAC[pointI_inj];
47437 TYPE_THEN `open_ball (euclid 2,d_euclid) (pointI m) (&1 / &2) (pointI n)` SUBAGOAL_TAC;
47438 THM_INTRO_TAC[`2`;`pointI m`;`r'`;`&1 / &2`] closed_ball_subset_larger_open;
47439 ASM_MESON_TAC[subset_imp];
47440 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`pointI m`;`pointI n`;`pointI m`;`&1 / &2`] BALL_DIST;
47441 IMATCH_MP_TAC (INR open_ball_nonempty);
47442 REWRITE_TAC[pointI];
47443 TYPE_THEN `&2 * &1 / &2 = &1` SUBAGOAL_TAC;
47445 USE 17 (MATCH_MP d_euclid_pointI_pos);
47446 TYPE_THEN `m` UNABBREV_TAC;
47448 REWRITE_TAC[SUBSET;UNION];
47449 TYPE_THEN `e x \/ (x = pointI m) \/ (x = pointI n)` SUBAGOAL_TAC;
47452 UND 19 THEN REP_CASES_TAC;
47454 TYPE_THEN `E` UNABBREV_TAC;
47456 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
47457 ASM_MESON_TAC[subset_imp];
47461 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`A`;`E`]);
47463 TYPE_THEN `C (pointI m)` SUBAGOAL_TAC;
47464 IMATCH_MP_TAC simple_arc_end_end;
47466 TYPE_THEN `C (pointI n)` SUBAGOAL_TAC;
47467 IMATCH_MP_TAC simple_arc_end_end2;
47469 USE 19 (REWRITE_RULE[INTER;EQ_EMPTY ]);
47470 FIRST_ASSUM DISJ_CASES_TAC;
47471 USE 24 (REWRITE_RULE[SUBSET]); (* -- *)
47473 USE 24 (REWRITE_RULE[SUBSET]);
47478 let vc_edge_pointI = prove_by_refinement(
47479 `!m n. vc_edge m (pointI n) <=> (n = m) \/ (n = up m)`,
47482 REWRITE_TAC[vc_edge;cell_clauses;INR IN_SING;UNION];
47483 TYPE_THEN `pointI m + e2 = pointI (up m)` SUBAGOAL_TAC;
47484 REWRITE_TAC[up;e2;point_add ;pointI];
47486 REWRITE_TAC[int_of_num_th;int_add_th];
47487 REWRITE_TAC[pointI_inj];
47491 let hc_edge_pointI = prove_by_refinement(
47492 `!m n. hc_edge m (pointI n) <=> (n = m) \/ (n = right m)`,
47495 REWRITE_TAC[hc_edge;cell_clauses;INR IN_SING;UNION];
47496 TYPE_THEN `pointI m + e1 = pointI (right m)` SUBAGOAL_TAC;
47497 REWRITE_TAC[right;e1;point_add ;pointI];
47499 REWRITE_TAC[int_of_num_th;int_add_th];
47500 REWRITE_TAC[pointI_inj];
47504 let mk_segment_v = prove_by_refinement(
47505 `!r s b x. (r <= s) ==> (mk_segment (point(b,r)) (point(b,s)) x <=>
47506 (?t. (r <= t /\ t <= s /\ (x = point(b,t)))))`,
47510 REWRITE_TAC[mk_segment];
47511 REWRITE_TAC[point_scale;point_add;GSYM REAL_RDISTRIB;REAL_ARITH `a + &1 - a = &1`;REAL_ARITH `&1 * b = b`];
47512 IMATCH_MP_TAC EQ_ANTISYM;
47514 TYPE_THEN `a * r + (&1 - a) *s` EXISTS_TAC;
47516 ineq_le_tac `r + (s - r)* (&1 - a) = a * r + (&1 - a)*s`;
47517 ineq_le_tac `(a * r + (&1 - a) * s) + (s - r)*a = s`;
47518 TYPE_THEN `s = r` ASM_CASES_TAC;
47519 REWRITE_TAC[point_inj;PAIR_SPLIT;GSYM REAL_RDISTRIB;REAL_ARITH `(a + &1 - a = &1) /\ (&1* a = a)`];
47520 TYPE_THEN `&0` EXISTS_TAC;
47521 UND 2 THEN UND 3 THEN UND 4 THEN REAL_ARITH_TAC;
47523 REWRITE_TAC[point_inj;PAIR_SPLIT];
47524 TYPE_THEN `v = &1/(s - r)` ABBREV_TAC ;
47525 TYPE_THEN `(s - r)*v = &1` SUBAGOAL_TAC;
47526 TYPE_THEN `v` UNABBREV_TAC;
47527 REWRITE_TAC[GSYM real_div_assoc];
47529 IMATCH_MP_TAC REAL_DIV_REFL;
47530 UND 5 THEN UND 4 THEN REAL_ARITH_TAC;
47531 TYPE_THEN `v*(s - t)` EXISTS_TAC;
47532 TYPE_THEN `&0 < v` SUBAGOAL_TAC;
47533 TYPE_THEN `v` UNABBREV_TAC;
47534 IMATCH_MP_TAC REAL_LT_DIV;
47535 UND 4 THEN UND 0 THEN REAL_ARITH_TAC;
47538 IMATCH_MP_TAC REAL_LE_MUL;
47539 UND 7 THEN UND 2 THEN REAL_ARITH_TAC;
47541 IMATCH_MP_TAC REAL_LE_LCANCEL_IMP;
47542 TYPE_THEN `(s - r)` EXISTS_TAC;
47544 UND 4 THEN UND 0 THEN REAL_ARITH_TAC;
47545 REWRITE_TAC[REAL_MUL_ASSOC];
47547 UND 3 THEN REAL_ARITH_TAC;
47548 TYPE_THEN `(v * (s - t)) * r + (&1 - v * (s - t)) * s = s + ((s - r)*v)*(t - s)` SUBAGOAL_TAC THENL [real_poly_tac;REDUCE_TAC];
47555 let mk_segment_vc = prove_by_refinement(
47556 `!m. mk_segment (pointI m) (pointI (up m)) = vc_edge m`,
47559 REWRITE_TAC[up;vc_edge;v_edge;pointI;UNION ;e2;];
47560 IMATCH_MP_TAC EQ_EXT;
47561 THM_INTRO_TAC[`real_of_int (SND m)`;`real_of_int(SND m + &:1)`;`real_of_int (FST m)`;`x`] mk_segment_v;
47562 REWRITE_TAC[GSYM int_le];
47564 REWRITE_TAC[point_add;];
47567 IMATCH_MP_TAC EQ_ANTISYM;
47569 REWRITE_TAC[point_inj;PAIR_SPLIT ];
47570 TYPE_THEN `t = real_of_int (SND m)` ASM_CASES_TAC;
47571 REWRITE_TAC[INR IN_SING];
47572 TYPE_THEN `t = real_of_int (SND m) + &1` ASM_CASES_TAC;
47573 REWRITE_TAC[INR IN_SING];
47575 CONV_TAC (dropq_conv "u");
47576 CONV_TAC (dropq_conv "v");
47577 FULL_REWRITE_TAC[int_add_th;int_of_num_th;];
47578 UND 5 THEN UND 4 THEN UND 2 THEN UND 3 THEN REAL_ARITH_TAC;
47580 UND 1 THEN REP_CASES_TAC ;
47581 TYPE_THEN `v` EXISTS_TAC;
47582 UND 2 THEN UND 3 THEN REAL_ARITH_TAC;
47583 FULL_REWRITE_TAC [INR IN_SING];
47584 TYPE_THEN `real_of_int (SND m)` EXISTS_TAC;
47585 REWRITE_TAC[int_add_th;int_of_num_th];
47587 FULL_REWRITE_TAC [INR IN_SING];
47588 TYPE_THEN `real_of_int (SND m) + &1` EXISTS_TAC;
47589 REWRITE_TAC[int_add_th;int_of_num_th];
47591 (* Tue Dec 21 18:22:18 EST 2004 *)
47596 let mk_segment_hc = prove_by_refinement(
47597 `!m. mk_segment (pointI m) (pointI (right m)) = hc_edge m`,
47600 REWRITE_TAC[right;hc_edge;h_edge;pointI;UNION ;e1;];
47601 IMATCH_MP_TAC EQ_EXT;
47602 THM_INTRO_TAC[`real_of_int (FST m)`;`real_of_int(FST m + &:1)`;`real_of_int (SND m)`;`x`] mk_segment_h;
47603 REWRITE_TAC[int_add_th;int_of_num_th;];
47605 REWRITE_TAC[point_add;];
47607 FULL_REWRITE_TAC[int_add_th;int_of_num_th;];
47609 REWRITE_TAC[INR IN_SING];
47610 IMATCH_MP_TAC EQ_ANTISYM;
47612 REWRITE_TAC[point_inj;PAIR_SPLIT ];
47613 TYPE_THEN `t = real_of_int (FST m)` ASM_CASES_TAC;
47614 TYPE_THEN `t = real_of_int (FST m) + &1` ASM_CASES_TAC;
47615 CONV_TAC (dropq_conv "u");
47616 CONV_TAC (dropq_conv "v");
47617 UND 5 THEN UND 4 THEN UND 2 THEN UND 3 THEN REAL_ARITH_TAC;
47619 UND 1 THEN REP_CASES_TAC ;
47620 TYPE_THEN `u` EXISTS_TAC;
47621 UND 2 THEN UND 3 THEN REAL_ARITH_TAC;
47622 TYPE_THEN `real_of_int (FST m)` EXISTS_TAC;
47624 TYPE_THEN `real_of_int (FST m) + &1` EXISTS_TAC;
47630 let simple_arc_end_edge_full_closure = prove_by_refinement(
47631 `!C e m n. edge e /\ simple_arc_end C (pointI m) (pointI n) /\
47632 (!x. C x /\ ~(x = pointI m) /\ ~(x = pointI n) ==> e x) ==>
47633 (C = closure top2 e ) `,
47637 THM_INTRO_TAC[`C`;`e`;`m`;`n`] simple_arc_end_edge_closure;
47639 THM_INTRO_TAC[`C`;`e`;`n`;`m`] simple_arc_end_edge_closure;
47641 IMATCH_MP_TAC simple_arc_end_symm;
47642 FIRST_ASSUM IMATCH_MP_TAC ;
47644 TYPE_THEN `C SUBSET closure top2 e` SUBAGOAL_TAC;
47645 REWRITE_TAC[SUBSET];
47646 TYPE_THEN `e x \/ (x = pointI m) \/ (x = pointI n)` SUBAGOAL_TAC;
47648 UND 6 THEN REP_CASES_TAC;
47649 THM_INTRO_TAC[`top2`;`e`] subset_closure;
47650 REWRITE_TAC[top2_top];
47651 ASM_MESON_TAC[subset_imp];
47655 TYPE_THEN `B = closure top2 e` ABBREV_TAC ;
47656 IMATCH_MP_TAC simple_arc_end_inj;
47657 TYPE_THEN `B` EXISTS_TAC;
47658 TYPE_THEN `pointI m` EXISTS_TAC;
47659 TYPE_THEN `pointI n` EXISTS_TAC;
47660 REWRITE_TAC[SUBSET_REFL];
47661 TYPE_THEN `simple_arc_end B (pointI m) (pointI n)` BACK_TAC;
47662 IMATCH_MP_TAC simple_arc_end_simple;
47665 THM_INTRO_TAC[`C`;`pointI m`;`pointI n`] simple_arc_end_distinct;
47666 FULL_REWRITE_TAC[pointI_inj];
47668 TYPE_THEN `mk_segment (pointI m) (pointI n) = B` SUBAGOAL_TAC ;
47669 FULL_REWRITE_TAC[edge];
47670 FIRST_ASSUM DISJ_CASES_TAC;
47671 TYPE_THEN `e` UNABBREV_TAC;
47672 FULL_REWRITE_TAC[v_edge_closure;h_edge_closure;];
47673 TYPE_THEN `B` UNABBREV_TAC;
47674 TYPE_THEN `(m = m') /\ (n = up m') \/ (m = up m') /\ (n = m')` SUBAGOAL_TAC;
47675 RULE_ASSUM_TAC (REWRITE_RULE[vc_edge_pointI;]);
47676 FIRST_ASSUM DISJ_CASES_TAC;
47677 TYPE_THEN `n` UNABBREV_TAC;
47679 TYPE_THEN `n` UNABBREV_TAC;
47682 REWRITE_TAC[GSYM mk_segment_vc];
47683 FIRST_ASSUM DISJ_CASES_TAC;
47684 MESON_TAC[mk_segment_sym];
47686 TYPE_THEN `e` UNABBREV_TAC;
47687 FULL_REWRITE_TAC[v_edge_closure;h_edge_closure;];
47688 TYPE_THEN `B` UNABBREV_TAC;
47689 TYPE_THEN `(m = m') /\ (n = right m') \/ (m = right m') /\ (n = m')` SUBAGOAL_TAC;
47690 RULE_ASSUM_TAC (REWRITE_RULE[hc_edge_pointI;]);
47691 FIRST_ASSUM DISJ_CASES_TAC;
47692 TYPE_THEN `n` UNABBREV_TAC;
47694 TYPE_THEN `n` UNABBREV_TAC;
47697 REWRITE_TAC[GSYM mk_segment_hc];
47698 FIRST_ASSUM DISJ_CASES_TAC;
47699 MESON_TAC[mk_segment_sym];
47701 TYPE_THEN `B` UNABBREV_TAC;
47702 IMATCH_MP_TAC mk_segment_simple_arc_end;
47703 REWRITE_TAC[pointI_inj];
47704 REWRITE_TAC[pointI];
47708 let simple_arc_finite_lemma3 = prove_by_refinement(
47709 `!E e v v'. simple_arc_end e v v' /\
47711 e SUBSET UNIONS E /\
47712 E (eps_hyper T (v 0)) /\ E (eps_hyper F (v 1)) /\
47713 E (eps_hyper T (v' 0)) /\ E (eps_hyper F (v' 1)) /\
47714 (!e. E e ==> (?z eps. e = eps_hyper eps z)) /\
47715 (!z eps. E (eps_hyper eps z) ==> (?j. z = -- &j)) ==>
47717 (IMAGE t {i | i < N} SUBSET {x | &0 <= x /\ x <= &1}) /\
47718 (f (&0) = v) /\ (f (&1) = v') /\
47719 (e = IMAGE f {x | &0 <= x /\ x <= &1}) /\
47720 (!i j. (i < j) /\ (i < N) /\ (j < N) ==> (t i < t j)) /\
47721 continuous f (top_of_metric (UNIV,d_real)) top2 /\
47722 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) /\
47723 (!x. &0 <= x /\ x <= &1 ==>
47724 ( (?m. f x = pointI m) = (?k. (k < N) /\ (x = t k)))) /\
47725 (&0 = t 0) /\ (&1 = t (N - 1)) /\
47726 (!i. (SUC i < N) ==> (?ed. (edge ed) /\
47727 (IMAGE f { x | t i <= x /\ x <= t (SUC i) } =
47728 closure top2 ed))))
47733 THM_INTRO_TAC[`e`;`v`;`v'`] simple_arc_finite_lemma2;
47734 TYPE_THEN `N` EXISTS_TAC;
47735 TYPE_THEN `t` EXISTS_TAC;
47736 TYPE_THEN `f` EXISTS_TAC;
47739 TYPE_THEN `!w. (euclid 2 w ) /\ E (eps_hyper T (w 0)) /\ E (eps_hyper F (w 1)) ==> (?m. (w = pointI m))` SUBAGOAL_TAC;
47742 TSPEC `eps_hyper F (w 1)` 21;
47743 TSPEC `eps_hyper T (w 0)` 1;
47748 FULL_REWRITE_TAC[eps_hyper_inj];
47749 TYPE_THEN `z` UNABBREV_TAC;
47750 TYPE_THEN `z'` UNABBREV_TAC;
47751 TYPE_THEN `(?j. w 0 = -- &j)` SUBAGOAL_TAC;
47752 FIRST_ASSUM IMATCH_MP_TAC ;
47754 TYPE_THEN `?j. w 1 = -- &j` SUBAGOAL_TAC;
47755 FIRST_ASSUM IMATCH_MP_TAC ;
47757 REWRITE_TAC[pointI];
47758 TYPE_THEN `(-- &:j, -- &: j')` EXISTS_TAC;
47759 REWRITE_TAC[int_neg;int_abstr;int_of_num_th;];
47760 TYPE_THEN `!j. (integer (-- &j))` SUBAGOAL_TAC;
47761 REWRITE_TAC[is_int];
47763 USE 24 (REWRITE_RULE[int_rep]);
47764 USE 19 (MATCH_MP point_onto);
47765 REWRITE_TAC[point_inj];
47766 TYPE_THEN `w` UNABBREV_TAC;
47767 FULL_REWRITE_TAC[coord01;PAIR_SPLIT];
47770 TYPE_THEN `?m. v = pointI m` SUBAGOAL_TAC;
47771 FIRST_ASSUM IMATCH_MP_TAC ;
47772 THM_INTRO_TAC[`e`;`v`;`v'`] simple_arc_end_end;
47773 USE 8 (MATCH_MP simple_arc_end_simple);
47774 USE 8 (MATCH_MP simple_arc_euclid);
47775 ASM_MESON_TAC[subset_imp];
47776 UND 9 THEN (DISCH_THEN (THM_INTRO_TAC[`&0`]));
47778 TYPE_THEN `(?k. k <| N /\ (&0 = t k))` SUBAGOAL_TAC;
47780 TYPE_THEN `m` EXISTS_TAC;
47783 IMATCH_MP_TAC (ARITH_RULE `~(0 < k) ==> (k = 0)`);
47784 USE 16 (REWRITE_RULE[IMAGE;SUBSET ]);
47785 USE 16 (CONV_RULE NAME_CONFLICT_CONV);
47789 TYPE_THEN `0 < N` SUBAGOAL_TAC;
47790 UND 21 THEN UND 20 THEN ARITH_TAC;
47792 USE 23 (MATCH_MP (ARITH_RULE `x <= y ==> ~( y < x)`));
47793 UND 23 THEN REWRITE_TAC[];
47794 FIRST_ASSUM IMATCH_MP_TAC ;
47797 TYPE_THEN `?m. v' = pointI m` SUBAGOAL_TAC;
47798 FIRST_ASSUM IMATCH_MP_TAC ;
47799 THM_INTRO_TAC[`e`;`v`;`v'`] simple_arc_end_end2;
47800 USE 8 (MATCH_MP simple_arc_end_simple);
47801 USE 8 (MATCH_MP simple_arc_euclid);
47802 ASM_MESON_TAC[subset_imp];
47803 UND 9 THEN (DISCH_THEN (THM_INTRO_TAC[`&1`]));
47805 REWRITE_TAC[ARITH_RULE `1 <= 1`];
47809 TYPE_THEN `(?k. k <| N /\ (&1 = t k))` SUBAGOAL_TAC;
47811 TYPE_THEN `m` EXISTS_TAC;
47814 IMATCH_MP_TAC (ARITH_RULE `(k < N) /\ ~(k < N - 1) ==> (k = N - 1)`);
47815 USE 16 (REWRITE_RULE[IMAGE;SUBSET ]);
47816 USE 22 (CONV_RULE NAME_CONFLICT_CONV);
47817 TSPEC `t (N-1)` 22;
47820 UND 22 THEN DISCH_THEN (THM_INTRO_TAC[]);
47821 UND 21 THEN ARITH_TAC;
47823 USE 22 (MATCH_MP (ARITH_RULE `x <= y ==> ~( y < x)`));
47824 UND 22 THEN REWRITE_TAC[];
47825 FIRST_ASSUM IMATCH_MP_TAC ;
47826 UND 16 THEN ARITH_TAC;
47830 TYPE_THEN `&0 <= t i /\ t i <= &1` SUBAGOAL_TAC;
47831 USE 16 (REWRITE_RULE[SUBSET;IMAGE]);
47832 FIRST_ASSUM IMATCH_MP_TAC ;
47833 TYPE_THEN `i` EXISTS_TAC;
47834 UND 19 THEN ARITH_TAC;
47836 TYPE_THEN `&0 <= t (SUC i) /\ t (SUC i) <= &1` SUBAGOAL_TAC;
47837 USE 16 (REWRITE_RULE[SUBSET;IMAGE]);
47838 FIRST_ASSUM IMATCH_MP_TAC ;
47839 TYPE_THEN `SUC i` EXISTS_TAC;
47842 TYPE_THEN `connected top2 (IMAGE f {x | t i < x /\ x < t (SUC i)})` SUBAGOAL_TAC;
47843 IMATCH_MP_TAC connect_image;
47844 TYPE_THEN `top_of_metric (UNIV,d_real)` EXISTS_TAC;
47845 REWRITE_TAC[top2_unions];
47847 REWRITE_TAC[IMAGE;SUBSET];
47848 USE 10 (REWRITE_RULE[INJ]);
47849 FIRST_ASSUM IMATCH_MP_TAC ;
47850 UND 26 THEN UND 27 THEN UND 23 THEN UND 22 THEN REAL_ARITH_TAC;
47852 REWRITE_TAC[connect_real_open];
47854 TYPE_THEN `!x. &0 <= x /\ x <= &1 /\ ~(IMAGE t {j | j<| N} x) ==> (?e. edge e /\ (e (f x)))` SUBAGOAL_TAC;
47855 TYPE_THEN `e` UNABBREV_TAC;
47856 USE 6 (REWRITE_RULE[SUBSET;UNIONS;IMAGE ]);
47857 USE 6 (CONV_RULE NAME_CONFLICT_CONV);
47859 UND 6 THEN DISCH_THEN (THM_INTRO_TAC[]);
47860 TYPE_THEN `x` EXISTS_TAC;
47864 TYPE_THEN `u'` UNABBREV_TAC;
47865 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`z`;`eps`]);
47866 TYPE_THEN `z` UNABBREV_TAC;
47868 TYPE_THEN `euclid 2 (f x)` SUBAGOAL_TAC;
47869 USE 8 (MATCH_MP simple_arc_end_simple);
47870 USE 0 (MATCH_MP simple_arc_euclid);
47871 USE 0 (REWRITE_RULE[SUBSET]);
47872 FIRST_ASSUM IMATCH_MP_TAC ;
47873 IMATCH_MP_TAC image_imp;
47875 TYPE_THEN `?C. cell C /\ C (f x)` SUBAGOAL_TAC;
47876 USE 0 (MATCH_MP point_onto);
47877 THM_INTRO_TAC[`p`] cell_unions;
47878 USE 1 (REWRITE_RULE[UNIONS]);
47879 TYPE_THEN `u` EXISTS_TAC;
47880 TYPE_THEN `C` EXISTS_TAC;
47881 FULL_REWRITE_TAC[cell];
47882 UND 29 THEN REP_CASES_TAC;
47883 TYPE_THEN `C` UNABBREV_TAC;
47884 FULL_REWRITE_TAC[INR IN_SING];
47885 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
47886 TYPE_THEN `(?k. k <| N /\ (x = t k))` SUBAGOAL_TAC;
47889 TYPE_THEN `x` UNABBREV_TAC;
47890 PROOF_BY_CONTR_TAC;
47891 UND 26 THEN REWRITE_TAC[];
47892 IMATCH_MP_TAC image_imp;
47894 REWRITE_TAC[edge_h];
47895 REWRITE_TAC[edge_v];
47896 TYPE_THEN `C` UNABBREV_TAC;
47897 USE 1 (REWRITE_RULE[squ]);
47898 TYPE_THEN `f x` UNABBREV_TAC;
47899 USE 6 (REWRITE_RULE[eps_hyper]);
47900 UND 6 THEN COND_CASES_TAC;
47901 FULL_REWRITE_TAC[e1];
47902 FULL_REWRITE_TAC[ONCE_REWRITE_RULE[EQ_SYM_EQ] line2D_F];
47903 FULL_REWRITE_TAC[point_inj];
47904 TYPE_THEN `p'` UNABBREV_TAC;
47905 TYPE_THEN `u` UNABBREV_TAC;
47907 FULL_REWRITE_TAC[GSYM int_neg_num_th;GSYM int_lt;];
47908 UND 30 THEN UND 31 THEN INT_ARITH_TAC;
47910 FULL_REWRITE_TAC[e2];
47911 FULL_REWRITE_TAC[ONCE_REWRITE_RULE[EQ_SYM_EQ] line2D_S];
47912 FULL_REWRITE_TAC[point_inj];
47913 TYPE_THEN `p'` UNABBREV_TAC;
47914 TYPE_THEN `v''` UNABBREV_TAC;
47915 FULL_REWRITE_TAC[GSYM int_neg_num_th;GSYM int_lt;];
47916 UND 1 THEN UND 29 THEN INT_ARITH_TAC;
47918 THM_INTRO_TAC[`(IMAGE f {x | t i < x /\ x < t (SUC i)})`] connected_in_edge;
47919 REWRITE_TAC[IMAGE;SUBSET;UNIONS];
47920 FIRST_ASSUM IMATCH_MP_TAC ;
47922 UND 29 THEN UND 22 THEN REAL_ARITH_TAC;
47924 UND 23 THEN UND 28 THEN REAL_ARITH_TAC;
47925 USE 30 (REWRITE_RULE[IMAGE]);
47926 TYPE_THEN `x'` UNABBREV_TAC;
47927 USE 28 (MATCH_MP (REAL_ARITH `x < y ==> ~(y < x) /\ ~(x = y)`));
47928 UND 30 THEN REWRITE_TAC[];
47929 FIRST_ASSUM IMATCH_MP_TAC ;
47930 IMATCH_MP_TAC (ARITH_RULE `~(x = y) /\ ~(x <| y) ==> (y < x)`);
47932 TYPE_THEN `x''` UNABBREV_TAC;
47933 USE 29 (MATCH_MP (REAL_ARITH `x < y ==> ~(y < x) /\ ~(x = y)`));
47934 UND 32 THEN REWRITE_TAC[];
47935 FIRST_ASSUM IMATCH_MP_TAC ;
47936 TYPE_THEN `i <| N` SUBAGOAL_TAC;
47937 UND 19 THEN ARITH_TAC;
47938 IMATCH_MP_TAC (ARITH_RULE `~(x = y) /\ ~(x <| y) ==> (y < x)`);
47940 TYPE_THEN `x''` UNABBREV_TAC;
47941 UND 33 THEN UND 30 THEN ARITH_TAC;
47943 TYPE_THEN `e'` EXISTS_TAC;
47945 TYPE_THEN `C = IMAGE f {x | t i <= x /\ x <= t (SUC i)}` ABBREV_TAC ;
47946 IMATCH_MP_TAC simple_arc_end_edge_full_closure;
47953 TYPE_THEN `v` UNABBREV_TAC;
47954 TYPE_THEN `v'` UNABBREV_TAC;
47955 TYPE_THEN `!k. k <| N ==> (?m. f (t k) = pointI m)` SUBAGOAL_TAC;
47956 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`t k`]);
47957 USE 16 (REWRITE_RULE[IMAGE;SUBSET]);
47959 TYPE_THEN `k` EXISTS_TAC;
47963 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
47964 UND 19 THEN ARITH_TAC;
47965 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[`SUC i`]);
47966 TYPE_THEN `m` EXISTS_TAC;
47967 TYPE_THEN `m'` EXISTS_TAC;
47968 IMATCH_MP_TAC (TAUT `A /\ B ==> B /\ A`);
47970 TYPE_THEN `C` UNABBREV_TAC;
47971 USE 5 (REWRITE_RULE[IMAGE]);
47972 TYPE_THEN `x` UNABBREV_TAC;
47973 TYPE_THEN `pointI m` UNABBREV_TAC;
47974 TYPE_THEN `pointI m'` UNABBREV_TAC;
47975 USE 27 (REWRITE_RULE[IMAGE;SUBSET]);
47976 FIRST_ASSUM IMATCH_MP_TAC ;
47977 TYPE_THEN `x'` EXISTS_TAC;
47978 TYPE_THEN `~(x' = t i)` SUBAGOAL_TAC;
47979 TYPE_THEN `x'` UNABBREV_TAC;
47980 TYPE_THEN `~(x' = t (SUC i))` SUBAGOAL_TAC;
47981 TYPE_THEN `x'` UNABBREV_TAC;
47982 UND 5 THEN UND 2 THEN UND 15 THEN UND 14 THEN REAL_ARITH_TAC;
47984 REWRITE_TAC[simple_arc_end];
47985 THM_INTRO_TAC[`&0`;`&1`;`t i`;`t (SUC i)`;`C`;`f`;`t i`;`t (SUC i)`] arc_restrict;
47986 REWRITE_TAC[REAL_ARITH `x <= x`];
47987 USE 11 (REWRITE_RULE[top2]);
47989 FIRST_ASSUM IMATCH_MP_TAC ;
47990 UND 19 THEN ARITH_TAC;
47991 IMATCH_MP_TAC inj_subset_domain;
47993 REWRITE_TAC[SUBSET];
47994 UND 4 THEN UND 5 THEN UND 22 THEN UND 23 THEN REAL_ARITH_TAC;
47995 TYPE_THEN `g` EXISTS_TAC;
47998 (* Tue Dec 21 19:05:25 EST 2004 *)
48003 let order_lt_imp_psegment = prove_by_refinement(
48005 INJ f {p | p <| n} edge /\
48008 i <| n /\ j <| n /\ (i < j)
48009 ==> (adj (f i) (f j) = (SUC i = j) ))
48010 ==> psegment (IMAGE f {p | p <| n})`,
48014 IMATCH_MP_TAC order_imp_psegment;
48016 TYPE_THEN `i <| j` ASM_CASES_TAC;
48017 TYPE_THEN `~(SUC j = i)` SUBAGOAL_TAC;
48018 UND 6 THEN UND 5 THEN ARITH_TAC;
48019 FIRST_ASSUM IMATCH_MP_TAC ;
48020 TYPE_THEN `i = j` ASM_CASES_TAC;
48022 UND 7 THEN ARITH_TAC;
48023 TYPE_THEN `j <| i` SUBAGOAL_TAC;
48024 UND 6 THEN UND 5 THEN ARITH_TAC;
48025 TYPE_THEN `~(SUC i = j)` SUBAGOAL_TAC;
48026 UND 8 THEN UND 7 THEN ARITH_TAC;
48027 ONCE_REWRITE_TAC[adj_symm];
48028 FIRST_ASSUM IMATCH_MP_TAC ;
48033 let simple_arc_finite_lemma4 = prove_by_refinement(
48034 `!E e v v'. simple_arc_end e v v' /\
48036 e SUBSET UNIONS E /\
48037 E (eps_hyper T (v 0)) /\ E (eps_hyper F (v 1)) /\
48038 E (eps_hyper T (v' 0)) /\ E (eps_hyper F (v' 1)) /\
48039 (!e. E e ==> (?z eps. e = eps_hyper eps z)) /\
48040 (!z eps. E (eps_hyper eps z) ==> (?j. z = -- &j)) ==>
48041 (?S a b. segment_end S a b /\ (v = pointI a) /\ (v' = pointI b) /\
48042 (e = closure top2 (UNIONS S)))
48047 THM_INTRO_TAC[`E`;`e`;`v`;`v'`]simple_arc_finite_lemma3;
48050 REWRITE_TAC[segment_end];
48053 TYPE_THEN `S = IMAGE ed {p | p <| N - 1}` ABBREV_TAC ;
48054 TYPE_THEN `S` EXISTS_TAC;
48055 TYPE_THEN `!i. i <| N ==> (?m. f (t i) = pointI m)` SUBAGOAL_TAC;
48058 UND 12 THEN DISCH_THEN (THM_INTRO_TAC[`t i`]);
48059 USE 19 (REWRITE_RULE[IMAGE;SUBSET]);
48060 FIRST_ASSUM IMATCH_MP_TAC ;
48066 TYPE_THEN `0 <| N` SUBAGOAL_TAC;
48067 IMATCH_MP_TAC (ARITH_RULE `~(N = 0) ==> (0 <| N)`);
48068 TYPE_THEN `N` UNABBREV_TAC;
48069 FULL_REWRITE_TAC[ARITH_RULE `0 -| 1 = 0`];
48070 UND 10 THEN UND 11 THEN REAL_ARITH_TAC;
48072 TYPE_THEN `?a. f (t 0) = pointI a` SUBAGOAL_TAC;
48073 TYPE_THEN `?b. f (t (N - 1)) = pointI b` SUBAGOAL_TAC;
48074 FIRST_ASSUM IMATCH_MP_TAC ;
48075 UND 22 THEN ARITH_TAC;
48076 TYPE_THEN `a` EXISTS_TAC;
48077 TYPE_THEN `b` EXISTS_TAC;
48079 TYPE_THEN `v = pointI a` SUBAGOAL_TAC;
48080 TYPE_THEN `v` UNABBREV_TAC;
48083 TYPE_THEN `v' = pointI b` SUBAGOAL_TAC;
48084 TYPE_THEN `v'` UNABBREV_TAC;
48087 TYPE_THEN `(INJ ed {p | p <| N-1 } edge) /\ ( 0 <| N-1) /\ (!i j. i <| N-1 /\ j <| N-1 /\ i <| j ==> (adj (ed i) (ed j) <=> (SUC i = j)))` SUBAGOAL_TAC;
48088 TYPE_THEN `S` UNABBREV_TAC;
48089 SUBCONJ_TAC; (* // *)
48092 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
48093 UND 20 THEN ARITH_TAC;
48094 TYPE_THEN `!x y. x < y /\ y <| N - 1 ==> ~(ed x = ed y)` SUBAGOAL_TAC;
48095 TYPE_THEN `t x' < t y'` SUBAGOAL_TAC;
48096 FIRST_ASSUM IMATCH_MP_TAC ;
48097 UND 31 THEN UND 30 THEN ARITH_TAC;
48099 UND 33 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
48100 UND 31 THEN UND 30 THEN ARITH_TAC;
48101 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`y'`]);
48102 UND 30 THEN ARITH_TAC;
48103 TYPE_THEN `ed x'` UNABBREV_TAC;
48104 TYPE_THEN `IMAGE f {x | t x' <= x /\ x <= t (SUC x')} (f (t x'))` SUBAGOAL_TAC;
48106 IMATCH_MP_TAC image_imp;
48109 IMATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`);
48110 FIRST_ASSUM IMATCH_MP_TAC ;
48111 UND 31 THEN UND 30 THEN ARITH_TAC;
48112 TYPE_THEN `IMAGE f {x | t y' <= x /\ x <= t (SUC y')} (f (t x'))` SUBAGOAL_TAC;
48115 USE 36 (REWRITE_RULE[IMAGE]);
48116 USE 13 (REWRITE_RULE[INJ]);
48117 TYPE_THEN `t x' = x''` SUBAGOAL_TAC;
48118 FIRST_ASSUM IMATCH_MP_TAC ;
48121 USE 19 (REWRITE_RULE[IMAGE;SUBSET]);
48123 FIRST_ASSUM IMATCH_MP_TAC ;
48124 TYPE_THEN `x'` EXISTS_TAC;
48125 UND 31 THEN UND 30 THEN ARITH_TAC;
48126 TYPE_THEN `&0 <= t y' /\ t y' <= &1` SUBAGOAL_TAC;
48127 FIRST_ASSUM IMATCH_MP_TAC ;
48128 TYPE_THEN `y'` EXISTS_TAC;
48129 UND 30 THEN ARITH_TAC;
48131 UND 41 THEN UND 38 THEN ARITH_TAC;
48132 TYPE_THEN `&0 <= t (SUC y') /\ t (SUC y') <= &1` SUBAGOAL_TAC;
48133 FIRST_ASSUM IMATCH_MP_TAC ;
48134 TYPE_THEN `SUC y'` EXISTS_TAC;
48135 UND 30 THEN ARITH_TAC;
48136 UND 42 THEN UND 37 THEN ARITH_TAC;
48137 TYPE_THEN `x''` UNABBREV_TAC;
48138 UND 38 THEN UND 32 THEN REAL_ARITH_TAC;
48139 IMATCH_MP_TAC (ARITH_RULE `(~(x <| y) /\ ~(y < x)) ==> (x = y)`);
48141 UND 30 THEN UND 29 THEN UND 27 THEN UND 20 THEN MESON_TAC[];
48142 UND 30 THEN UND 29 THEN UND 28 THEN UND 20 THEN MESON_TAC[];
48145 IMATCH_MP_TAC (ARITH_RULE `~(0 = N-1) ==> (0 <| N- 1)`);
48146 TYPE_THEN `N -| 1` UNABBREV_TAC;
48147 UND 10 THEN UND 11 THEN REAL_ARITH_TAC;
48149 TYPE_THEN `!i u. (i <| N - 1) ==> (closure top2 (ed i) u <=> (?x. (u = f x) /\ t i <= x /\ x <= t (SUC i)))` SUBAGOAL_TAC;
48150 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`i'`]);
48151 UND 31 THEN ARITH_TAC;
48152 USE 9 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
48155 REWRITE_TAC[IMAGE];
48156 REWRITE_TAC[CONJ_ACI];
48158 REWRITE_TAC[adj;EMPTY_EXISTS;INTER ];
48159 IMATCH_MP_TAC EQ_ANTISYM;
48161 TYPE_THEN `u` UNABBREV_TAC;
48162 TYPE_THEN `x = x'` SUBAGOAL_TAC;
48163 USE 13 (REWRITE_RULE[INJ]);
48166 FIRST_ASSUM IMATCH_MP_TAC ;
48167 TYPE_THEN `!x j. j < N -| 1 /\ t j <= x /\ x <= t (SUC j) ==> (&0 <= x /\ x <= &1)` SUBAGOAL_TAC;
48168 USE 19 (REWRITE_RULE[IMAGE;SUBSET]);
48169 TYPE_THEN `&0 <= t j' /\ t j' <= &1` SUBAGOAL_TAC;
48170 FIRST_ASSUM IMATCH_MP_TAC ;
48171 TYPE_THEN `j'` EXISTS_TAC;
48172 UND 41 THEN ARITH_TAC;
48173 TYPE_THEN `&0 <= t (SUC j') /\ t (SUC j') <= &1` SUBAGOAL_TAC;
48174 FIRST_ASSUM IMATCH_MP_TAC ;
48175 TYPE_THEN `SUC j'` EXISTS_TAC;
48176 UND 41 THEN ARITH_TAC;
48177 UND 44 THEN UND 39 THEN UND 43 THEN UND 40 THEN REAL_ARITH_TAC;
48178 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC ;
48179 TYPE_THEN `i` EXISTS_TAC;
48180 TYPE_THEN `j` EXISTS_TAC;
48181 TYPE_THEN `x'` UNABBREV_TAC;
48182 TYPE_THEN `t i < t j` SUBAGOAL_TAC;
48183 FIRST_ASSUM IMATCH_MP_TAC ;
48184 UND 28 THEN UND 29 THEN ARITH_TAC;
48185 PROOF_BY_CONTR_TAC;
48186 TYPE_THEN `t j <= t (SUC i)` SUBAGOAL_TAC;
48187 UND 35 THEN UND 33 THEN REAL_ARITH_TAC;
48188 USE 40 (MATCH_MP (REAL_ARITH `x <= y ==> ~(y < x)`));
48189 UND 40 THEN REWRITE_TAC[];
48190 FIRST_ASSUM IMATCH_MP_TAC ;
48191 UND 39 THEN UND 27 THEN UND 28 THEN UND 29 THEN ARITH_TAC;
48193 TYPE_THEN `j` UNABBREV_TAC;
48195 TYPE_THEN `i = SUC i` SUBAGOAL_TAC;
48196 USE 20 (REWRITE_RULE[INJ]);
48197 FIRST_ASSUM IMATCH_MP_TAC ;
48198 UND 33 THEN ARITH_TAC;
48199 TYPE_THEN `f (t (SUC i))` EXISTS_TAC;
48201 TYPE_THEN `t (SUC i)` EXISTS_TAC;
48202 REWRITE_TAC[REAL_ARITH `x <= x`];
48203 IMATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`);
48204 FIRST_ASSUM IMATCH_MP_TAC ;
48205 UND 28 THEN ARITH_TAC;
48206 TYPE_THEN `t (SUC i)` EXISTS_TAC;
48207 REWRITE_TAC[REAL_ARITH `x <= x`];
48208 IMATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`);
48209 FIRST_ASSUM IMATCH_MP_TAC ;
48210 UND 28 THEN ARITH_TAC;
48212 TYPE_THEN `!i u. (i <| N - 1) ==> (closure top2 (ed i) u <=> (?x. (u = f x) /\ t i <= x /\ x <= t (SUC i)))` SUBAGOAL_TAC;
48213 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
48214 UND 30 THEN ARITH_TAC;
48215 USE 9 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
48218 REWRITE_TAC[IMAGE];
48219 REWRITE_TAC[CONJ_ACI];
48223 TYPE_THEN `!x j. j < N -| 1 /\ t j <= x /\ x <= t (SUC j) ==> (&0 <= x /\ x <= &1)` SUBAGOAL_TAC;
48224 USE 19 (REWRITE_RULE[IMAGE;SUBSET]);
48225 TYPE_THEN `&0 <= t j /\ t j <= &1` SUBAGOAL_TAC;
48226 FIRST_ASSUM IMATCH_MP_TAC ;
48227 TYPE_THEN `j` EXISTS_TAC;
48228 UND 33 THEN ARITH_TAC;
48229 TYPE_THEN `&0 <= t (SUC j) /\ t (SUC j) <= &1` SUBAGOAL_TAC;
48230 FIRST_ASSUM IMATCH_MP_TAC ;
48231 TYPE_THEN `SUC j` EXISTS_TAC;
48232 UND 33 THEN ARITH_TAC;
48233 UND 36 THEN UND 31 THEN UND 35 THEN UND 32 THEN REAL_ARITH_TAC;
48235 ONCE_REWRITE_TAC[CONJ_ACI];
48237 THM_INTRO_TAC[`ed`;`N-| 1`] order_lt_imp_psegment;
48239 TYPE_THEN `S` UNABBREV_TAC;
48241 TYPE_THEN `{a, b} SUBSET endpoint S` SUBAGOAL_TAC;
48242 REWRITE_TAC[SUBSET;INR in_pair];
48243 REWRITE_TAC[endpoint];
48244 THM_INTRO_TAC[`S`;`pointI x`] num_closure1;
48245 USE 32 (REWRITE_RULE[psegment;segment]);
48246 FIRST_ASSUM DISJ_CASES_TAC; (* // *)
48247 TYPE_THEN `x` UNABBREV_TAC;
48248 TYPE_THEN `ed (N -2)` EXISTS_TAC;
48249 TYPE_THEN `S` UNABBREV_TAC;
48250 REWRITE_TAC[IMAGE];
48251 IMATCH_MP_TAC EQ_ANTISYM;
48253 TYPE_THEN `e'` UNABBREV_TAC;
48254 PROOF_BY_CONTR_TAC;
48255 TYPE_THEN `x' < N -| 2` SUBAGOAL_TAC;
48256 IMATCH_MP_TAC (ARITH_RULE `x' < N -| 1 /\ ~(x' = N-2) ==> x' < N -2`);
48257 PROOF_BY_CONTR_TAC;
48259 TYPE_THEN `x'` UNABBREV_TAC;
48261 TYPE_THEN `pointI b` UNABBREV_TAC;
48262 UND 20 THEN UND 30 THEN UND 36 THEN SIMP_TAC[];
48264 TYPE_THEN `t (N -1) = x''` SUBAGOAL_TAC;
48265 USE 13 (REWRITE_RULE[INJ]);
48266 FIRST_ASSUM IMATCH_MP_TAC ;
48269 REWRITE_TAC[ARITH_RULE `1 <= 1`];
48270 FIRST_ASSUM IMATCH_MP_TAC ;
48271 TYPE_THEN `x'` EXISTS_TAC;
48272 TYPE_THEN `x''` UNABBREV_TAC;
48273 USE 20 (MATCH_MP (REAL_ARITH `x <= y ==> ~( y < x)`));
48274 UND 20 THEN REWRITE_TAC[];
48275 FIRST_ASSUM IMATCH_MP_TAC ;
48276 UND 37 THEN ARITH_TAC;
48277 TYPE_THEN `e'` UNABBREV_TAC;
48279 TYPE_THEN `N-| 2` EXISTS_TAC;
48280 UND 28 THEN ARITH_TAC;
48281 TYPE_THEN `N -| 2 < N -| 1` SUBAGOAL_TAC;
48282 UND 28 THEN ARITH_TAC;
48283 TYPE_THEN `t (N - 1)` EXISTS_TAC;
48284 TYPE_THEN `SUC (N - 2) = N - 1` SUBAGOAL_TAC;
48285 UND 28 THEN ARITH_TAC;
48287 REWRITE_TAC[REAL_ARITH `x <= x`];
48288 IMATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`);
48289 FIRST_ASSUM IMATCH_MP_TAC ;
48290 UND 28 THEN ARITH_TAC;
48292 TYPE_THEN `x` UNABBREV_TAC;
48293 TYPE_THEN `ed (0)` EXISTS_TAC;
48294 TYPE_THEN `S` UNABBREV_TAC;
48295 REWRITE_TAC[IMAGE];
48296 IMATCH_MP_TAC EQ_ANTISYM;
48298 TYPE_THEN `e'` UNABBREV_TAC;
48299 PROOF_BY_CONTR_TAC;
48300 TYPE_THEN `0 < x'` SUBAGOAL_TAC;
48301 IMATCH_MP_TAC (ARITH_RULE `~(x' = 0) ==> 0 < x'`);
48302 TYPE_THEN `x'` UNABBREV_TAC;
48304 TYPE_THEN `pointI a` UNABBREV_TAC;
48305 UND 20 THEN UND 30 THEN UND 36 THEN SIMP_TAC[];
48307 TYPE_THEN `t (0) = x''` SUBAGOAL_TAC;
48308 USE 13 (REWRITE_RULE[INJ]);
48309 FIRST_ASSUM IMATCH_MP_TAC ;
48312 FIRST_ASSUM IMATCH_MP_TAC ;
48313 TYPE_THEN `x'` EXISTS_TAC;
48314 TYPE_THEN `x''` UNABBREV_TAC;
48315 USE 25 (MATCH_MP (REAL_ARITH `x <= y ==> ~( y < x)`));
48316 UND 25 THEN REWRITE_TAC[];
48317 FIRST_ASSUM IMATCH_MP_TAC ;
48318 UND 38 THEN ARITH_TAC;
48319 TYPE_THEN `e'` UNABBREV_TAC;
48321 TYPE_THEN `0` EXISTS_TAC;
48323 TYPE_THEN `t (0)` EXISTS_TAC;
48326 IMATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`);
48327 FIRST_ASSUM IMATCH_MP_TAC ;
48328 UND 28 THEN ARITH_TAC;
48331 IMATCH_MP_TAC has_size2_pair;
48333 IMATCH_MP_TAC endpoint_size2;
48334 USE 33 (REWRITE_RULE[SUBSET;INR in_pair]);
48336 FIRST_ASSUM IMATCH_MP_TAC ;
48338 FIRST_ASSUM IMATCH_MP_TAC ;
48339 TYPE_THEN `a` UNABBREV_TAC;
48340 TYPE_THEN `v = v'` SUBAGOAL_TAC;
48341 USE 8(MATCH_MP simple_arc_end_distinct);
48342 UND 8 THEN ASM_REWRITE_TAC[];
48344 IMATCH_MP_TAC EQ_EXT ;
48345 THM_INTRO_TAC[`S`;`top2`] closure_unions;
48346 REWRITE_TAC[top2_top];
48347 FULL_REWRITE_TAC[psegment;segment];
48348 TYPE_THEN `S` UNABBREV_TAC;
48349 REWRITE_TAC[UNIONS];
48350 IMATCH_MP_TAC EQ_ANTISYM;
48352 USE 20 (REWRITE_RULE[IMAGE]);
48354 TYPE_THEN `A = {i | (i <=| N -| 1) /\ (t i <= x')}` ABBREV_TAC ;
48355 TYPE_THEN `FINITE A` SUBAGOAL_TAC;
48356 IMATCH_MP_TAC FINITE_SUBSET;
48357 TYPE_THEN `{i | i <=| (N -| 1)}` EXISTS_TAC;
48358 TYPE_THEN `A` UNABBREV_TAC;
48359 REWRITE_TAC[SUBSET];
48360 REWRITE_TAC[FINITE_NUMSEG_LE];
48361 TYPE_THEN `A 0` SUBAGOAL_TAC;
48362 TYPE_THEN `A` UNABBREV_TAC;
48364 UND 28 THEN ARITH_TAC;
48365 THM_INTRO_TAC[`A`] select_num_max;
48366 REWRITE_TAC[EMPTY_EXISTS];
48367 TYPE_THEN `0` EXISTS_TAC;
48368 TYPE_THEN `x' = &1` ASM_CASES_TAC;
48369 TYPE_THEN `closure top2 (ed (N -| 2))` EXISTS_TAC;
48371 IMATCH_MP_TAC image_imp;
48372 IMATCH_MP_TAC image_imp;
48373 UND 28 THEN ARITH_TAC;
48375 TYPE_THEN `N - 2 <| N - 1` SUBAGOAL_TAC;
48376 UND 28 THEN ARITH_TAC;
48377 TYPE_THEN `t (N -| 1)` EXISTS_TAC;
48378 TYPE_THEN `N - 1 = SUC (N - 2)` SUBAGOAL_TAC;
48379 UND 28 THEN ARITH_TAC;
48382 REWRITE_TAC[REAL_ARITH `x <= x`];
48383 IMATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`);
48384 FIRST_ASSUM IMATCH_MP_TAC ;
48385 UND 28 THEN ARITH_TAC;
48387 TYPE_THEN `closure top2 (ed z)` EXISTS_TAC;
48389 IMATCH_MP_TAC image_imp;
48390 IMATCH_MP_TAC image_imp;
48391 TYPE_THEN `A` UNABBREV_TAC;
48392 IMATCH_MP_TAC (ARITH_RULE `z <= N - 1 /\ ~(z = N - 1) ==> z < N - 1`);
48394 TYPE_THEN `z` UNABBREV_TAC;
48395 UND 36 THEN UND 43 THEN UND 38 THEN UND 10 THEN REAL_ARITH_TAC;
48396 TYPE_THEN `z <| N-1` SUBAGOAL_TAC;
48397 IMATCH_MP_TAC (ARITH_RULE `z <= N - 1 /\ ~(z = N - 1) ==> z < N - 1`);
48398 TYPE_THEN `A` UNABBREV_TAC;
48400 TYPE_THEN `z` UNABBREV_TAC;
48401 UND 36 THEN UND 43 THEN UND 38 THEN UND 10 THEN REAL_ARITH_TAC;
48402 TYPE_THEN `x'` EXISTS_TAC;
48403 TYPE_THEN `A` UNABBREV_TAC;
48404 IMATCH_MP_TAC (REAL_ARITH `~(x <= y) ==> (y <= x)`);
48405 UND 41 THEN DISCH_THEN (THM_INTRO_TAC[`SUC z`]);
48406 UND 44 THEN ARITH_TAC;
48407 UND 41 THEN ARITH_TAC;
48409 USE 36 (REWRITE_RULE[IMAGE]);
48410 TYPE_THEN `u` UNABBREV_TAC;
48411 TYPE_THEN `x'` UNABBREV_TAC;
48412 UND 30 THEN DISCH_THEN (THM_INTRO_TAC[`x''`;`x`]);
48414 IMATCH_MP_TAC image_imp;
48415 FIRST_ASSUM IMATCH_MP_TAC ;
48416 TYPE_THEN `x''` EXISTS_TAC;
48417 (* Wed Dec 22 07:47:58 EST 2004 *)
48421 let psegment_cls = prove_by_refinement(
48422 `!S. psegment S ==> IMAGE pointI (cls S) SUBSET closure top2 (UNIONS S)`,
48426 REWRITE_TAC[cls;IMAGE;SUBSET];
48427 THM_INTRO_TAC[`S`;`top2`] closure_unions;
48428 FULL_REWRITE_TAC[top2_top;psegment;segment];
48429 REWRITE_TAC[UNIONS;IMAGE];
48430 CONV_TAC (dropq_conv "u");
48435 let planar_graph_rectagonal = prove_by_refinement(
48436 `!(G:(A,B)graph_t). planar_graph G /\ FINITE (graph_edge G) /\
48437 FINITE (graph_vertex G) /\
48438 ~(graph_edge G = {}) /\
48439 (!v. CARD (graph_edge_around G v) <=| 4) ==>
48440 (rectagonal_graph G)`,
48444 THM_INTRO_TAC[`G`] graph_int_model;
48445 REWRITE_TAC[rectagonal_graph;rectagon_graph];
48446 TYPE_THEN `graph H` SUBAGOAL_TAC;
48447 FULL_REWRITE_TAC[good_plane_graph;plane_graph];
48448 TYPE_THEN `!e. graph_edge H e ==> (?S a b. segment_end S a b /\ (graph_inc H e = { (pointI a), (pointI b) }) /\ (e = closure top2 (UNIONS S)))` SUBAGOAL_TAC;
48449 FULL_REWRITE_TAC[good_plane_graph];
48452 THM_INTRO_TAC[`H`;`e`] graph_edge_end_select;
48453 UND 10 THEN DISCH_THEN (THM_INTRO_TAC[`v`;`v'`]);
48454 THM_INTRO_TAC[`E`;`e`;`v`;`v'`] simple_arc_finite_lemma4;
48456 THM_INTRO_TAC[`H`;`e`] graph_inc_subset;
48457 TYPE_THEN `graph_vertex H v` SUBAGOAL_TAC;
48458 ASM_MESON_TAC[subset_imp];
48459 TYPE_THEN `graph_vertex H v'` SUBAGOAL_TAC;
48460 ASM_MESON_TAC[subset_imp];
48461 TYPE_THEN `S` EXISTS_TAC;
48462 TYPE_THEN `a` EXISTS_TAC;
48463 TYPE_THEN `b` EXISTS_TAC;
48465 IMATCH_MP_TAC has_size2_subset_ne;
48467 IMATCH_MP_TAC graph_edge2;
48468 REWRITE_TAC[SUBSET;INR in_pair];
48470 FIRST_ASSUM DISJ_CASES_TAC;
48475 UND 15 THEN ASM_REWRITE_TAC[];
48480 TYPE_THEN `!w. (euclid 2 w ) /\ E (eps_hyper T (w 0)) /\ E (eps_hyper F (w 1)) ==> (?m. (w = pointI m))` SUBAGOAL_TAC;
48481 TYPE_THEN `(?j. w 0 = -- &j)` SUBAGOAL_TAC;
48482 FIRST_ASSUM IMATCH_MP_TAC ;
48484 TYPE_THEN `?j. w 1 = -- &j` SUBAGOAL_TAC;
48485 FIRST_ASSUM IMATCH_MP_TAC ;
48487 REWRITE_TAC[pointI];
48488 TYPE_THEN `(-- &:j, -- &: j')` EXISTS_TAC;
48489 REWRITE_TAC[int_neg_num_th];
48490 USE 16 (MATCH_MP point_onto);
48491 REWRITE_TAC[point_inj];
48492 TYPE_THEN `w` UNABBREV_TAC;
48493 FULL_REWRITE_TAC[coord01;PAIR_SPLIT];
48495 TYPE_THEN `!v. graph_vertex H v ==> ?a. (v = pointI a)` SUBAGOAL_TAC;
48496 FIRST_ASSUM IMATCH_MP_TAC ;
48497 FULL_REWRITE_TAC[good_plane_graph;plane_graph];
48498 ASM_MESON_TAC[subset_imp];
48501 TYPE_THEN `J = mk_graph_t (IMAGE a (graph_vertex H), IMAGE S (graph_edge H),endpoint)` ABBREV_TAC ;
48502 TYPE_THEN `J` EXISTS_TAC;
48504 TYPE_THEN `graph_isomorphic H J` SUBAGOAL_TAC;
48505 REWRITE_TAC[graph_isomorphic;graph_iso];
48507 TYPE_THEN `a` EXISTS_TAC;
48509 TYPE_THEN `S` EXISTS_TAC;
48510 TYPE_THEN `a,S` EXISTS_TAC;
48511 TYPE_THEN `J` UNABBREV_TAC;
48512 REWRITE_TAC[graph_vertex_mk_graph;graph_edge_mk_graph;graph_inc_mk_graph];
48514 IMATCH_MP_TAC inj_bij;
48516 TYPE_THEN `x = pointI (a x)` SUBAGOAL_TAC;
48517 TYPE_THEN `y = pointI (a y)` SUBAGOAL_TAC;
48518 TYPE_THEN `a x` UNABBREV_TAC;
48519 TYPE_THEN `pointI (a y)` UNABBREV_TAC;
48522 IMATCH_MP_TAC inj_bij;
48524 TYPE_THEN `x = closure top2 (UNIONS (S x))` SUBAGOAL_TAC;
48527 TYPE_THEN `y = closure top2 (UNIONS (S y))` SUBAGOAL_TAC;
48529 TYPE_THEN `S x` UNABBREV_TAC;
48532 UND 13 THEN DISCH_THEN (THM_INTRO_TAC[`e`]);
48533 THM_INTRO_TAC[`H`;`e`] graph_inc_subset;
48535 USE 19 (REWRITE_RULE[SUBSET;INR in_pair]);
48536 TYPE_THEN `IMAGE a {(pointI a'), (pointI b)} = {a', b}` SUBAGOAL_TAC;
48537 REWRITE_TAC[IMAGE ;INR in_pair];
48538 IMATCH_MP_TAC EQ_EXT ;
48539 REWRITE_TAC[INR in_pair];
48541 IMATCH_MP_TAC EQ_ANTISYM;
48543 FIRST_ASSUM DISJ_CASES_TAC;
48545 ONCE_REWRITE_TAC[EQ_SYM_EQ];
48546 TSPEC `pointI b` 15;
48547 USE 15 (REWRITE_RULE[pointI_inj]);
48548 FIRST_ASSUM IMATCH_MP_TAC ;
48549 FIRST_ASSUM IMATCH_MP_TAC ;
48551 ONCE_REWRITE_TAC[EQ_SYM_EQ];
48552 TSPEC `pointI a'` 15;
48553 USE 15 (REWRITE_RULE[pointI_inj]);
48554 FIRST_ASSUM IMATCH_MP_TAC ;
48555 FIRST_ASSUM IMATCH_MP_TAC ;
48557 FIRST_ASSUM DISJ_CASES_TAC;
48558 TYPE_THEN `pointI b` EXISTS_TAC;
48559 TSPEC `pointI b` 15;
48560 USE 15 (REWRITE_RULE[pointI_inj]);
48561 FIRST_ASSUM IMATCH_MP_TAC ;
48562 FIRST_ASSUM IMATCH_MP_TAC ;
48563 TYPE_THEN `pointI a'` EXISTS_TAC;
48564 TSPEC `pointI a'` 15;
48565 USE 15 (REWRITE_RULE[pointI_inj]);
48566 FIRST_ASSUM IMATCH_MP_TAC ;
48567 FIRST_ASSUM IMATCH_MP_TAC ;
48568 FULL_REWRITE_TAC[segment_end];
48570 REWRITE_TAC[GSYM CONJ_ASSOC];
48572 THM_INTRO_TAC[`H`;`J`] graph_isomorphic_graph;
48574 TYPE_THEN `J` UNABBREV_TAC;
48575 REWRITE_TAC[SUBSET;graph_edge_mk_graph];
48576 USE 16 (REWRITE_RULE[IMAGE]);
48577 UND 13 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
48578 FULL_REWRITE_TAC[segment_end];
48581 TYPE_THEN `J` UNABBREV_TAC;
48582 REWRITE_TAC[graph_inc_mk_graph];
48585 TYPE_THEN `J` UNABBREV_TAC;
48586 FULL_REWRITE_TAC[graph_vertex_mk_graph;graph_edge_mk_graph;graph_inc_mk_graph];
48587 USE 22 (REWRITE_RULE[IMAGE]);
48588 USE 23 (REWRITE_RULE[IMAGE]);
48590 UND 13 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
48591 UND 25 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
48592 PROOF_BY_CONTR_TAC; (* repeat from - to here // *)
48593 USE 30 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
48594 TYPE_THEN `edge u` SUBAGOAL_TAC;
48595 FULL_REWRITE_TAC[segment_end;psegment;segment];
48596 ASM_MESON_TAC[subset_imp];
48597 TYPE_THEN `(UNIONS (S x) SUBSET closure top2 (UNIONS (S x)))` SUBAGOAL_TAC;
48598 IMATCH_MP_TAC subset_closure;
48599 REWRITE_TAC[top2_top];
48600 TYPE_THEN `(UNIONS (S x') SUBSET closure top2 (UNIONS (S x')))` SUBAGOAL_TAC;
48601 IMATCH_MP_TAC subset_closure;
48602 REWRITE_TAC[top2_top];
48603 TYPE_THEN `UNIONS (S x) SUBSET x` SUBAGOAL_TAC;
48605 TYPE_THEN `UNIONS (S x') SUBSET x'` SUBAGOAL_TAC;
48607 USE 36 (REWRITE_RULE[UNIONS;SUBSET]);
48608 USE 35 (REWRITE_RULE[UNIONS;SUBSET]);
48615 TYPE_THEN `u SUBSET x` SUBAGOAL_TAC;
48616 REWRITE_TAC[SUBSET];
48617 FIRST_ASSUM IMATCH_MP_TAC ;
48618 TYPE_THEN `u SUBSET x'` SUBAGOAL_TAC;
48619 REWRITE_TAC[SUBSET];
48620 FIRST_ASSUM IMATCH_MP_TAC ;
48621 FULL_REWRITE_TAC[good_plane_graph;plane_graph];
48622 UND 39 THEN DISCH_THEN (THM_INTRO_TAC[`x`;`x'`]);
48624 TYPE_THEN `x'` UNABBREV_TAC;
48625 TYPE_THEN `e'` UNABBREV_TAC;
48626 UND 21 THEN ASM_REWRITE_TAC[];
48627 USE 39 (REWRITE_RULE[INTER;SUBSET]);
48628 TYPE_THEN `~(u = EMPTY)` SUBAGOAL_TAC;
48629 TYPE_THEN `u` UNABBREV_TAC;
48630 USE 32 (MATCH_MP edge_cell);
48631 USE 32 (MATCH_MP cell_nonempty);
48632 UND 32 THEN (REWRITE_TAC[]);
48633 USE 44 (REWRITE_RULE[EMPTY_EXISTS]);
48635 TYPE_THEN `graph_vertex H u'` SUBAGOAL_TAC;
48636 FIRST_ASSUM IMATCH_MP_TAC ;
48637 ASM_MESON_TAC[subset_imp];
48638 UND 15 THEN DISCH_THEN (THM_INTRO_TAC[`u'`]);
48639 UND 15 THEN UND 44 THEN UND 32 THEN (POP_ASSUM_LIST (fun t-> ALL_TAC));
48640 FULL_REWRITE_TAC[edge];
48641 TYPE_THEN `c = a u'` ABBREV_TAC ;
48642 FIRST_ASSUM DISJ_CASES_TAC ;
48643 TYPE_THEN `u` UNABBREV_TAC;
48644 TYPE_THEN `u'` UNABBREV_TAC;
48645 FULL_REWRITE_TAC[cell_clauses];
48646 TYPE_THEN `u` UNABBREV_TAC;
48647 TYPE_THEN `u'` UNABBREV_TAC;
48648 FULL_REWRITE_TAC[cell_clauses];
48650 TYPE_THEN `graph_isomorphic J G` SUBAGOAL_TAC;
48651 THM_INTRO_TAC[`G`;`H`;`J`] graph_isomorphic_trans;
48652 IMATCH_MP_TAC graph_isomorphic_symm;
48653 IMATCH_MP_TAC planar_is_graph;
48655 TYPE_THEN `J` UNABBREV_TAC;
48656 FULL_REWRITE_TAC[graph_vertex_mk_graph;graph_edge_mk_graph;graph_inc_mk_graph];
48657 USE 23 (REWRITE_RULE[IMAGE]);
48658 USE 24 (REWRITE_RULE[IMAGE]);
48660 UND 13 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
48661 UND 27 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
48662 IMATCH_MP_TAC SUBSET_ANTISYM;
48663 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
48665 IMATCH_MP_TAC subset_inter_pair;
48666 CONJ_TAC THEN (IMATCH_MP_TAC endpoint_cls);
48667 FULL_REWRITE_TAC[segment_end;psegment;segment];
48668 FULL_REWRITE_TAC[segment_end;psegment;segment];
48670 TYPE_THEN `IMAGE pointI (cls(S x') INTER cls(S x)) SUBSET (IMAGE pointI (endpoint (S x') INTER endpoint (S x)))` BACK_TAC;
48671 THM_INTRO_TAC[`pointI`] image_inj;
48672 FIRST_ASSUM IMATCH_MP_TAC ;
48673 TYPE_THEN `UNIV:int#int ->bool` EXISTS_TAC;
48675 FULL_REWRITE_TAC[pointI_inj];
48677 TYPE_THEN `!A B. (IMAGE pointI (A INTER B) = IMAGE pointI A INTER IMAGE pointI B)` SUBAGOAL_TAC;
48678 IMATCH_MP_TAC inj_inter;
48679 TYPE_THEN `UNIV:int#int->bool` EXISTS_TAC;
48680 TYPE_THEN `UNIV:(num->real)->bool` EXISTS_TAC;
48682 FULL_REWRITE_TAC[pointI_inj];
48684 TYPE_THEN `IMAGE pointI (endpoint (S x')) = graph_inc H x'` SUBAGOAL_TAC;
48685 FULL_REWRITE_TAC[segment_end];
48686 REWRITE_TAC[IMAGE];
48687 IMATCH_MP_TAC EQ_EXT;
48688 REWRITE_TAC[INR in_pair];
48690 TYPE_THEN `IMAGE pointI (endpoint (S x)) = graph_inc H x` SUBAGOAL_TAC;
48691 FULL_REWRITE_TAC[segment_end];
48692 REWRITE_TAC[IMAGE];
48693 IMATCH_MP_TAC EQ_EXT;
48694 REWRITE_TAC[INR in_pair];
48699 TYPE_THEN `!e. graph_edge H e ==> (graph_inc H e = e INTER graph_vertex H)` SUBAGOAL_TAC;
48700 USE 10 (REWRITE_RULE[good_plane_graph;plane_graph]);
48701 TYPE_THEN `x' INTER x SUBSET graph_vertex H` SUBAGOAL_TAC;
48702 USE 10 (REWRITE_RULE[good_plane_graph;plane_graph]);
48703 FIRST_ASSUM IMATCH_MP_TAC ;
48704 UND 24 THEN UND 23 THEN UND 16 THEN MESON_TAC[];
48705 IMATCH_MP_TAC SUBSET_TRANS;
48706 TYPE_THEN `x' INTER x` EXISTS_TAC;
48707 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
48709 UND 36 THEN REWRITE_TAC[INTER;SUBSET;] THEN MESON_TAC[];
48711 IMATCH_MP_TAC subset_inter_pair;
48713 UND 31 THEN UND 13 THEN UND 29 THEN UND 27 THEN (POP_ASSUM_LIST (fun t-> ALL_TAC));
48714 FULL_REWRITE_TAC[segment_end];
48715 ASM_MESON_TAC[psegment_cls];
48716 (* Wed Dec 22 11:18:27 EST 2004 *)
48721 let cartesian_finite = prove_by_refinement(
48722 `!(A:A->bool) (B:B->bool). FINITE A /\ FINITE B ==>
48723 FINITE (cartesian A B)`,
48727 TYPE_THEN `cartesian A B = {(x,y) | (x IN A) /\ (y IN B)}` SUBAGOAL_TAC;
48728 IMATCH_MP_TAC EQ_EXT;
48729 REWRITE_TAC[cartesian];
48730 IMATCH_MP_TAC FINITE_PRODUCT;
48734 let three_t_finite = prove_by_refinement(
48735 `FINITE (UNIV:three_t ->bool)`,
48738 THM_INTRO_TAC[`ABS3 0`] three_delete_size;
48739 FULL_REWRITE_TAC[HAS_SIZE];
48740 FULL_REWRITE_TAC[FINITE_DELETE];
48744 let three_t_size3 = prove_by_refinement(
48745 `(UNIV:three_t ->bool) HAS_SIZE 3`,
48748 THM_INTRO_TAC[`ABS3 0`] three_delete_size;
48749 FULL_REWRITE_TAC[HAS_SIZE];
48750 FULL_REWRITE_TAC[FINITE_DELETE];
48751 THM_INTRO_TAC[`ABS3 0`;`UNIV:three_t->bool`;] CARD_SUC_DELETE;
48759 let k33_nonplanar = prove_by_refinement(
48760 `~(planar_graph k33_graph)`,
48764 THM_INTRO_TAC[`k33_graph`] planar_graph_rectagonal;
48765 REWRITE_TAC[k33_graph_edge;k33_graph_inc;k33_graph_vertex];
48766 ASSUME_TAC three_t_finite;
48767 ASSUME_TAC bool_size;
48768 FULL_REWRITE_TAC[HAS_SIZE];
48770 IMATCH_MP_TAC cartesian_finite;
48772 IMATCH_MP_TAC cartesian_finite;
48774 REWRITE_TAC[EMPTY_EXISTS];
48776 TYPE_THEN `(ABS3 0,ABS3 0)` EXISTS_TAC;
48777 REWRITE_TAC[cartesian;PAIR_SPLIT];
48779 REWRITE_TAC[graph_edge_around];
48780 REWRITE_TAC[k33_graph_edge;k33_graph_inc;k33_graph_vertex;cartesian_univ];
48781 TYPE_THEN `E = {e | (v = FST e,T) \/ (v = SND e,F)}` ABBREV_TAC ;
48782 TYPE_THEN `SND v ==> (E = IMAGE (\ f. (FST v, f)) UNIV)` SUBAGOAL_TAC;
48783 TYPE_THEN `E` UNABBREV_TAC;
48784 IMATCH_MP_TAC EQ_EXT;
48785 REWRITE_TAC[IMAGE];
48786 REWRITE_TAC[PAIR_SPLIT];
48788 TYPE_THEN `~(SND v) ==> (E = IMAGE (\ f. (f,FST v)) UNIV)` SUBAGOAL_TAC;
48789 TYPE_THEN `E` UNABBREV_TAC;
48790 IMATCH_MP_TAC EQ_EXT;
48791 REWRITE_TAC[IMAGE];
48792 REWRITE_TAC[PAIR_SPLIT];
48795 TYPE_THEN `CARD E <=| CARD (UNIV:three_t ->bool)` SUBAGOAL_TAC;
48796 TYPE_THEN `SND v` ASM_CASES_TAC;
48797 IMATCH_MP_TAC CARD_IMAGE_LE;
48798 IMATCH_MP_TAC CARD_IMAGE_LE;
48799 ASSUME_TAC three_t_size3;
48800 FULL_REWRITE_TAC[HAS_SIZE];
48801 UND 8 THEN UND 7 THEN ARITH_TAC;
48803 ASSUME_TAC rectagon_graph_k33_false;
48804 UND 2 THEN ASM_REWRITE_TAC[];
48805 (* Wed Dec 22 11:57:49 EST 2004 *)
48810 (* ------------------------------------------------------------------ *)
48812 (* ------------------------------------------------------------------ *)
48814 (* show the complement of a simple arc is connected *)
48817 let grid33 = jordan_def `grid33 m =
48818 rectangle_grid (FST m -: &:1, SND m -: &:1)
48819 (FST m +: &:2, SND m +: &:2)`;;
48821 let grid = jordan_def `grid f N =
48823 ( \ i. grid33 (floor (f (&i / &N) 0), floor (f (&i / &N) 1)))
48826 let grid33_conn2 = prove_by_refinement(
48827 `!m. conn2 (grid33 m)`,
48831 REWRITE_TAC[grid33];
48832 TYPE_THEN `SUC 2 = 3` SUBAGOAL_TAC;
48834 TYPE_THEN `a = FST m -: &:1` ABBREV_TAC ;
48835 TYPE_THEN `FST m +: &:2 = a +: &:(SUC 2)` SUBAGOAL_TAC;
48836 TYPE_THEN `a` UNABBREV_TAC;
48838 TYPE_THEN `b = SND m -: &:1` ABBREV_TAC ;
48839 TYPE_THEN `SND m +: &:2 = b +: &:(SUC 2)` SUBAGOAL_TAC;
48840 TYPE_THEN `b` UNABBREV_TAC;
48843 THM_INTRO_TAC[`2`;`2`;`(a,b)`] rectangle_grid_conn2;
48844 FULL_REWRITE_TAC[];
48849 let grid_finite = prove_by_refinement(
48850 `!f N. FINITE (grid f N)`,
48853 REWRITE_TAC[ grid];
48854 TYPE_THEN `FINITE (IMAGE (\i. grid33 (floor (f (&i / &N) 0),floor (f (&i / &N) 1))) {j | j <=| N}) ` SUBAGOAL_TAC;
48855 IMATCH_MP_TAC FINITE_IMAGE;
48856 REWRITE_TAC[FINITE_NUMSEG_LE];
48857 ASM_SIMP_TAC[FINITE_FINITE_UNIONS];
48858 USE 1 (REWRITE_RULE[IMAGE]);
48859 THM_INTRO_TAC[`floor (f (&x / &N) 0),floor (f (&x / &N) 1)`] grid33_conn2;
48860 FULL_REWRITE_TAC[conn2];
48864 let grid33_edge = prove_by_refinement(
48865 `!m. grid33 m SUBSET edge `,
48868 REWRITE_TAC[grid33;rectangle_grid_edge];
48872 let grid_edge = prove_by_refinement(
48873 `!f N . grid f N SUBSET edge `,
48877 REWRITE_TAC[grid;UNIONS;SUBSET;IMAGE ];
48878 TYPE_THEN `u` UNABBREV_TAC;
48879 ASM_MESON_TAC[grid33_edge;subset_imp];
48884 let floor_add_num = prove_by_refinement(
48885 `!x m. floor (x + &m) = floor x +: &:m`,
48888 REWRITE_TAC [floor_range;int_add_th;int_of_num_th;];
48889 THM_INTRO_TAC[`x`;`floor x`] floor_range;
48891 UND 0 THEN UND 1 THEN REAL_ARITH_TAC;
48895 let floor_abs = prove_by_refinement(
48896 `!x y m. (abs (x -. y) <= &m) ==> (||: (floor x -: floor y) <=: &:m)`,
48899 TYPE_THEN `!x y m. (y <. x) /\ (x - y <= &m) ==> (floor x -: floor y <=: &:m)` SUBAGOAL_TAC;
48900 THM_INTRO_TAC[`x`;`y + &m`] floor_mono;
48901 UND 0 THEN REAL_ARITH_TAC;
48902 FULL_REWRITE_TAC[floor_add_num];
48903 UND 2 THEN INT_ARITH_TAC ;
48904 TYPE_THEN `y = x` ASM_CASES_TAC;
48905 TYPE_THEN `y` UNABBREV_TAC;
48906 FULL_REWRITE_TAC[REAL_ARITH `x -. x = &0`;ABS_0;INT_SUB_REFL;INT_ABS_0;int_le ; int_of_num_th];
48908 TYPE_THEN `y <= x` ASM_CASES_TAC;
48909 TYPE_THEN `abs (x - y) = (x - y)` SUBAGOAL_TAC;
48910 REWRITE_TAC[REAL_ABS_REFL];
48911 UND 3 THEN REAL_ARITH_TAC;
48913 TYPE_THEN `floor y <=: floor x` SUBAGOAL_TAC;
48914 IMATCH_MP_TAC floor_mono;
48915 TYPE_THEN `||: (floor x -: floor y) = (floor x -: floor y)` SUBAGOAL_TAC;
48916 REWRITE_TAC[INT_ABS_REFL];
48917 UND 5 THEN INT_ARITH_TAC;
48918 FIRST_ASSUM IMATCH_MP_TAC ;
48919 UND 2 THEN UND 3 THEN REAL_ARITH_TAC;
48920 TYPE_THEN `x < y` SUBAGOAL_TAC;
48921 UND 2 THEN UND 3 THEN REAL_ARITH_TAC;
48923 TYPE_THEN `abs (x - y) = (y - x)` SUBAGOAL_TAC;
48924 UND 4 THEN REAL_ARITH_TAC;
48926 TYPE_THEN `floor x <=: floor y` SUBAGOAL_TAC;
48927 IMATCH_MP_TAC floor_mono;
48928 UND 4 THEN REAL_ARITH_TAC;
48929 TYPE_THEN `||: (floor x -: floor y) = (floor y -: floor x)` SUBAGOAL_TAC;
48930 UND 6 THEN INT_ARITH_TAC;
48931 FIRST_ASSUM IMATCH_MP_TAC ;
48935 let d_euclid_floor = prove_by_refinement(
48936 `!x y i n. (euclid n x) /\ (euclid n y) /\ (d_euclid x y < &1) ==>
48937 (||: (floor (x i) -: floor (y i)) <=: &:1)`,
48941 IMATCH_MP_TAC floor_abs;
48942 THM_INTRO_TAC[`n`;`x`;`y`;`i`] proj_contraction;
48943 UND 3 THEN UND 0 THEN REAL_ARITH_TAC;
48947 extend_simp_rewrites[prove_by_refinement(
48948 `!x . x/ &0 = &0 `,
48951 REWRITE_TAC[REAL_INV_0;real_div;REAL_MUL_RZERO];
48955 extend_simp_rewrites[INR in_pair ; INR IN_SING];;
48957 extend_simp_rewrites[REAL_POS];;
48959 let real_eq_div = prove_by_refinement(
48960 `!x y z. ~(z = &0) ==> ((x / z = y) <=> (x = y * z))`,
48964 TYPE_THEN `&0 < z` ASM_CASES_TAC;
48965 ASM_SIMP_TAC[REAL_EQ_LDIV_EQ];
48966 TYPE_THEN `&0 < -- z` SUBAGOAL_TAC;
48967 UND 0 THEN UND 1 THEN REAL_ARITH_TAC;
48968 TYPE_THEN `x / z = (--x)/(--z)` SUBAGOAL_TAC;
48969 REWRITE_TAC[real_div;REAL_INV_NEG;REAL_NEG_MUL2];
48970 ASM_SIMP_TAC[REAL_EQ_LDIV_EQ];
48975 let grid_conn2_induct_lemma = prove_by_refinement(
48977 (k <= N) /\ (IMAGE f {x | &0 <= x /\ x <= &1} SUBSET (euclid 2)) /\
48978 (!i. (i < N) ==> d_euclid (f (&i / &N)) (f (&(SUC i) / &N)) < &1) ==>
48979 conn2 (UNIONS (IMAGE
48980 ( \ i. grid33 (floor (f (&i / &N) 0), floor (f (&i / &N) 1)))
48986 TYPE_THEN `{j | j <=| 0} = {0}` SUBAGOAL_TAC;
48987 IMATCH_MP_TAC EQ_EXT;
48988 REWRITE_TAC[INR IN_SING];
48990 REWRITE_TAC[IMAGE;INR IN_SING ];
48991 TYPE_THEN `{y | ?x. (x = 0) /\ (y = grid33 (floor (f (&x / &N) 0),floor (f (&x / &N) 1)))} = {(grid33 (floor (f (&0 / &N) 0), floor (f (&0 / &N) 1)))}` SUBAGOAL_TAC;
48992 IMATCH_MP_TAC EQ_EXT;
48994 REWRITE_TAC[INR IN_SING];
48995 CONV_TAC (dropq_conv "x'");
48996 REWRITE_TAC[grid33_conn2];
48998 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`f`;`N`]);
48999 UND 2 THEN ARITH_TAC;
49000 TYPE_THEN `{j | j <=| SUC k} = {j | j <=| k} UNION {(SUC k)}` SUBAGOAL_TAC;
49001 IMATCH_MP_TAC EQ_EXT;
49002 REWRITE_TAC[UNION;];
49004 REWRITE_TAC[IMAGE_UNION;UNIONS_UNION;image_sing;UNIONS_1];
49005 IMATCH_MP_TAC conn2_union_edge;
49006 ASM_REWRITE_TAC[grid33_conn2];
49009 REWRITE_TAC[grid;UNIONS;SUBSET;IMAGE ];
49010 TYPE_THEN `u` UNABBREV_TAC;
49011 ASM_MESON_TAC[grid33_edge;subset_imp];
49012 REWRITE_TAC[EMPTY_EXISTS];
49013 REWRITE_TAC[grid33_edge];
49014 TYPE_THEN `{j | j <=| k} = {j | j <| k} UNION {k}` SUBAGOAL_TAC;
49015 IMATCH_MP_TAC EQ_EXT;
49016 REWRITE_TAC[UNION;INR IN_SING];
49018 REWRITE_TAC[IMAGE_UNION;UNIONS_UNION;image_sing;UNIONS_1];
49019 ONCE_REWRITE_TAC[INTER_COMM];
49020 REWRITE_TAC[UNION_OVER_INTER];
49021 REWRITE_TAC[UNION];
49024 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`k`]);
49025 UND 2 THEN ARITH_TAC;
49027 TYPE_THEN `a = floor (f (&k / &N) 0)` ABBREV_TAC ;
49028 TYPE_THEN `b = floor (f (&k / &N) 1)` ABBREV_TAC ;
49029 TYPE_THEN `a' = floor (f (&(SUC k) / &N) 0)` ABBREV_TAC ;
49030 TYPE_THEN `b' = floor (f (&(SUC k) / &N) 1)` ABBREV_TAC ;
49031 TYPE_THEN `h_edge (a,b)` EXISTS_TAC;
49032 REWRITE_TAC[INTER];
49033 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
49035 REWRITE_TAC[grid33];
49036 REWRITE_TAC[rectangle_grid_h];
49039 TYPE_THEN `!k. (k <=| N) ==> euclid 2 (f (&k / &N))` SUBAGOAL_TAC;
49040 USE 1(REWRITE_RULE[SUBSET]);
49041 FIRST_ASSUM IMATCH_MP_TAC ;
49042 IMATCH_MP_TAC image_imp;
49044 IMATCH_MP_TAC REAL_LE_DIV;
49045 TYPE_THEN `&N = &0` ASM_CASES_TAC;
49048 TYPE_THEN `&0 < &N` SUBAGOAL_TAC;
49049 UND 11 THEN REWRITE_TAC[REAL_OF_NUM_EQ;REAL_LT] THEN ARITH_TAC;
49050 ASM_SIMP_TAC[REAL_LE_LDIV_EQ];
49051 UND 10 THEN REWRITE_TAC[REAL_LE;REAL_OF_NUM_MUL] THEN ARITH_TAC ;
49053 TYPE_THEN `euclid 2 (f (&k/ &N))` SUBAGOAL_TAC;
49054 FIRST_ASSUM IMATCH_MP_TAC ;
49055 UND 2 THEN ARITH_TAC;
49056 TYPE_THEN `euclid 2 (f (&(SUC k)/ &N))` SUBAGOAL_TAC;
49058 THM_INTRO_TAC[`f(&k/ &N)`;`f(&(SUC k)/ &N)`;`0`;`2`] d_euclid_floor;
49059 THM_INTRO_TAC[`f(&k/ &N)`;`f(&(SUC k)/ &N)`;`1`;`2`] d_euclid_floor;
49060 TYPE_THEN `||: (a - a') <=: &:1` SUBAGOAL_TAC;
49062 TYPE_THEN `||: (b - b') <=: &:1` SUBAGOAL_TAC;
49064 KILL 14 THEN KILL 13;
49065 KILL 5 THEN KILL 4;
49066 KILL 3 THEN KILL 1;
49067 REWRITE_TAC[grid33];
49068 REWRITE_TAC[rectangle_grid_h];
49069 UND 16 THEN UND 15 THEN INT_ARITH_TAC;
49070 (* Thu Dec 23 10:46:15 EST 2004 *)
49076 let grid_conn2 = prove_by_refinement(
49077 `!f N. (IMAGE f {x | &0 <= x /\ x <= &1} SUBSET (euclid 2)) /\
49078 (!i. (i < N) ==> d_euclid (f (&i / &N)) (f (&(SUC i) / &N)) < &1) ==>
49083 THM_INTRO_TAC[`N`;`f`;`N`] grid_conn2_induct_lemma;
49089 let simple_arc_uniformly_continuous = prove_by_refinement(
49090 `!f . continuous f (top_of_metric(UNIV,d_real)) top2 /\
49091 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) ==>
49092 uniformly_continuous f
49093 ({x | &0 <= x /\ x <= &1},d_real)
49094 (euclid 2,d_euclid)`,
49098 ASSUME_TAC metric_real;
49099 IMATCH_MP_TAC compact_uniformly_continuous;
49100 THM_INTRO_TAC[`&0`;`&1`] interval_compact;
49101 THM_INTRO_TAC[`UNIV:real->bool`;`{x | &0 <= x /\ x <= &1}`;`d_real`] compact_subset;
49102 REWRITE_TAC[metric_real];
49107 TYPE_THEN `IMAGE f {x | &0 <= x /\ x <= &1} SUBSET euclid 2` SUBAGOAL_TAC;
49108 IMATCH_MP_TAC inj_image_subset;
49109 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
49112 IMATCH_MP_TAC metric_subspace;
49113 TYPE_THEN `UNIV:real->bool` EXISTS_TAC ;
49116 THM_INTRO_TAC[`f`;`top_of_metric(UNIV,d_real)`;`top2`;`{x | &0 <= x /\ x <= &1}`] continuous_induced_domain;
49117 ASM_SIMP_TAC[metric_real;GSYM top_of_metric_unions];
49119 THM_INTRO_TAC[`UNIV:real->bool`;`{x | &0 <= x /\ x <= &1}`;`d_real`] top_of_metric_induced;
49120 REWRITE_TAC[metric_real];
49122 THM_INTRO_TAC[`f`;`{x | &0 <= x /\ x <= &1}`;`euclid 2`;`d_real`;`d_euclid`] metric_continuous_continuous;
49124 FULL_REWRITE_TAC[top2];
49125 (* Thu Dec 23 11:29:49 EST 2004 *)
49129 let num_abs_of_int_mono = prove_by_refinement(
49130 `!a b. &:0 <= a /\ a <= b ==> num_abs_of_int a <= num_abs_of_int b`,
49133 REWRITE_TAC[GSYM REAL_LE;num_abs_of_int_th;GSYM int_abs_th;GSYM int_le ];
49134 UND 0 THEN UND 1 THEN INT_ARITH_TAC;
49138 let floor_num = prove_by_refinement(
49139 `!n. floor (&n) = &:n`,
49142 REWRITE_TAC[floor_range];
49143 REWRITE_TAC[int_of_num_th;];
49148 let floor_neg_num = prove_by_refinement(
49149 `!n. floor (-- &n) = -- (&:n)`,
49152 REWRITE_TAC[floor_range];
49153 REWRITE_TAC[int_neg_th;int_of_num_th;];
49158 let delta_partition_lemma = prove_by_refinement(
49159 `!delta. (&0 < delta) ==> (?N. !x. ?i. (0 < N) /\
49160 ((&0 <= x /\ x <= &1) ==> (i <= N) /\ abs (&i/ &N - x) < delta))`,
49164 THM_INTRO_TAC[ `&1/ delta` ] REAL_ARCH_SIMPLE;
49165 TYPE_THEN `n` EXISTS_TAC;
49166 TYPE_THEN `num_abs_of_int (floor (&n*x))` EXISTS_TAC;
49167 TYPE_THEN `&0 < &1/ delta` SUBAGOAL_TAC;
49168 TYPE_THEN `&0 < &n` SUBAGOAL_TAC;
49169 UND 1 THEN UND 2 THEN REAL_ARITH_TAC;
49170 TYPE_THEN `(&1 <= &n* delta)` SUBAGOAL_TAC;
49171 ASM_MESON_TAC[REAL_LE_LDIV_EQ];
49173 FULL_REWRITE_TAC[REAL_LT];
49174 TYPE_THEN `&:0 <= floor (&n * x)` SUBAGOAL_TAC;
49175 TYPE_THEN `floor (&0) <=: floor (&n * x)` BACK_TAC;
49176 FULL_REWRITE_TAC[floor_num];
49177 IMATCH_MP_TAC floor_mono;
49178 IMATCH_MP_TAC REAL_LE_MUL;
49181 TYPE_THEN `num_abs_of_int (floor (&n * x)) <= num_abs_of_int (floor (&n))` BACK_TAC;
49182 FULL_REWRITE_TAC[floor_num;num_abs_of_int_num];
49183 IMATCH_MP_TAC num_abs_of_int_mono;
49184 IMATCH_MP_TAC floor_mono;
49185 TYPE_THEN `&n * x <= &n * &1` BACK_TAC;
49186 UND 8 THEN REAL_ARITH_TAC;
49187 IMATCH_MP_TAC REAL_PROP_LE_LMUL;
49189 IMATCH_MP_TAC REAL_LT_LCANCEL_IMP;
49190 TYPE_THEN `&n` EXISTS_TAC;
49191 IMATCH_MP_TAC REAL_LTE_TRANS;
49192 TYPE_THEN`&1` EXISTS_TAC;
49194 REWRITE_TAC[num_abs_of_int_th;];
49195 TYPE_THEN `abs (real_of_int (floor (&n * x))) = (real_of_int (floor (&n *x)))` SUBAGOAL_TAC;
49196 REWRITE_TAC[REAL_ABS_REFL];
49197 FULL_REWRITE_TAC [int_le; int_of_num_th;];
49198 TYPE_THEN `!u. &n * abs (u / &n - x) = abs (u - &n*x)` SUBAGOAL_TAC;
49199 TYPE_THEN `!t. &n * abs t = abs (&n *t)` SUBAGOAL_TAC;
49200 REWRITE_TAC[REAL_ABS_MUL;REAL_ABS_NUM];
49202 REWRITE_TAC[REAL_SUB_LDISTRIB];
49203 TYPE_THEN `&n * u/ &n = u` SUBAGOAL_TAC;
49204 IMATCH_MP_TAC REAL_DIV_LMUL;
49205 UND 10 THEN UND 3 THEN REAL_ARITH_TAC;
49206 TYPE_THEN `t = &n * x ` ABBREV_TAC ;
49207 TYPE_THEN `real_of_int(floor t) <= t` SUBAGOAL_TAC;
49208 REWRITE_TAC[floor_ineq];
49209 TYPE_THEN `abs (real_of_int (floor t) - t) = t - real_of_int (floor t)` SUBAGOAL_TAC;
49210 UND 11 THEN REAL_ARITH_TAC;
49211 THM_INTRO_TAC[`t`] floor_ineq;
49212 UND 13 THEN REAL_ARITH_TAC;
49216 let simple_arc_ball_cover = prove_by_refinement(
49217 `!f. continuous f (top_of_metric(UNIV,d_real)) top2 /\
49218 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) ==>
49219 (?N. !x. ?i. (0 < N) /\ (&0 <= x /\ x <= &1 ==>
49221 open_ball (euclid 2,d_euclid) (f (&i / &N)) (&1) (f x)))`,
49225 THM_INTRO_TAC[`f`] simple_arc_uniformly_continuous;
49226 FULL_REWRITE_TAC[uniformly_continuous];
49228 UND 2 THEN DISCH_THEN (THM_INTRO_TAC[]);
49229 REWRITE_TAC[open_ball];
49230 THM_INTRO_TAC[`delta`] delta_partition_lemma;
49231 TYPE_THEN `N` EXISTS_TAC;
49233 TYPE_THEN `i` EXISTS_TAC;
49235 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[]);
49237 TYPE_THEN `&0 <= &i/ &N /\ &i/ &N <= &1` SUBAGOAL_TAC;
49239 IMATCH_MP_TAC REAL_LE_DIV;
49240 THM_INTRO_TAC[`&i`;`&1`;`&N`] REAL_LE_LDIV_EQ;
49241 REWRITE_TAC[REAL_LT];
49242 REWRITE_TAC[REAL_MUL;REAL_LE];
49243 UND 8 THEN ARITH_TAC;
49245 FULL_REWRITE_TAC[INJ];
49247 FIRST_ASSUM IMATCH_MP_TAC ;
49250 FIRST_ASSUM IMATCH_MP_TAC ;
49252 FIRST_ASSUM IMATCH_MP_TAC ;
49253 REWRITE_TAC[d_real];
49257 let unbounded_diff = prove_by_refinement(
49258 `!G. unbounded_set G = UNIONS(ctop G) DIFF (bounded_set G)`,
49261 REWRITE_TAC[GSYM bounded_unbounded_union];
49262 IMATCH_MP_TAC EQ_EXT;
49263 THM_INTRO_TAC[`G`] bounded_unbounded_disj;
49264 UND 0 THEN REWRITE_TAC[EQ_EMPTY;UNION ;INTER;DIFF] THEN MESON_TAC[];
49268 let bounded_diff = prove_by_refinement(
49269 `!G. bounded_set G = UNIONS(ctop G) DIFF (unbounded_set G)`,
49272 REWRITE_TAC[GSYM bounded_unbounded_union];
49273 IMATCH_MP_TAC EQ_EXT;
49274 THM_INTRO_TAC[`G`] bounded_unbounded_disj;
49275 UND 0 THEN REWRITE_TAC[EQ_EMPTY;UNION ;INTER;DIFF] THEN MESON_TAC[];
49279 let rectangle_grid_subset = prove_by_refinement(
49280 `!p q r s. (FST p <=: FST r) /\ (SND p <= SND r) /\
49281 (FST s <= FST q) /\ (SND s <= SND q) ==>
49282 rectangle_grid r s SUBSET rectangle_grid p q`,
49285 REWRITE_TAC[SUBSET;rectangle_grid];
49286 FIRST_ASSUM DISJ_CASES_TAC THEN REP_BASIC_TAC THEN ASM_REWRITE_TAC[cell_clauses] THEN CONV_TAC (dropq_conv "m'");
49287 UND 5 THEN UND 6 THEN UND 7 THEN UND 8 THEN UND 1 THEN UND 2 THEN UND 3 THEN UND 4 THEN INT_ARITH_TAC;
49288 UND 5 THEN UND 6 THEN UND 7 THEN UND 8 THEN UND 1 THEN UND 2 THEN UND 3 THEN UND 4 THEN INT_ARITH_TAC;
49292 let grid_image_bounded = prove_by_refinement(
49293 `!f. continuous f (top_of_metric(UNIV,d_real)) top2 /\
49294 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) ==>
49295 (?N. (0 < N) /\ ((IMAGE f {x | &0 <= x /\ x <= &1}) INTER
49296 (unbounded_set (grid f N)) = EMPTY)) `,
49299 REWRITE_TAC[EQ_EMPTY;INTER;];
49300 THM_INTRO_TAC[`f`] simple_arc_ball_cover;
49301 TYPE_THEN `N` EXISTS_TAC;
49302 REWRITE_TAC[IMAGE];
49306 TYPE_THEN `x''` UNABBREV_TAC;
49307 FULL_REWRITE_TAC[unbounded_diff;DIFF;ctop_unions ];
49308 UND 2 THEN REWRITE_TAC[];
49309 UND 6 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
49311 FULL_REWRITE_TAC[open_ball];
49313 IMATCH_MP_TAC bounded_avoidance_subset;
49314 TYPE_THEN `E = grid33 (floor (f (&i/ &N) 0),floor (f (&i / &N) 1))` ABBREV_TAC ;
49315 TYPE_THEN `E` EXISTS_TAC;
49317 TYPE_THEN `conn2 E` SUBAGOAL_TAC;
49318 TYPE_THEN `E` UNABBREV_TAC;
49319 REWRITE_TAC[grid33_conn2];
49320 REWRITE_TAC[grid_edge;grid_finite];
49321 TYPE_THEN `E SUBSET grid f N` SUBAGOAL_TAC;
49323 TYPE_THEN `E` UNABBREV_TAC;
49324 TYPE_THEN `{j | j <=| N} = {i} UNION {j | j <=| N /\ ~(j = i)}` SUBAGOAL_TAC;
49325 IMATCH_MP_TAC EQ_EXT;
49326 REWRITE_TAC[UNION];
49327 UND 6 THEN ARITH_TAC;
49328 REWRITE_TAC[IMAGE_UNION;UNIONS_UNION];
49329 REWRITE_TAC[SUBSET;UNION];
49331 REWRITE_TAC[image_sing];
49333 TYPE_THEN `~UNIONS (curve_cell E) (f x')` SUBAGOAL_TAC;
49334 UND 3 THEN REWRITE_TAC[];
49335 THM_INTRO_TAC[`E`;`grid f N`] curve_cell_imp_subset;
49336 USE 3 (MATCH_MP UNIONS_UNIONS);
49337 ASM_MESON_TAC[subset_imp];
49341 TYPE_THEN `E' = rectangle_grid (floor (f x' 0),floor (f x' 1)) (floor (f x' 0) +: &:1,floor (f x' 1) +: &:1)` ABBREV_TAC ;
49342 THM_INTRO_TAC[`(floor (f x' 0),floor (f x' 1))`] rectagon_rectangle_grid_sq;
49343 FULL_REWRITE_TAC [];
49345 TYPE_THEN `E' SUBSET E` SUBAGOAL_TAC;
49346 TYPE_THEN `E` UNABBREV_TAC;
49347 TYPE_THEN `E'` UNABBREV_TAC;
49348 REWRITE_TAC[grid33];
49349 IMATCH_MP_TAC rectangle_grid_subset;
49351 THM_INTRO_TAC[`f (&i/ &N)`;`f x'`;`0`;`2`] d_euclid_floor;
49352 THM_INTRO_TAC[`f (&i/ &N)`;`f x'`;`1`;`2`] d_euclid_floor;
49353 UND 3 THEN UND 11 THEN INT_ARITH_TAC;
49355 IMATCH_MP_TAC bounded_avoidance_subset;
49356 TYPE_THEN `E'` EXISTS_TAC;
49357 TYPE_THEN `conn2 E'` SUBAGOAL_TAC;
49358 IMATCH_MP_TAC conn2_rectagon;
49359 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
49360 FULL_REWRITE_TAC[conn2];
49362 TYPE_THEN `E SUBSET edge` SUBAGOAL_TAC;
49363 TYPE_THEN `E` UNABBREV_TAC;
49364 REWRITE_TAC[grid33_edge];
49366 ASM_SIMP_TAC[GSYM odd_bounded];
49367 REWRITE_TAC[UNIONS];
49368 TYPE_THEN ` squ (floor (f x' 0),floor (f x' 1))` EXISTS_TAC;
49369 IMATCH_MP_TAC (TAUT ` a/\ b ==> b /\ a`);
49371 TYPE_THEN `~UNIONS (curve_cell E') (f x')` SUBAGOAL_TAC;
49372 UND 14 THEN REWRITE_TAC[];
49373 THM_INTRO_TAC[`E'`;`E`] curve_cell_imp_subset;
49374 USE 14 (MATCH_MP UNIONS_UNIONS);
49375 ASM_MESON_TAC[subset_imp];
49377 TYPE_THEN `m = (floor (f x' 0),floor (f x' 1))` ABBREV_TAC ;
49378 TYPE_THEN `~(h_edge m (f x'))` SUBAGOAL_TAC;
49379 UND 19 THEN REWRITE_TAC[];
49380 REWRITE_TAC[UNIONS];
49381 TYPE_THEN `h_edge m` EXISTS_TAC;
49382 REWRITE_TAC[curve_cell_h_ver2];
49383 USE 20 (REWRITE_RULE[PAIR_SPLIT]);
49385 FULL_REWRITE_TAC[rectangle_grid_sq];
49386 TYPE_THEN `E'` UNABBREV_TAC;
49387 REWRITE_TAC[INSERT];
49389 TYPE_THEN `~(v_edge m (f x'))` SUBAGOAL_TAC;
49390 UND 19 THEN REWRITE_TAC[];
49391 REWRITE_TAC[UNIONS];
49392 TYPE_THEN `v_edge m` EXISTS_TAC;
49393 REWRITE_TAC[curve_cell_v_ver2];
49394 USE 20 (REWRITE_RULE[PAIR_SPLIT]);
49396 FULL_REWRITE_TAC[rectangle_grid_sq];
49397 TYPE_THEN `E'` UNABBREV_TAC;
49398 REWRITE_TAC[INSERT];
49400 TYPE_THEN `~(f x' = pointI m)` SUBAGOAL_TAC;
49401 UND 19 THEN REWRITE_TAC[];
49402 REWRITE_TAC[UNIONS];
49403 TYPE_THEN `{(pointI m)}` EXISTS_TAC;
49404 ASM_SIMP_TAC[rectagon_segment;curve_cell_cls];
49405 USE 20 (REWRITE_RULE[PAIR_SPLIT]);
49407 FULL_REWRITE_TAC[rectangle_grid_sq];
49408 TYPE_THEN `{(h_edge m)} SUBSET E'` SUBAGOAL_TAC;
49409 TYPE_THEN `E'` UNABBREV_TAC;
49410 REWRITE_TAC[SUBSET;INSERT];
49411 USE 24 (MATCH_MP cls_subset);
49412 USE 24 (REWRITE_RULE[SUBSET]);
49413 FIRST_ASSUM IMATCH_MP_TAC ;
49414 REWRITE_TAC[cls_h];
49416 USE 9 (MATCH_MP point_onto);
49417 THM_INTRO_TAC[`p`] square_domain;
49418 UND 24 THEN LET_TAC;
49419 TYPE_THEN `(floor (FST p),floor (SND p)) = m` SUBAGOAL_TAC;
49420 TYPE_THEN `m` UNABBREV_TAC;
49421 REWRITE_TAC[PAIR_SPLIT];
49423 TYPE_THEN `point p` UNABBREV_TAC;
49424 USE 24 (REWRITE_RULE[UNION;INR IN_SING;]);
49427 ASM_SIMP_TAC[rectagon_segment;par_cell_squ];
49428 FULL_REWRITE_TAC[num_lower];
49429 USE 20 (REWRITE_RULE[PAIR_SPLIT]);
49431 FULL_REWRITE_TAC[rectangle_grid_sq];
49432 TYPE_THEN `!m'. E' (h_edge m') <=> (m' = up m) \/ (m' = m)` SUBAGOAL_TAC;
49433 TYPE_THEN `E'` UNABBREV_TAC;
49434 REWRITE_TAC[INSERT;cell_clauses];
49437 TYPE_THEN `{m' | ((m' = up m) \/ (m' = m)) /\ (FST m' = FST m) /\ SND m' <=: SND m} = {m}` SUBAGOAL_TAC;
49438 IMATCH_MP_TAC EQ_EXT;
49439 REWRITE_TAC[up;PAIR_SPLIT];
49442 FULL_REWRITE_TAC[card_sing;EVEN2];
49443 (* Thu Dec 23 20:25:33 EST 2004 *)
49448 let conn2_sequence_lemma1 = prove_by_refinement(
49449 `!k G N . (k <= N) /\ (!i. (i <= N) ==> (conn2 (G i))) /\
49450 (!i. (i <= N) ==> (G i SUBSET edge )) /\
49451 (!i. (SUC i <= N) ==> ~(G i INTER G (SUC i) = EMPTY)) ==>
49452 conn2 (UNIONS (IMAGE G ({i | i <=| k})))`,
49456 TYPE_THEN `{i | i <=| 0} = {0}` SUBAGOAL_TAC;
49457 IMATCH_MP_TAC EQ_EXT ;
49459 REWRITE_TAC[image_sing];
49461 UND 4 THEN DISCH_THEN (THM_INTRO_TAC[`G`;`N`]);
49462 UND 3 THEN ARITH_TAC;
49463 TYPE_THEN `{i | i <=| SUC k} = {i | i <= k} UNION {(SUC k)}` SUBAGOAL_TAC;
49464 IMATCH_MP_TAC EQ_EXT;
49465 REWRITE_TAC[UNION];
49467 REWRITE_TAC[image_sing;IMAGE_UNION;UNIONS_UNION];
49468 IMATCH_MP_TAC conn2_union_edge;
49469 REWRITE_TAC[EMPTY_EXISTS];
49471 REWRITE_TAC[UNIONS;IMAGE;SUBSET];
49472 FULL_REWRITE_TAC[SUBSET];
49473 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
49474 UND 8 THEN UND 3 THEN ARITH_TAC;
49475 FIRST_ASSUM IMATCH_MP_TAC ;
49476 TYPE_THEN `u` UNABBREV_TAC;
49477 REWRITE_TAC[INTER];
49478 TYPE_THEN`{i | i <=| k} = {i | i <| k} UNION {k}` SUBAGOAL_TAC;
49479 IMATCH_MP_TAC EQ_EXT;
49480 REWRITE_TAC[UNION];
49483 REWRITE_TAC[image_sing;IMAGE_UNION;UNIONS_UNION];
49484 REWRITE_TAC[UNION];
49485 FULL_REWRITE_TAC[EMPTY_EXISTS];
49486 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`k`]);
49487 FULL_REWRITE_TAC[INTER];
49488 TYPE_THEN `u` EXISTS_TAC;
49492 let thread_finite_union = prove_by_refinement(
49493 `!(A:(A->bool)->(B->bool)) S.
49494 (FINITE S) /\ (!a b. A (a UNION b) = A a UNION A b) /\
49495 (A EMPTY = EMPTY) ==>
49496 (A (UNIONS S) = UNIONS (IMAGE A S))`,
49500 TYPE_THEN `!k S. S HAS_SIZE k ==> (A (UNIONS S) = UNIONS (IMAGE A S))` SUBAGOAL_TAC THENL [INDUCT_TAC;ALL_TAC];
49501 FULL_REWRITE_TAC[HAS_SIZE_0];
49502 ASM_REWRITE_TAC[IMAGE_CLAUSES;UNIONS_0;];
49503 THM_INTRO_TAC[`S'`;`k`] HAS_SIZE_SUC;
49505 USE 6 (REWRITE_RULE[EMPTY_EXISTS]);
49507 TSPEC `S' DELETE u` 4;
49508 TYPE_THEN `S' = (S' DELETE u) UNION {u}` SUBAGOAL_TAC;
49509 IMATCH_MP_TAC EQ_EXT;
49510 UND 6 THEN REWRITE_TAC[DELETE;UNION;INR IN_SING ] THEN MESON_TAC[];
49511 UND 7 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
49512 ASM_REWRITE_TAC[UNIONS_UNION;IMAGE_UNION;image_sing;];
49514 UND 3 THEN DISCH_THEN (THM_INTRO_TAC[`CARD S`;`S`]);
49515 ASM_REWRITE_TAC[HAS_SIZE];
49519 let conn2_sequence_lemma2 = prove_by_refinement(
49520 `!G N p. (0 < N) /\ (!i. (i <= N) ==> (conn2 (G i))) /\
49521 (!i. (i <= N) ==> (G i SUBSET edge )) /\
49522 (!i. (SUC i <= N) ==> ~(G i INTER G (SUC i) = EMPTY)) /\
49523 (!i. (SUC i <= N) ==> (unbounded_set (G i UNION G (SUC i)) p)) /\
49524 ~(unbounded_set (UNIONS (IMAGE G ({i | i <= N}))) p) ==>
49525 (bounded_set (UNIONS (IMAGE G {i | i <=| N})) p)`,
49529 PROOF_BY_CONTR_TAC;
49530 FULL_REWRITE_TAC [unbounded_diff;DIFF;DE_MORGAN_THM;];
49531 UND 6 THEN ASM_REWRITE_TAC[];
49532 USE 0 (ONCE_REWRITE_RULE[DISJ_SYM]);
49533 FIRST_ASSUM DISJ_CASES_TAC;
49535 FULL_REWRITE_TAC[ctop_unions;DIFF;DE_MORGAN_THM;];
49538 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`0`]);
49539 UND 5 THEN ARITH_TAC;
49542 TYPE_THEN `?j. (j <=| N) /\ UNIONS (curve_cell (G j)) p` SUBAGOAL_TAC;
49543 TYPE_THEN `!r. UNIONS (curve_cell r) = (UNIONS o curve_cell) r` SUBAGOAL_TAC;
49544 REWRITE_TAC[o_DEF];
49546 TYPE_THEN `A = UNIONS o curve_cell` ABBREV_TAC ;
49547 THM_INTRO_TAC[`A`;`IMAGE G {i | i <=| N}`] thread_finite_union;
49549 IMATCH_MP_TAC FINITE_IMAGE;
49550 REWRITE_TAC[FINITE_NUMSEG_LE];
49551 TYPE_THEN `A` UNABBREV_TAC;
49554 REWRITE_TAC[curve_cell_union;UNIONS_UNION];
49555 REWRITE_TAC[curve_cell_empty;];
49556 USE 11 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
49558 TYPE_THEN `A` UNABBREV_TAC;
49560 FULL_REWRITE_TAC[IMAGE_o];
49561 FULL_REWRITE_TAC[o_DEF];
49563 FULL_REWRITE_TAC[GSYM UNIONS_IMAGE_UNIONS];
49564 USE 9 (REWRITE_RULE[UNIONS]);
49565 USE 11 (REWRITE_RULE[IMAGE]);
49566 TYPE_THEN `u'` UNABBREV_TAC;
49567 TYPE_THEN `x` UNABBREV_TAC;
49568 TYPE_THEN `x'` EXISTS_TAC;
49569 REWRITE_TAC[UNIONS];
49570 TYPE_THEN `u` EXISTS_TAC;
49572 FULL_REWRITE_TAC[curve_cell_union;UNIONS_UNION];
49573 FULL_REWRITE_TAC[UNION;DE_MORGAN_THM];
49574 TYPE_THEN `j = 0` ASM_CASES_TAC;
49577 TYPE_THEN `?i. j = SUC i` SUBAGOAL_TAC ;
49578 TYPE_THEN `j - 1` EXISTS_TAC;
49579 UND 12 THEN ARITH_TAC;
49580 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
49582 TYPE_THEN `j` UNABBREV_TAC;
49583 UND 14 THEN ASM_REWRITE_TAC[];
49584 (* Fri Dec 24 07:02:02 EST 2004 *)
49589 let conn2_sequence_lemma3 = prove_by_refinement(
49590 `!G N. (!i. (i <= N) ==> (G i SUBSET edge )) ==>
49591 (UNIONS (IMAGE G {i | i <=| N}) SUBSET edge)`,
49595 REWRITE_TAC[UNIONS;IMAGE;SUBSET ];
49596 UND 0 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
49597 ASM_MESON_TAC[subset_imp];
49601 let unbounded_avoidance_subset_ver2 = prove_by_refinement(
49603 unbounded_set E' x /\
49608 ==> unbounded_set E x`,
49612 THM_INTRO_TAC[`E`;`E'`;`x`] unbounded_avoidance_subset;
49613 THM_INTRO_TAC[`E'`;`x`] unbounded_subset_unions;
49614 FULL_REWRITE_TAC[ctop_unions;DIFF];
49615 UND 6 THEN ASM_REWRITE_TAC[];
49619 let conn2_sequence_lemma4 = prove_by_refinement(
49620 `!G N p. (0 < N) /\ (!i. (i <= N) ==> (conn2 (G i))) /\
49621 (!i. (i <= N) ==> (G i SUBSET edge )) /\
49622 (!i. (SUC i <= N) ==> ~(G i INTER G (SUC i) = EMPTY)) /\
49623 (!i. (SUC i <= N) ==> (unbounded_set (G i UNION G (SUC i)) p)) /\
49624 (bounded_set (UNIONS (IMAGE G ({i | i <= N}))) p) ==>
49625 (?C i j . rectagon C /\ bounded_set C p /\
49626 (SUC i < j) /\ (j <=| N) /\
49627 (C SUBSET (UNIONS (IMAGE G ({x | (i <=| x) /\ (x <=| j)})))) /\
49628 (!C' i' j'. rectagon C' /\ bounded_set C' p /\
49629 (i' < j') /\ (j' <=| N) /\
49630 (C' SUBSET (UNIONS (IMAGE G ({x | (i' <=| x /\ x <=| j')})))) ==>
49631 (j - i <= j' - i') /\
49632 ((j - i = j' - i') ==>
49633 (CARD (C DIFF (G (SUC i))) <= CARD (C' DIFF (G (SUC i')))))))`,
49637 THM_INTRO_TAC[`N`;`G`;`N`] conn2_sequence_lemma1;
49639 TYPE_THEN `X = {(C,i,j) | rectagon C /\ bounded_set C p /\ (i <| j) /\ (j <=| N) /\ (C SUBSET UNIONS (IMAGE G {x | i <=| x /\ x <=| j})) }` ABBREV_TAC ;
49640 TYPE_THEN `~(X = EMPTY)` SUBAGOAL_TAC;
49641 UND 8 THEN REWRITE_TAC[EMPTY_EXISTS];
49642 THM_INTRO_TAC[`UNIONS (IMAGE G {i | i <=| N})`] rectagon_surround_conn2;
49643 IMATCH_MP_TAC conn2_sequence_lemma3;
49644 TYPE_THEN `(C,0,N)` EXISTS_TAC;
49645 TYPE_THEN `X` UNABBREV_TAC;
49646 REWRITE_TAC[PAIR_SPLIT];
49647 TYPE_THEN `C` EXISTS_TAC;
49648 TYPE_THEN `0` EXISTS_TAC;
49649 TYPE_THEN `N` EXISTS_TAC;
49650 REWRITE_TAC[ARITH_RULE `!x. 0 <=| x`];
49653 THM_INTRO_TAC[`X`;`(\ (C,i,j). j -| i):(((((num->real)->bool)->bool)#(num#num)) -> num)`] select_image_num_min;
49654 UND 8 THEN ASM_REWRITE_TAC[];
49656 TYPE_THEN `?D i j. z = (D,i,j)` SUBAGOAL_TAC;
49657 REWRITE_TAC[PAIR_SPLIT];
49659 TYPE_THEN `z` UNABBREV_TAC;
49661 TYPE_THEN `Y = {(C,i',j') | rectagon C /\ bounded_set C p /\ (i' <| j') /\ (j' <=| N) /\ (C SUBSET UNIONS (IMAGE G {x | i' <=| x /\ x <=| j'})) /\ (j' - i' = j - i) }` ABBREV_TAC ;
49662 TYPE_THEN `~(Y = EMPTY)` SUBAGOAL_TAC;
49663 UND 12 THEN REWRITE_TAC[EMPTY_EXISTS];
49664 TYPE_THEN `(D,i,j)` EXISTS_TAC;
49665 TYPE_THEN `Y` UNABBREV_TAC;
49666 REWRITE_TAC[PAIR_SPLIT];
49667 TYPE_THEN `D` EXISTS_TAC;
49668 TYPE_THEN `i` EXISTS_TAC;
49669 TYPE_THEN `j` EXISTS_TAC;
49670 TYPE_THEN `X` UNABBREV_TAC;
49671 USE 7 (REWRITE_RULE[PAIR_SPLIT]);
49674 THM_INTRO_TAC[`Y`;`\ (C,i',(j':num)). (CARD (C DIFF (G (SUC i'))))`] select_image_num_min;
49675 UND 12 THEN ASM_REWRITE_TAC[];
49676 TYPE_THEN `?C i' j'. z' = (C,i',j')` SUBAGOAL_TAC;
49677 REWRITE_TAC[PAIR_SPLIT];
49679 TYPE_THEN `z'` UNABBREV_TAC;
49680 TYPE_THEN `C` EXISTS_TAC;
49681 TYPE_THEN `i'` EXISTS_TAC;
49682 TYPE_THEN `j'` EXISTS_TAC;
49686 USE 14 (REWRITE_RULE[PAIR_SPLIT]);
49687 TYPE_THEN `C'` UNABBREV_TAC;
49688 TYPE_THEN `i''` UNABBREV_TAC;
49689 TYPE_THEN `j''` UNABBREV_TAC;
49692 TYPE_THEN `(SUC i' <| j') \/ (SUC i' = j')` SUBAGOAL_TAC;
49693 UND 18 THEN ARITH_TAC;
49694 FIRST_ASSUM DISJ_CASES_TAC;
49695 TYPE_THEN `j'` UNABBREV_TAC;
49696 PROOF_BY_CONTR_TAC;
49697 UND 1 THEN DISCH_THEN (THM_INTRO_TAC[`i'`]);
49698 TYPE_THEN `{x | i' <=| x /\ x <=| SUC i'} = {i'} UNION {(SUC i')}` SUBAGOAL_TAC;
49699 IMATCH_MP_TAC EQ_EXT;
49700 REWRITE_TAC[UNION];
49703 USE 16 (REWRITE_RULE[UNIONS_UNION;image_sing;IMAGE_UNION]);
49705 THM_INTRO_TAC[`C`;`(G i' UNION G (SUC i'))`;`p`]unbounded_avoidance_subset_ver2;
49706 REWRITE_TAC[union_subset];
49708 FIRST_ASSUM IMATCH_MP_TAC ;
49709 UND 17 THEN ARITH_TAC;
49711 REWRITE_TAC[FINITE_UNION];
49712 TYPE_THEN `i' <=| N` SUBAGOAL_TAC;
49713 UND 17 THEN ARITH_TAC;
49714 FULL_REWRITE_TAC[conn2];
49715 IMATCH_MP_TAC conn2_rectagon;
49717 THM_INTRO_TAC[`C`] bounded_unbounded_disj;
49718 USE 24 (REWRITE_RULE[INTER;EQ_EMPTY]);
49720 UND 24 THEN ASM_REWRITE_TAC[];
49722 TYPE_THEN `X (C'',i''',j''')` SUBAGOAL_TAC;
49723 TYPE_THEN `X` UNABBREV_TAC;
49724 REWRITE_TAC[PAIR_SPLIT];
49725 TYPE_THEN `C''` EXISTS_TAC;
49726 TYPE_THEN `i'''` EXISTS_TAC;
49727 TYPE_THEN `j'''` EXISTS_TAC;
49731 TSPEC `(C'',i''',j''')` 9;
49732 USE 9 (GBETA_RULE);
49734 TYPE_THEN `Y (C'',i''',j''')` SUBAGOAL_TAC;
49735 TYPE_THEN `Y` UNABBREV_TAC;
49736 REWRITE_TAC[PAIR_SPLIT];
49737 TYPE_THEN `C''` EXISTS_TAC;
49738 TYPE_THEN `i'''` EXISTS_TAC;
49739 TYPE_THEN `j'''` EXISTS_TAC;
49741 UND 13 THEN DISCH_THEN (THM_INTRO_TAC[`(C'',i''',j''')`]);
49742 (*** Removed by JRH; no longer needed with paired beta in default rewrites
49743 USE 13 (GBETA_RULE);
49745 (* Fri Dec 24 12:26:34 EST 2004 *)
49749 let endpoint_sub_rectagon = prove_by_refinement(
49750 `!C G m. rectagon G /\ C SUBSET G /\ endpoint C m ==>
49751 (?!e. G e /\ ~(C e) /\ cls {e} m)`,
49755 FULL_REWRITE_TAC[endpoint];
49756 THM_INTRO_TAC[`C`;`pointI m`] num_closure1;
49757 IMATCH_MP_TAC FINITE_SUBSET;
49758 TYPE_THEN `G` EXISTS_TAC;
49759 FULL_REWRITE_TAC[rectagon];
49761 FULL_REWRITE_TAC[rectagon];
49764 USE 2 (REWRITE_RULE[INSERT]);
49765 USE 2 (ONCE_REWRITE_RULE[TAUT `a \/ b <=> b \/ a`]);
49766 FIRST_ASSUM DISJ_CASES_TAC;
49767 THM_INTRO_TAC[`G`;`pointI m`] num_closure0;
49770 USE 1 (REWRITE_RULE[SUBSET]);
49776 USE 8 (REWRITE_RULE[]);
49777 THM_INTRO_TAC[`G`;`pointI m`] num_closure2;
49781 TYPE_THEN `G e` SUBAGOAL_TAC;
49782 USE 1 (REWRITE_RULE[SUBSET]);
49783 TYPE_THEN `(e = a) \/ (e = b)` SUBAGOAL_TAC;
49786 REWRITE_TAC[EXISTS_UNIQUE_ALT];
49788 FIRST_ASSUM DISJ_CASES_TAC;
49789 TYPE_THEN `e` UNABBREV_TAC;
49790 TYPE_THEN `b` EXISTS_TAC;
49791 IMATCH_MP_TAC EQ_ANTISYM;
49793 TYPE_THEN `e'` UNABBREV_TAC;
49796 FIRST_ASSUM DISJ_CASES_TAC;
49797 TYPE_THEN `y` UNABBREV_TAC;
49798 UND 18 THEN ASM_REWRITE_TAC[];
49799 TYPE_THEN `y` UNABBREV_TAC;
49804 TYPE_THEN `b` EXISTS_TAC;
49807 TYPE_THEN `e` UNABBREV_TAC;
49808 TYPE_THEN `a` EXISTS_TAC;
49809 IMATCH_MP_TAC EQ_ANTISYM;
49811 TYPE_THEN `e'` UNABBREV_TAC;
49814 FIRST_ASSUM DISJ_CASES_TAC;
49815 TYPE_THEN `y` UNABBREV_TAC;
49816 UND 18 THEN ASM_REWRITE_TAC[];
49817 TYPE_THEN `y` UNABBREV_TAC;
49822 TYPE_THEN `a` EXISTS_TAC;
49824 (* Mon Dec 27 15:17:28 EST 2004 *)
49828 let cut_rectagon_unique = prove_by_refinement(
49829 `!E A B C m n. rectagon E /\ A SUBSET E /\ B SUBSET E /\ C SUBSET E /\
49830 segment_end A m n /\ segment_end B m n /\ segment_end C m n /\
49831 (E = A UNION B) /\ (A INTER B = EMPTY) ==>
49832 (C = A) \/ (C = B)`,
49836 TYPE_THEN `!A. A SUBSET E /\ segment_end A m n /\ ~(A INTER C = EMPTY) ==> (A SUBSET C)` SUBAGOAL_TAC;
49837 TYPE_THEN `inductive_set A' (A' INTER C)` SUBAGOAL_TAC;
49838 REWRITE_TAC[inductive_set];
49840 REWRITE_TAC[INTER;SUBSET];
49841 FULL_REWRITE_TAC[INTER];
49842 TYPE_THEN `edge C' /\ edge C''` SUBAGOAL_TAC;
49843 FULL_REWRITE_TAC[segment_end;psegment;segment];
49844 UND 16 THEN UND 15 THEN UND 13 THEN MESON_TAC[subset_imp];
49845 THM_INTRO_TAC[`C'`;`C''`] adjv_adj;
49846 THM_INTRO_TAC[`C'`;`C''`] adjv_adj2;
49847 TYPE_THEN `q =adjv C' C''` ABBREV_TAC ;
49848 TYPE_THEN `~(C' = C'')` SUBAGOAL_TAC;
49849 FULL_REWRITE_TAC[adj];
49850 UND 22 THEN ASM_REWRITE_TAC[];
49852 TYPE_THEN `~(endpoint A' q)` SUBAGOAL_TAC;
49853 FULL_REWRITE_TAC[segment_end];
49855 USE 22 (REWRITE_RULE[endpoint]);
49856 THM_INTRO_TAC[`A'`;`pointI q`] num_closure1;
49857 USE 3 (REWRITE_RULE[psegment;segment]);
49864 TYPE_THEN `~(endpoint C q)` SUBAGOAL_TAC;
49865 FULL_REWRITE_TAC[segment_end];
49866 TYPE_THEN `endpoint A'` UNABBREV_TAC;
49867 TYPE_THEN `endpoint C` UNABBREV_TAC;
49868 UND 22 THEN ASM_REWRITE_TAC[];
49870 PROOF_BY_CONTR_TAC;
49871 UND 23 THEN ASM_REWRITE_TAC[];
49872 IMATCH_MP_TAC rectagon_subset_endpoint;
49874 TYPE_THEN `E` EXISTS_TAC;
49875 CONJ_TAC THEN IMATCH_MP_TAC num_closure_pos;
49877 USE 2 (REWRITE_RULE[segment_end;segment;psegment]);
49878 TYPE_THEN `C'` EXISTS_TAC;
49881 IMATCH_MP_TAC FINITE_SUBSET;
49882 TYPE_THEN `E` EXISTS_TAC;
49883 REWRITE_TAC[DIFF;SUBSET];
49884 FULL_REWRITE_TAC[rectagon];
49885 TYPE_THEN `C''` EXISTS_TAC;
49887 USE 11 (REWRITE_RULE[SUBSET]);
49889 USE 10 (REWRITE_RULE[segment_end;psegment;segment]);
49890 FULL_REWRITE_TAC[inductive_set];
49891 UND 14 THEN DISCH_THEN (THM_INTRO_TAC[`A' INTER C`]);
49893 REWRITE_TAC[SUBSET_INTER_ABSORPTION];
49895 TYPE_THEN `!A B. (A INTER B = EMPTY ) /\ (E = A UNION B) /\ (segment_end B m n) /\ (segment_end A m n) /\ (B SUBSET E) /\ (A SUBSET E) /\ ~(C INTER A = EMPTY) ==> (C = A)` SUBAGOAL_TAC;
49896 TYPE_THEN `A' SUBSET C` SUBAGOAL_TAC;
49897 FIRST_ASSUM IMATCH_MP_TAC ;
49898 FULL_REWRITE_TAC[INTER_COMM];
49899 UND 10 THEN ASM_REWRITE_TAC[];
49901 TYPE_THEN `B' INTER C = EMPTY` ASM_CASES_TAC;
49902 TYPE_THEN `E` UNABBREV_TAC;
49903 TYPE_THEN `A UNION B` UNABBREV_TAC;
49904 UND 5 THEN UND 18 THEN UND 17 THEN POP_ASSUM_LIST (fun t-> ALL_TAC);
49905 FULL_REWRITE_TAC[SUBSET;INTER;EQ_EMPTY;UNION];
49906 IMATCH_MP_TAC EQ_EXT ;
49912 TYPE_THEN `B' SUBSET C` SUBAGOAL_TAC;
49913 FIRST_ASSUM IMATCH_MP_TAC ;
49915 TYPE_THEN `E = C` SUBAGOAL_TAC;
49916 IMATCH_MP_TAC EQ_EXT;
49917 REWRITE_TAC[UNION];
49918 IMATCH_MP_TAC EQ_ANTISYM;
49920 FIRST_ASSUM DISJ_CASES_TAC;
49921 ASM_MESON_TAC[subset_imp];
49922 ASM_MESON_TAC[subset_imp];
49923 TYPE_THEN `E` UNABBREV_TAC;
49924 TYPE_THEN `A UNION B` UNABBREV_TAC;
49925 USE 5 (REWRITE_RULE[SUBSET;UNION]);
49926 TYPE_THEN `C` UNABBREV_TAC;
49927 USE 2 (REWRITE_RULE[segment_end;psegment]);
49928 UND 20 THEN ASM_REWRITE_TAC[];
49930 TYPE_THEN `~(C INTER A = EMPTY) \/ ~( C INTER B = EMPTY)` SUBAGOAL_TAC;
49931 PROOF_BY_CONTR_TAC;
49932 USE 11 (REWRITE_RULE[DE_MORGAN_THM]);
49933 TYPE_THEN `E` UNABBREV_TAC;
49934 FULL_REWRITE_TAC[INTER;EQ_EMPTY];
49935 USE 5 (REWRITE_RULE[SUBSET;UNION]);
49936 USE 2 (REWRITE_RULE[segment_end;psegment;segment]);
49937 FULL_REWRITE_TAC[EMPTY_EXISTS];
49942 FIRST_ASSUM DISJ_CASES_TAC;
49944 FIRST_ASSUM IMATCH_MP_TAC ;
49945 TYPE_THEN `B` EXISTS_TAC;
49946 ASM_REWRITE_TAC[SUBSET;UNION];
49948 FIRST_ASSUM IMATCH_MP_TAC ;
49949 TYPE_THEN `A` EXISTS_TAC;
49950 FULL_REWRITE_TAC[INTER_COMM;UNION_COMM];
49951 ASM_REWRITE_TAC[SUBSET;UNION];
49952 (* Mon Dec 27 20:34:44 EST 2004 *)
49957 let conn2_sequence_lemma5 = prove_by_refinement(
49958 `!C E . ~(E SUBSET C) /\ psegment E /\ rectagon C /\
49959 endpoint E SUBSET cls C ==>
49960 (?E'. E' SUBSET E /\ psegment E' /\ (E' INTER C = EMPTY ) /\
49961 (cls E' INTER cls C = endpoint E'))`,
49965 TYPE_THEN `?e. E e /\ ~C e` SUBAGOAL_TAC;
49966 FULL_REWRITE_TAC[SUBSET];
49969 TYPE_THEN `J = segment_of (E DIFF C) e` ABBREV_TAC ;
49970 TYPE_THEN `X = { A | psegment A /\ A SUBSET E /\ (A INTER C = EMPTY) /\ (endpoint A SUBSET cls C)}` ABBREV_TAC ;
49971 TYPE_THEN `~(X = EMPTY)` SUBAGOAL_TAC THENL [REWRITE_TAC[EMPTY_EXISTS];ALL_TAC];
49972 TYPE_THEN `X` UNABBREV_TAC;
49973 TYPE_THEN `J` EXISTS_TAC;
49974 TYPE_THEN `J SUBSET (E DIFF C)` SUBAGOAL_TAC;
49975 TYPE_THEN `J` UNABBREV_TAC;
49976 THM_INTRO_TAC[`(E DIFF C)`;`e`] segment_of_G;
49979 THM_INTRO_TAC[`E`;`E DIFF C`;`e`] segment_of_segment;
49980 FULL_REWRITE_TAC[psegment];
49981 REWRITE_TAC[DIFF;SUBSET];
49982 TYPE_THEN `J` UNABBREV_TAC;
49983 REWRITE_TAC[psegment];
49985 THM_INTRO_TAC[`segment_of (E DIFF C) e`;`E`] rectagon_subset;
49986 USE 2 (REWRITE_RULE[psegment]);
49987 IMATCH_MP_TAC SUBSET_TRANS;
49988 TYPE_THEN `E DIFF C` EXISTS_TAC;
49989 REWRITE_TAC[DIFF;SUBSET];
49990 USE 2 (REWRITE_RULE[psegment]);
49994 UND 7 THEN REWRITE_TAC[SUBSET;DIFF];
49996 UND 7 THEN REWRITE_TAC[SUBSET;DIFF;INTER;EQ_EMPTY] THEN MESON_TAC[];
49997 REWRITE_TAC[SUBSET];
49998 PROOF_BY_CONTR_TAC;
50000 THM_INTRO_TAC[`E DIFF C`;`e`] inductive_segment;
50002 FULL_REWRITE_TAC[inductive_set];
50003 USE 8 (REWRITE_RULE[endpoint]);
50004 THM_INTRO_TAC[`J`;`pointI x`] num_closure1;
50005 TYPE_THEN `J` UNABBREV_TAC;
50006 IMATCH_MP_TAC segment_of_finite;
50008 IMATCH_MP_TAC FINITE_SUBSET;
50009 TYPE_THEN `E` EXISTS_TAC;
50010 REWRITE_TAC[DIFF;SUBSET];
50011 USE 2 (REWRITE_RULE[psegment;segment]);
50014 USE 2 (REWRITE_RULE[psegment;segment]);
50016 USE 15 (REWRITE_RULE[INSERT]);
50017 UND 15 THEN REP_CASES_TAC;
50018 THM_INTRO_TAC[`E`;`pointI x`] num_closure2;
50021 TYPE_THEN `?a b. ~(a = b) /\ (!e. E e /\ closure top2 e (pointI x) <=> (e = a) \/ (e = b)) /\ (!e. J e /\ closure top2 e (pointI x) <=> (e = a))` SUBAGOAL_TAC;
50022 TYPE_THEN `(e' = a) \/ (e' = b)` SUBAGOAL_TAC;
50024 USE 15 (ONCE_REWRITE_RULE[EQ_SYM_EQ]);
50026 TYPE_THEN `J` UNABBREV_TAC;
50027 THM_INTRO_TAC[`E DIFF C`;`e`] segment_of_G;
50029 USE 21 (REWRITE_RULE[SUBSET]);
50031 USE 13 (REWRITE_RULE[DIFF]);
50032 FIRST_ASSUM DISJ_CASES_TAC;
50033 TYPE_THEN `e'` UNABBREV_TAC;
50034 TYPE_THEN `a` EXISTS_TAC ;
50035 TYPE_THEN `b` EXISTS_TAC;
50037 TYPE_THEN `e'` UNABBREV_TAC;
50038 TYPE_THEN `b` EXISTS_TAC;
50039 TYPE_THEN `a` EXISTS_TAC;
50040 REWRITE_TAC [EQ_SYM_EQ ];
50044 TYPE_THEN `segment_of (E DIFF C) e b'` SUBAGOAL_TAC;
50045 FIRST_ASSUM IMATCH_MP_TAC ;
50046 TYPE_THEN `a'` EXISTS_TAC;
50049 TYPE_THEN `J` UNABBREV_TAC;
50057 USE 9 (REWRITE_RULE[cls]);
50062 UND 22 THEN ASM_REWRITE_TAC[];
50063 UND 9 THEN ASM_REWRITE_TAC[];
50066 REWRITE_TAC[INTER;EMPTY_EXISTS];
50067 TYPE_THEN `pointI x` EXISTS_TAC;
50076 TYPE_THEN `J` UNABBREV_TAC;
50081 UND 21 THEN ASM_REWRITE_TAC[];
50083 USE 0 (REWRITE_RULE[SUBSET]);
50085 USE 0 (REWRITE_RULE[endpoint]);
50086 UND 9 THEN ASM_REWRITE_TAC[];
50088 THM_INTRO_TAC[`J`;`E`;`pointI x`] num_closure_mono;
50089 TYPE_THEN `J` UNABBREV_TAC;
50090 REWRITE_TAC[SUBSET];
50091 THM_INTRO_TAC[`E DIFF C`;`e`] segment_of_G;
50093 USE 19 (REWRITE_RULE[SUBSET]);
50095 USE 6 (REWRITE_RULE[DIFF]);
50096 UND 8 THEN UND 15 THEN UND 19 THEN ARITH_TAC;
50098 THM_INTRO_TAC[`X`] select_card_min;
50099 UND 8 THEN ASM_REWRITE_TAC[];
50101 TYPE_THEN `z` EXISTS_TAC;
50102 TYPE_THEN `X` UNABBREV_TAC;
50103 IMATCH_MP_TAC SUBSET_ANTISYM;
50104 IMATCH_MP_TAC (TAUT `a /\ b==> b /\ a`);
50106 REWRITE_TAC[SUBSET_INTER];
50107 IMATCH_MP_TAC endpoint_cls;
50108 IMATCH_MP_TAC FINITE_SUBSET;
50109 TYPE_THEN `E` EXISTS_TAC;
50110 USE 2 (REWRITE_RULE[psegment;segment]);
50111 REWRITE_TAC[INTER;SUBSET];
50112 PROOF_BY_CONTR_TAC;
50113 (* - cut along x *)
50114 THM_INTRO_TAC[`z`] endpoint_size2;
50115 FULL_REWRITE_TAC[has_size2];
50116 TYPE_THEN `segment_end z a b` SUBAGOAL_TAC;
50117 REWRITE_TAC[segment_end];
50119 THM_INTRO_TAC[`z`;`a`;`b`;`x`] cut_psegment;
50120 TYPE_THEN `endpoint z` UNABBREV_TAC;
50121 USE 15 (REWRITE_RULE[INR in_pair;DE_MORGAN_THM ]);
50122 UND 9 THEN DISCH_THEN (THM_INTRO_TAC[`A`]);
50124 USE 20 (REWRITE_RULE[segment_end]);
50126 IMATCH_MP_TAC SUBSET_TRANS;
50127 TYPE_THEN `z` EXISTS_TAC;
50128 REWRITE_TAC[SUBSET;UNION];
50130 REWRITE_TAC[EQ_EMPTY;INTER];
50131 USE 10 (REWRITE_RULE[INTER;EQ_EMPTY ]);
50133 UND 10 THEN ASM_REWRITE_TAC[];
50134 REWRITE_TAC[UNION];
50135 USE 20 (REWRITE_RULE[segment_end]);
50136 REWRITE_TAC[SUBSET;INR in_pair];
50137 FIRST_ASSUM DISJ_CASES_TAC;
50138 TYPE_THEN `x'` UNABBREV_TAC;
50139 TYPE_THEN `x'` UNABBREV_TAC;
50140 USE 7 (REWRITE_RULE[SUBSET]);
50141 FIRST_ASSUM IMATCH_MP_TAC ;
50143 USE 9 (MATCH_MP (ARITH_RULE `x <=| y ==> ~(y < x)`));
50144 UND 9 THEN REWRITE_TAC[];
50145 IMATCH_MP_TAC card_subset_lt;
50147 REWRITE_TAC[SUBSET;UNION];
50149 TYPE_THEN `B = EMPTY` SUBAGOAL_TAC;
50150 PROOF_BY_CONTR_TAC;
50151 USE 24 (REWRITE_RULE[EMPTY_EXISTS]);
50152 USE 9 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
50154 USE 9 (REWRITE_RULE[UNION]);
50155 UND 22 THEN ASM_REWRITE_TAC[INTER;EMPTY_EXISTS];
50157 TYPE_THEN `B` UNABBREV_TAC;
50158 USE 19 (REWRITE_RULE[segment_end;psegment;segment]);
50160 TYPE_THEN `A UNION B` UNABBREV_TAC;
50161 USE 12 (REWRITE_RULE[psegment;segment;]);
50162 (* Mon Dec 27 23:01:48 EST 2004 *)
50168 let conn_splice = prove_by_refinement(
50169 `!E AE B a b a' b'. segment_end E a b /\ segment_end AE a' b' /\
50170 segment_end B a' b' /\ AE SUBSET E ==>
50171 (?B'. segment_end B' a b /\ B' SUBSET (E DIFF AE) UNION B)`,
50175 TYPE_THEN `J= (E DIFF AE) UNION B` ABBREV_TAC ;
50176 TYPE_THEN `B SUBSET J` SUBAGOAL_TAC;
50177 TYPE_THEN `J` UNABBREV_TAC;
50178 REWRITE_TAC[SUBSET;UNION];
50180 TYPE_THEN `cls B SUBSET cls J` SUBAGOAL_TAC;
50181 IMATCH_MP_TAC cls_subset;
50182 TYPE_THEN `endpoint B SUBSET cls B` SUBAGOAL_TAC;
50183 IMATCH_MP_TAC endpoint_cls;
50184 USE 1 (REWRITE_RULE[segment_end;segment;psegment]);
50186 TYPE_THEN `cls B a' /\ cls B b'` SUBAGOAL_TAC;
50187 FULL_REWRITE_TAC[SUBSET];
50188 USE 1 (REWRITE_RULE[segment_end]);
50189 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC ) THEN ASM_REWRITE_TAC[INR in_pair ];
50190 TYPE_THEN `cls J a' /\ cls J b'` SUBAGOAL_TAC;
50191 USE 6 (REWRITE_RULE[SUBSET]);
50193 TYPE_THEN `conn J` SUBAGOAL_TAC ;
50194 TYPE_THEN `!x. cls J x ==> (x = a') \/ (?P. segment_end P x a' /\ P SUBSET J)` BACK_TAC;
50196 TYPE_THEN `a'' = a'` ASM_CASES_TAC;
50197 ONCE_REWRITE_TAC[segment_end_symm];
50198 TYPE_THEN `a''` UNABBREV_TAC;
50200 FIRST_ASSUM DISJ_CASES_TAC;
50201 TYPE_THEN `b''` UNABBREV_TAC;
50203 TYPE_THEN `P` EXISTS_TAC;
50205 TYPE_THEN `b'' = a'` ASM_CASES_TAC;
50206 TYPE_THEN `b''` UNABBREV_TAC;
50208 FIRST_ASSUM DISJ_CASES_TAC;
50209 TYPE_THEN `a''` UNABBREV_TAC;
50211 TYPE_THEN `P` EXISTS_TAC;
50218 THM_INTRO_TAC[`P`;`P'`;`a''`;`a'`;`b''`] segment_end_trans;
50219 ONCE_REWRITE_TAC[segment_end_symm];
50220 TYPE_THEN `U` EXISTS_TAC;
50221 IMATCH_MP_TAC SUBSET_TRANS;
50222 TYPE_THEN `P UNION P'` EXISTS_TAC;
50223 REWRITE_TAC[union_subset];
50225 TYPE_THEN `x = a'` ASM_CASES_TAC;
50226 TYPE_THEN `x = b'` ASM_CASES_TAC;
50227 TYPE_THEN `B` EXISTS_TAC;
50228 ONCE_REWRITE_TAC [segment_end_symm];
50230 TYPE_THEN `?P. segment_end P x b' /\ P SUBSET J` ASM_CASES_TAC;
50231 THM_INTRO_TAC[`P`;`B`;`x`;`b'`;`a'`] segment_end_trans;
50232 ONCE_REWRITE_TAC[segment_end_symm];
50233 TYPE_THEN `U` EXISTS_TAC;
50234 IMATCH_MP_TAC SUBSET_TRANS;
50235 TYPE_THEN `P UNION B` EXISTS_TAC;
50236 REWRITE_TAC[union_subset];
50238 TYPE_THEN `cls B x` ASM_CASES_TAC;
50239 THM_INTRO_TAC[`B`;`a'`;`b'`;`x`] cut_psegment;
50240 TYPE_THEN `A` EXISTS_TAC;
50241 ONCE_REWRITE_TAC[segment_end_symm];
50242 TYPE_THEN `J` UNABBREV_TAC;
50243 REWRITE_TAC[SUBSET;UNION];
50245 TYPE_THEN `cls E x` SUBAGOAL_TAC;
50246 TYPE_THEN `(E DIFF AE) SUBSET E` SUBAGOAL_TAC;
50247 REWRITE_TAC[DIFF;SUBSET];
50248 USE 17 (MATCH_MP cls_subset);
50249 USE 17 (REWRITE_RULE[SUBSET]);
50250 FIRST_ASSUM IMATCH_MP_TAC ;
50251 TYPE_THEN `J` UNABBREV_TAC;
50252 FULL_REWRITE_TAC[cls_union];
50253 USE 12 (REWRITE_RULE[UNION]);
50256 TYPE_THEN `cls (E DIFF AE) x` SUBAGOAL_TAC ;
50257 TYPE_THEN `J` UNABBREV_TAC;
50258 USE 12 (REWRITE_RULE[cls_union]);
50259 USE 4 (REWRITE_RULE[UNION]);
50262 PROOF_BY_CONTR_TAC;
50263 TYPE_THEN `S = {e | E e /\ ~AE e /\ (?x. closure top2 e (pointI x) /\ ~(?P. segment_end P x a' /\ P SUBSET J) /\ ~(?P. segment_end P x b' /\ P SUBSET J) ) }` ABBREV_TAC ;
50264 TYPE_THEN `inductive_set E S` SUBAGOAL_TAC;
50265 REWRITE_TAC[inductive_set];
50267 TYPE_THEN `S` UNABBREV_TAC;
50268 REWRITE_TAC[SUBSET];
50270 USE 18 (REWRITE_RULE[cls]);
50271 UND 22 THEN REWRITE_TAC[EMPTY_EXISTS];
50272 TYPE_THEN `e` EXISTS_TAC;
50273 TYPE_THEN `S` UNABBREV_TAC;
50274 USE 23 (REWRITE_RULE[DIFF]);
50275 TYPE_THEN `x` EXISTS_TAC;
50277 TYPE_THEN `S` UNABBREV_TAC;
50279 THM_INTRO_TAC[`E`;`AE`;`adjv C C'`] psegment_subset_endpoint;
50281 USE 3 (REWRITE_RULE[segment_end]);
50283 IMATCH_MP_TAC num_closure_pos;
50285 USE 2 (REWRITE_RULE[segment_end;psegment;segment]);
50286 TYPE_THEN `C'` EXISTS_TAC;
50287 IMATCH_MP_TAC adjv_adj2;
50288 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50289 USE 34 (REWRITE_RULE[SUBSET]);
50290 IMATCH_MP_TAC num_closure_pos;
50292 IMATCH_MP_TAC FINITE_SUBSET;
50293 TYPE_THEN `E` EXISTS_TAC;
50294 REWRITE_TAC[DIFF;SUBSET];
50295 USE 3 (REWRITE_RULE[segment_end;psegment;segment]);
50296 TYPE_THEN `C` EXISTS_TAC;
50297 ASM_REWRITE_TAC [DIFF];
50298 IMATCH_MP_TAC adjv_adj;
50299 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50300 USE 34 (REWRITE_RULE[SUBSET]);
50301 USE 2 (REWRITE_RULE[segment_end]);
50302 TYPE_THEN `endpoint AE` UNABBREV_TAC;
50303 USE 30 (REWRITE_RULE[INR in_pair]);
50305 TYPE_THEN `x' = adjv C C'` ASM_CASES_TAC;
50306 TYPE_THEN `adjv C C'` UNABBREV_TAC;
50307 FIRST_ASSUM DISJ_CASES_TAC THEN REP_BASIC_TAC THEN (TYPE_THEN`x'` UNABBREV_TAC);
50308 UND 24 THEN REWRITE_TAC[];
50309 TYPE_THEN `B` EXISTS_TAC;
50310 ONCE_REWRITE_TAC [segment_end_symm];
50311 UND 20 THEN REWRITE_TAC[];
50312 TYPE_THEN `B` EXISTS_TAC;
50314 THM_INTRO_TAC[`C`;`C'`] adjv_adj;
50315 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50316 USE 35 (REWRITE_RULE[SUBSET]);
50318 TYPE_THEN `{C} SUBSET J` SUBAGOAL_TAC;
50319 TYPE_THEN `J` UNABBREV_TAC;
50320 REWRITE_TAC[SUBSET;INR IN_SING;DIFF;UNION];
50322 TYPE_THEN `segment_end {C} x' (adjv C C')` SUBAGOAL_TAC;
50323 IMATCH_MP_TAC segment_end_sing;
50324 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50325 USE 37 (REWRITE_RULE[SUBSET]);
50326 FIRST_ASSUM DISJ_CASES_TAC;
50327 TYPE_THEN `b'` UNABBREV_TAC;
50328 UND 20 THEN REWRITE_TAC[];
50329 TYPE_THEN `{C}` EXISTS_TAC;
50330 TYPE_THEN `a'` UNABBREV_TAC;
50331 UND 24 THEN REWRITE_TAC[];
50332 TYPE_THEN `{C}` EXISTS_TAC;
50334 TYPE_THEN `adjv C C'` EXISTS_TAC;
50335 TYPE_THEN `edge C /\ edge C'` SUBAGOAL_TAC;
50336 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50337 USE 32 (REWRITE_RULE[SUBSET]);
50339 IMATCH_MP_TAC adjv_adj2;
50341 TYPE_THEN `x' = adjv C C'` ASM_CASES_TAC;
50342 TYPE_THEN `adjv C C'` UNABBREV_TAC;
50344 TYPE_THEN `segment_end {C} x' (adjv C C')` SUBAGOAL_TAC;
50345 IMATCH_MP_TAC segment_end_sing;
50346 IMATCH_MP_TAC adjv_adj;
50347 TYPE_THEN `{C} SUBSET J` SUBAGOAL_TAC;
50348 TYPE_THEN `J` UNABBREV_TAC;
50349 REWRITE_TAC[SUBSET;DIFF;UNION;INR IN_SING ];
50351 TYPE_THEN `adjv C C' = a'` ASM_CASES_TAC;
50352 TYPE_THEN `adjv C C'` UNABBREV_TAC;
50353 PROOF_BY_CONTR_TAC;
50354 UND 24 THEN ASM_REWRITE_TAC[];
50355 TYPE_THEN `{C}` EXISTS_TAC;
50356 TYPE_THEN `adjv C C' = b'` ASM_CASES_TAC;
50357 TYPE_THEN `adjv C C'` UNABBREV_TAC;
50358 PROOF_BY_CONTR_TAC;
50359 UND 20 THEN ASM_REWRITE_TAC[];
50360 TYPE_THEN `{C}` EXISTS_TAC;
50361 (* --- repeat from here *)
50362 TYPE_THEN `x' = a'` ASM_CASES_TAC;
50363 TYPE_THEN `x'` UNABBREV_TAC;
50364 PROOF_BY_CONTR_TAC;
50365 UND 20 THEN REWRITE_TAC[];
50366 TYPE_THEN `B` EXISTS_TAC;
50367 TYPE_THEN `x' = b'` ASM_CASES_TAC;
50368 TYPE_THEN `x'` UNABBREV_TAC;
50369 PROOF_BY_CONTR_TAC;
50370 UND 24 THEN REWRITE_TAC[];
50371 TYPE_THEN `B` EXISTS_TAC;
50372 ONCE_REWRITE_TAC[segment_end_symm];
50375 UND 24 THEN REWRITE_TAC[];
50376 THM_INTRO_TAC[`{C}`;`P`;`x'`;`adjv C C'`;`a'`] segment_end_trans;
50377 TYPE_THEN `U` EXISTS_TAC;
50378 IMATCH_MP_TAC SUBSET_TRANS;
50379 TYPE_THEN `{C} UNION P` EXISTS_TAC;
50380 REWRITE_TAC[union_subset];
50382 UND 20 THEN REWRITE_TAC[];
50383 THM_INTRO_TAC[`{C}`;`P`;`x'`;`adjv C C'`;`b'`] segment_end_trans;
50384 TYPE_THEN `U` EXISTS_TAC;
50385 IMATCH_MP_TAC SUBSET_TRANS;
50386 TYPE_THEN `{C} UNION P` EXISTS_TAC;
50387 REWRITE_TAC[union_subset];
50389 TYPE_THEN `S = E` SUBAGOAL_TAC;
50390 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50391 FIRST_ASSUM IMATCH_MP_TAC ;
50392 FULL_REWRITE_TAC[inductive_set];
50395 TYPE_THEN `S` UNABBREV_TAC;
50396 USE 22 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
50397 TYPE_THEN `~(AE = EMPTY)` SUBAGOAL_TAC;
50398 USE 2 (REWRITE_RULE[segment_end;segment;psegment]);
50399 UND 27 THEN ASM_REWRITE_TAC[];
50400 USE 22 (REWRITE_RULE[EMPTY_EXISTS]);
50402 UND 20 THEN ASM_REWRITE_TAC[];
50403 USE 0 (REWRITE_RULE[SUBSET]);
50405 FULL_REWRITE_TAC[conn];
50406 TYPE_THEN `~(a = b)` SUBAGOAL_TAC;
50407 USE 3 (MATCH_MP segment_end_disj);
50408 UND 3 THEN ASM_REWRITE_TAC[];
50409 ONCE_REWRITE_TAC[TAUT `a /\ b <=> b /\ a`];
50410 FIRST_ASSUM IMATCH_MP_TAC ;
50412 TYPE_THEN `!c. endpoint E c /\ cls AE c ==> endpoint AE c` SUBAGOAL_TAC;
50413 REWRITE_TAC[endpoint];
50414 THM_INTRO_TAC[`AE`;`E`;`pointI c`] num_closure_mono;
50415 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50416 USE 15 (REWRITE_RULE[endpoint]);
50418 USE 16 (MATCH_MP (ARITH_RULE `x <=| 1 ==> (x = 1) \/ (x = 0)`));
50419 FIRST_ASSUM DISJ_CASES_TAC;
50420 PROOF_BY_CONTR_TAC;
50421 USE 14 (REWRITE_RULE[cls]);
50422 THM_INTRO_TAC[`AE`;`pointI c`] num_closure0;
50423 USE 2 (REWRITE_RULE[segment_end;psegment;segment]);
50426 UND 19 THEN ASM_REWRITE_TAC[];
50428 TYPE_THEN `!c. endpoint E c ==> cls J c` SUBAGOAL_TAC;
50429 TYPE_THEN `J` UNABBREV_TAC;
50430 REWRITE_TAC[cls_union];
50431 REWRITE_TAC[UNION];
50432 TYPE_THEN `cls AE c` ASM_CASES_TAC;
50434 TYPE_THEN `endpoint AE c` SUBAGOAL_TAC;
50435 FIRST_ASSUM IMATCH_MP_TAC ;
50436 TYPE_THEN `endpoint B c` SUBAGOAL_TAC;
50437 FULL_REWRITE_TAC[segment_end];
50438 TYPE_THEN `{a',b'}` UNABBREV_TAC;
50439 THM_INTRO_TAC[`B`] endpoint_cls;
50440 USE 1 (REWRITE_RULE[segment_end;psegment;segment]);
50442 ASM_MESON_TAC[subset_imp];
50444 TYPE_THEN `E = (E DIFF AE) UNION AE` SUBAGOAL_TAC;
50445 IMATCH_MP_TAC EQ_EXT;
50446 UND 0 THEN REWRITE_TAC[SUBSET;DIFF;UNION] THEN MESON_TAC[];
50447 TYPE_THEN `cls E c` SUBAGOAL_TAC;
50448 THM_INTRO_TAC[`E`] endpoint_cls;
50449 USE 3 (REWRITE_RULE[segment_end;segment;psegment]);
50450 ASM_MESON_TAC[subset_imp];
50451 UND 16 THEN DISCH_THEN (fun t -> USE 17 (ONCE_REWRITE_RULE[t]));
50452 FULL_REWRITE_TAC[cls_union];
50453 USE 16 (REWRITE_RULE[UNION ]);
50456 USE 3 (REWRITE_RULE[segment_end]);
50457 TYPE_THEN `endpoint E` UNABBREV_TAC;
50458 USE 15 (REWRITE_RULE[INR in_pair]);
50459 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC ;
50460 (* Tue Dec 28 12:02:34 EST 2004 *)
50465 let conn2_sequence = prove_by_refinement(
50466 `!G N p. (0 < N) /\ (!i. (i <= N) ==> (conn2 (G i))) /\
50467 (!i. (i <= N) ==> (G i SUBSET edge )) /\
50468 (!i. (SUC i <= N) ==> ~(G i INTER G (SUC i) = EMPTY)) /\
50469 (!i j. (i < j) /\ (j <=| N) /\ ~(SUC i = j) ==>
50470 (curve_cell (G i) INTER (curve_cell (G j)) = EMPTY)) /\
50471 (!i. (SUC i <= N) ==> (unbounded_set (G i UNION G (SUC i)) p)) ==>
50472 (unbounded_set (UNIONS (IMAGE G ({i | i <= N}))) p)
50477 PROOF_BY_CONTR_TAC;
50478 THM_INTRO_TAC[`N`;`G`;`N`] conn2_sequence_lemma1;
50480 THM_INTRO_TAC[`G`;`N`;`p`] conn2_sequence_lemma2;
50481 THM_INTRO_TAC[`G`;`N`] conn2_sequence_lemma3;
50482 THM_INTRO_TAC[`G`;`N`;`p`] conn2_sequence_lemma4;
50484 TYPE_THEN `?ei. C ei /\ G i ei /\ (!k. i < k /\ k <=|j ==> ~G k ei)` SUBAGOAL_TAC;
50485 PROOF_BY_CONTR_TAC;
50486 UNDH 3313 THEN DISCH_THEN (THM_INTRO_TAC[`C`;`SUC i`;`j`]);
50487 TYPE_THEN `{x | i <=| x /\ x <=| j} = {i} UNION {x | SUC i <= x /\ x <= j}` SUBAGOAL_TAC;
50488 IMATCH_MP_TAC EQ_EXT;
50489 REWRITE_TAC[UNION];
50490 UNDH 3810 THEN ARITH_TAC;
50492 USEH 4802 (REWRITE_RULE[IMAGE_UNION;image_sing;UNIONS_UNION]);
50493 USEH 5681 (REWRITE_RULE[SUBSET;UNION;UNIONS;IMAGE]);
50494 REWRITE_TAC[SUBSET;UNIONS;IMAGE];
50495 CONV_TAC (dropq_conv "u");
50501 USEH 7623 (CONV_RULE NAME_CONFLICT_CONV);
50503 TYPE_THEN `G i x` ASM_CASES_TAC;
50506 TYPE_THEN `k` EXISTS_TAC;
50507 UNDH 2414 THEN MESON_TAC[ARITH_RULE `a <| b ==> SUC a <=| b`];
50510 UNDH 5817 THEN UNDH 3810 THEN ARITH_TAC;
50512 TYPE_THEN `?ej. C ej /\ G j ej /\ (!k. i <= k /\ k <| j ==> ~G k ej)` SUBAGOAL_TAC;
50513 PROOF_BY_CONTR_TAC;
50514 UNDH 3313 THEN DISCH_THEN (THM_INTRO_TAC[`C`;`i`;`j -1`]);
50515 TYPE_THEN `{x | i <=| x /\ x <=| j} = {j} UNION {x | i <= x /\ x <= j- 1}` SUBAGOAL_TAC;
50516 IMATCH_MP_TAC EQ_EXT;
50517 REWRITE_TAC[UNION];
50518 UNDH 3810 THEN ARITH_TAC;
50520 USEH 6712 (REWRITE_RULE[IMAGE_UNION;image_sing;UNIONS_UNION]);
50521 USEH 7737 (REWRITE_RULE[SUBSET;UNION;UNIONS;IMAGE]);
50522 REWRITE_TAC[SUBSET;UNIONS;IMAGE];
50524 UNDH 3810 THEN ARITH_TAC;
50526 UNDH 5153 THEN ARITH_TAC;
50527 CONV_TAC (dropq_conv "u");
50533 USEH 2468 (CONV_RULE NAME_CONFLICT_CONV);
50535 TYPE_THEN `G j x` ASM_CASES_TAC;
50538 TYPE_THEN `k` EXISTS_TAC;
50539 UNDH 9304 THEN MESON_TAC[ARITH_RULE `a <| b ==> a <=| b - 1`];
50542 UNDH 7805 THEN UNDH 3810 THEN ARITH_TAC;
50544 TYPE_THEN `Ci = {e | C e /\ G i e /\ (!k. i <| k /\ k <=| j ==> ~G k e)}` ABBREV_TAC ;
50545 TYPE_THEN `Ci ei` SUBAGOAL_TAC;
50546 TYPE_THEN `Ci` UNABBREV_TAC;
50549 TYPE_THEN `CiS = segment_of Ci ei` ABBREV_TAC ;
50550 TYPE_THEN `segment CiS` SUBAGOAL_TAC;
50551 TYPE_THEN `CiS` UNABBREV_TAC;
50552 IMATCH_MP_TAC segment_of_segment;
50553 TYPE_THEN `C` EXISTS_TAC;
50555 IMATCH_MP_TAC rectagon_segment;
50556 TYPE_THEN `Ci` UNABBREV_TAC;
50557 REWRITE_TAC[SUBSET];
50559 TYPE_THEN `~Ci ej` SUBAGOAL_TAC THENL [TYPE_THEN `Ci` UNABBREV_TAC;ALL_TAC];
50561 UNDH 375 THEN ASM_REWRITE_TAC[];
50562 UNDH 3810 THEN ARITH_TAC;
50564 TYPE_THEN `CiS SUBSET Ci` SUBAGOAL_TAC;
50565 TYPE_THEN `CiS` UNABBREV_TAC;
50566 IMATCH_MP_TAC segment_of_G;
50568 TYPE_THEN `psegment CiS` SUBAGOAL_TAC;
50569 PROOF_BY_CONTR_TAC;
50570 THM_INTRO_TAC[`CiS`;`C`] rectagon_subset;
50571 USEH 5119 (REWRITE_RULE[psegment]);
50574 IMATCH_MP_TAC rectagon_segment;
50575 IMATCH_MP_TAC SUBSET_TRANS;
50576 TYPE_THEN `Ci` EXISTS_TAC;
50577 TYPE_THEN `Ci` UNABBREV_TAC;
50578 REWRITE_TAC[SUBSET];
50579 TYPE_THEN `C` UNABBREV_TAC;
50580 USEH 2712 (REWRITE_RULE[SUBSET]);
50581 UNDH 7665 THEN REWRITE_TAC[];
50583 THM_INTRO_TAC[`CiS`] endpoint_size2;
50584 FULL_REWRITE_TAC[has_size2];
50587 TYPE_THEN `Ci SUBSET C` SUBAGOAL_TAC;
50588 TYPE_THEN `Ci` UNABBREV_TAC;
50589 REWRITE_TAC[SUBSET];
50590 TYPE_THEN `CiS SUBSET C` SUBAGOAL_TAC;
50591 IMATCH_MP_TAC SUBSET_TRANS;
50592 TYPE_THEN `Ci` EXISTS_TAC;
50594 TYPE_THEN `!m. endpoint CiS m ==> cls (G (SUC i)) m` SUBAGOAL_TAC;
50595 THM_INTRO_TAC[`CiS`;`C`;`m`] endpoint_sub_rectagon;
50596 USEH 5941 (REWRITE_RULE[EXISTS_UNIQUE_ALT]);
50598 TYPE_THEN `e` EXISTS_TAC;
50600 USEH 3634 (REWRITE_RULE[cls_edge]);
50602 KILLH 3313 THEN KILLH 5237 THEN KILLH 2072 THEN KILLH 4795 THEN KILLH 3667 THEN KILLH 8912;
50604 TYPE_THEN `~Ci e` SUBAGOAL_TAC;
50605 KILLH 5989 THEN KILLH 9803 THEN KILLH 1909 THEN KILLH 8416 THEN KILLH 320 THEN KILLH 846;
50606 THM_INTRO_TAC[`Ci`;`ei`] inductive_segment;
50607 FULL_REWRITE_TAC[inductive_set];
50608 USEH 7070 (REWRITE_RULE[endpoint]);
50609 THM_INTRO_TAC[`CiS`;`pointI m`] num_closure1;
50610 FULL_REWRITE_TAC[segment];
50612 UNDH 8549 THEN DISCH_THEN (THM_INTRO_TAC[`e'`;`e`]);
50613 REWRITE_TAC[adj;INTER;EMPTY_EXISTS];
50617 TYPE_THEN `e'` UNABBREV_TAC;
50618 UNDH 9580 THEN ASM_REWRITE_TAC[];
50619 TYPE_THEN `pointI m` EXISTS_TAC;
50620 TYPE_THEN `CiS` UNABBREV_TAC;
50621 UNDH 1420 THEN ASM_REWRITE_TAC[];
50623 TYPE_THEN `UNIONS (IMAGE G {x | i <=| x /\ x <=| j}) e` SUBAGOAL_TAC;
50624 USEH 1849 (REWRITE_RULE[SUBSET]);
50625 USEH 9077 (REWRITE_RULE[UNIONS;IMAGE]);
50626 TYPE_THEN `u` UNABBREV_TAC;
50628 TYPE_THEN `!y. (SUC i < y) /\ (y <=| N) ==> ~(G y e)` SUBAGOAL_TAC;
50629 UNDH 4928 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`y`]);
50630 UNDH 8692 THEN ARITH_TAC;
50631 USEH 6879 (REWRITE_RULE[INTER;EQ_EMPTY]);
50632 TSPECH `{(pointI m)}` 6278;
50633 TYPE_THEN `!r. (r <=| N) ==> (G r SUBSET UNIONS (IMAGE G {i | i <=| N}))` SUBAGOAL_TAC;
50634 REWRITE_TAC[UNIONS;IMAGE;SUBSET];
50635 CONV_TAC (dropq_conv "u");
50636 TYPE_THEN `r` EXISTS_TAC;
50638 TYPE_THEN `!r. (r <=| N) ==> (curve_cell (G r) {(pointI m)} <=> (?e. G r e /\ closure top2 e (pointI m)))` SUBAGOAL_TAC;
50639 IMATCH_MP_TAC curve_cell_point;
50640 USEH 2858 (REWRITE_RULE[conn2;]);
50641 IMATCH_MP_TAC FINITE_SUBSET;
50644 TYPE_THEN `i <=| N` SUBAGOAL_TAC;
50645 UNDH 3810 THEN UNDH 5153 THEN ARITH_TAC;
50646 UNDH 4794 THEN ASM_REWRITE_TAC[];
50648 USEH 7070 (REWRITE_RULE[endpoint]);
50649 THM_INTRO_TAC[`CiS`;`pointI m`] num_closure1;
50650 IMATCH_MP_TAC FINITE_SUBSET;
50651 TYPE_THEN `C` EXISTS_TAC;
50652 FULL_REWRITE_TAC[rectagon];
50654 TYPE_THEN `e'` EXISTS_TAC;
50657 TYPE_THEN `Ci` UNABBREV_TAC;
50658 USEH 2281 (REWRITE_RULE[SUBSET]);
50660 TYPE_THEN `e` EXISTS_TAC;
50662 PROOF_BY_CONTR_TAC;
50663 USEH 1849 (REWRITE_RULE[UNIONS;IMAGE;SUBSET]);
50665 FULL_REWRITE_TAC[];
50666 TYPE_THEN `u'` UNABBREV_TAC;
50667 TYPE_THEN `x' = i` ASM_CASES_TAC;
50668 TYPE_THEN `x'` UNABBREV_TAC;
50669 TYPE_THEN `Ci` UNABBREV_TAC;
50670 UNDH 8814 THEN ASM_REWRITE_TAC[];
50672 TYPE_THEN `k = SUC i` ASM_CASES_TAC;
50673 UNDH 9079 THEN ASM_REWRITE_TAC[];
50674 TYPE_THEN `k` UNABBREV_TAC;
50675 UNDH 5461 THEN ASM_REWRITE_TAC[];
50676 UNDH 9872 THEN UNDH 5198 THEN UNDH 2528 THEN UNDH 5153 THEN ARITH_TAC;
50678 TYPE_THEN `x' = SUC i` ASM_CASES_TAC;
50679 TYPE_THEN `x'` UNABBREV_TAC;
50680 UNDH 9079 THEN ASM_REWRITE_TAC[];
50682 UNDH 7878 THEN ASM_REWRITE_TAC[];
50683 UNDH 9481 THEN UNDH 5258 THEN UNDH 5565 THEN UNDH 6996 THEN UNDH 5153 THEN ARITH_TAC;
50686 UNDH 9674 THEN DISCH_THEN (THM_INTRO_TAC[`b`]);
50689 UNDH 9674 THEN DISCH_THEN (THM_INTRO_TAC[`a`]);
50693 TYPE_THEN `X = { E | E SUBSET (C UNION (G (SUC i))) /\ ~(E ei) /\ ~(E ej) /\ segment_end E a b }` ABBREV_TAC ;
50694 TYPE_THEN `~(X = EMPTY)` SUBAGOAL_TAC THENL [REWRITE_TAC[EMPTY_EXISTS];ALL_TAC];
50695 TYPE_THEN `X` UNABBREV_TAC;
50696 UNDH 8912 THEN DISCH_THEN (THM_INTRO_TAC[`SUC i`]);
50697 UNDH 3810 THEN UNDH 5153 THEN ARITH_TAC;
50698 THM_INTRO_TAC[`G (SUC i)`] conn2_imp_conn;
50699 FIRST_ASSUM IMATCH_MP_TAC ;
50700 UNDH 3810 THEN UNDH 5153 THEN ARITH_TAC;
50701 FULL_REWRITE_TAC[conn];
50702 UNDH 6247 THEN DISCH_THEN (THM_INTRO_TAC[`a`;`b`]);
50703 TYPE_THEN `S` EXISTS_TAC;
50705 IMATCH_MP_TAC SUBSET_TRANS;
50706 TYPE_THEN `G (SUC i)` EXISTS_TAC;
50707 REWRITE_TAC[SUBSET;UNION ];
50708 TSPECH `SUC i` 320;
50709 TSPECH `SUC i` 9803;
50710 UNDH 8789 THEN DISCH_THEN (THM_INTRO_TAC[]);
50711 UNDH 3810 THEN ARITH_TAC;
50712 UNDH 5005 THEN DISCH_THEN (THM_INTRO_TAC[]);
50714 PROOF_BY_CONTR_TAC;
50715 FULL_REWRITE_TAC[DE_MORGAN_THM];
50716 USEH 1620 (REWRITE_RULE[SUBSET]);
50717 FIRST_ASSUM DISJ_CASES_TAC;
50718 UNDH 4837 THEN REWRITE_TAC[] THEN FIRST_ASSUM IMATCH_MP_TAC ;
50719 UNDH 683 THEN REWRITE_TAC[] THEN FIRST_ASSUM IMATCH_MP_TAC ;
50720 TYPE_THEN `f = (\ E . CARD (E DIFF C))` ABBREV_TAC ;
50721 THM_INTRO_TAC[`X`;`f`] select_image_num_min;
50722 UNDH 6007 THEN ASM_REWRITE_TAC[];
50723 TYPE_THEN `E = z` ABBREV_TAC ;
50724 TYPE_THEN `z` UNABBREV_TAC;
50726 TYPE_THEN `cls C a /\ cls C b` SUBAGOAL_TAC;
50727 TYPE_THEN `cls CiS SUBSET cls C` SUBAGOAL_TAC;
50728 IMATCH_MP_TAC cls_subset;
50729 USEH 2127 (REWRITE_RULE[SUBSET]);
50730 THM_INTRO_TAC[`CiS`] endpoint_cls;
50731 USEH 214 (REWRITE_RULE[psegment;segment]);
50732 USEH 477 (REWRITE_RULE[SUBSET]);
50733 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC ) THEN (FIRST_ASSUM IMATCH_MP_TAC ) THEN (TYPE_THEN `endpoint CiS` UNABBREV_TAC) THEN REWRITE_TAC[INR in_pair];
50735 THM_INTRO_TAC[`C`;`a`;`b`] cut_rectagon_cls;
50736 TYPE_THEN `segment_end CiS a b` SUBAGOAL_TAC;
50737 REWRITE_TAC[segment_end];
50738 TYPE_THEN `?CjS. (cls (CjS) INTER cls CiS = {a,b}) /\ (CiS INTER CjS = EMPTY) /\ (C = CiS UNION CjS) /\ segment_end CjS a b ` SUBAGOAL_TAC;
50739 THM_INTRO_TAC[`C`;`A`;`B`;`CiS`;`a`;`b`] cut_rectagon_unique;
50740 REWRITE_TAC[SUBSET;UNION];
50741 FIRST_ASSUM DISJ_CASES_TAC ;
50742 TYPE_THEN `A` UNABBREV_TAC;
50743 TYPE_THEN `B` EXISTS_TAC;
50745 FULL_REWRITE_TAC[INTER_COMM];
50747 TYPE_THEN `B` UNABBREV_TAC;
50748 TYPE_THEN `A` EXISTS_TAC;
50750 FULL_REWRITE_TAC[INTER_COMM;UNION_COMM;];
50751 KILLH 7539 THEN KILLH 8335 THEN KILLH 2130 THEN KILLH 6524 THEN KILLH 3863;
50753 TYPE_THEN `CjS ej` SUBAGOAL_TAC;
50754 TYPE_THEN `C` UNABBREV_TAC;
50755 USEH 2238 (REWRITE_RULE[UNION ]);
50756 UNDH 3048 THEN UNDH 2712 THEN UNDH 7665 THEN (POP_ASSUM_LIST (fun t-> ALL_TAC ));
50757 USEH 2712 (REWRITE_RULE[SUBSET]);
50760 TYPE_THEN `CiS ei` SUBAGOAL_TAC;
50761 TYPE_THEN `CiS` UNABBREV_TAC;
50762 REWRITE_TAC[segment_of_in];
50763 TYPE_THEN `~CjS ei` SUBAGOAL_TAC;
50764 UNDH 947 THEN UNDH 1398 THEN UNDH 3558 THEN REWRITE_TAC[INTER;EQ_EMPTY] THEN MESON_TAC[];
50766 TYPE_THEN `~(E SUBSET C)` SUBAGOAL_TAC;
50767 TYPE_THEN `X` UNABBREV_TAC;
50768 THM_INTRO_TAC[`C`;`CiS`;`CjS`;`E`;`a`;`b`] cut_rectagon_unique;
50769 REWRITE_TAC[SUBSET;UNION];
50770 FIRST_ASSUM DISJ_CASES_TAC;
50771 TYPE_THEN `E` UNABBREV_TAC;
50772 UNDH 5338 THEN ASM_REWRITE_TAC[];
50773 TYPE_THEN `E` UNABBREV_TAC;
50774 UNDH 442 THEN ASM_REWRITE_TAC[];
50776 THM_INTRO_TAC[`C`;`E`] conn2_sequence_lemma5;
50779 TYPE_THEN `X` UNABBREV_TAC;
50780 USEH 7614 (REWRITE_RULE[segment_end]);
50781 TYPE_THEN `X` UNABBREV_TAC;
50782 USEH 7614 (REWRITE_RULE[segment_end]);
50783 REWRITE_TAC[SUBSET;INR in_pair];
50784 FIRST_ASSUM (DISJ_CASES_TAC ) THEN (TYPE_THEN `x` UNABBREV_TAC);
50786 THM_INTRO_TAC[`E'`] endpoint_size2;
50787 FULL_REWRITE_TAC[has_size2];
50789 TYPE_THEN `?E''. E'' SUBSET C /\ ~E'' ei /\ ~E'' ej /\ segment_end E'' a' b'` ASM_CASES_TAC;
50790 UNDH 3844 THEN UNDH 6993 THEN UNDH 1260 THEN UNDH 6943 THEN UNDH 8389 THEN UNDH 2907 THEN UNDH 6174 THEN UNDH 7802 THEN UNDH 4430 THEN UNDH 5435 THEN UNDH 7079 THEN UNDH 2483 THEN UNDH 1489 THEN UNDH 9777 THEN (POP_ASSUM_LIST (fun t-> ALL_TAC));
50792 TYPE_THEN `X` UNABBREV_TAC;
50793 TYPE_THEN `f` UNABBREV_TAC;
50795 THM_INTRO_TAC[`E`;`E'`;`E''`;`a`;`b`;`a'`;`b'`] conn_splice;
50796 REWRITE_TAC[segment_end];
50798 UNDH 8902 THEN DISCH_THEN (THM_INTRO_TAC[]);
50800 IMATCH_MP_TAC SUBSET_TRANS;
50801 TYPE_THEN `E UNION E''` EXISTS_TAC ;
50803 UNDH 280 THEN REWRITE_TAC[SUBSET;DIFF;UNION] THEN MESON_TAC[];
50804 REWRITE_TAC[union_subset];
50805 UNDH 6943 THEN REWRITE_TAC[SUBSET;UNION];
50806 TYPE_THEN `B' SUBSET E UNION E''` SUBAGOAL_TAC;
50807 UNDH 280 THEN REWRITE_TAC[DIFF;SUBSET;UNION] THEN MESON_TAC[];
50808 USEH 9489 (REWRITE_RULE[SUBSET;UNION]);
50813 TYPE_THEN `B' DIFF C SUBSET (E DIFF E') DIFF C` SUBAGOAL_TAC;
50814 UNDH 280 THEN UND 3 THEN REWRITE_TAC[SUBSET;DIFF;UNION;] THEN MESON_TAC[];
50815 USEH 8272 (MATCH_MP (ARITH_RULE `x <=| y ==> ~(y < x)`));
50816 UNDH 200 THEN ASM_REWRITE_TAC[];
50817 IMATCH_MP_TAC card_subset_lt;
50819 UNDH 8308 THEN (REWRITE_TAC[DIFF;SUBSET]) THEN MESON_TAC[];
50821 USEH 7143 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
50822 TYPE_THEN `~(E' = EMPTY)` SUBAGOAL_TAC ;
50823 USEH 4430 (REWRITE_RULE[psegment;segment]);
50824 UNDH 5706 THEN ASM_REWRITE_TAC[];
50825 USEH 5706 (REWRITE_RULE[EMPTY_EXISTS]);
50827 USEH 9707 (REWRITE_RULE[DIFF]);
50828 USEH 7802 (REWRITE_RULE[INTER;EQ_EMPTY]);
50830 UNDH 366 THEN ASM_REWRITE_TAC[];
50831 PROOF_BY_CONTR_TAC;
50833 USEH 8308 (REWRITE_RULE[SUBSET;DIFF;]);
50835 USEH 5435 (REWRITE_RULE[SUBSET]);
50839 IMATCH_MP_TAC FINITE_SUBSET;
50840 TYPE_THEN `E` EXISTS_TAC;
50841 REWRITE_TAC[DIFF;SUBSET];
50842 USEH 7614 (REWRITE_RULE[segment_end;segment;psegment]);
50843 (* -J< // (57 HYP here ) *)
50844 (* KILLH 846 THEN KILLH 1909 THEN KILLH 5989; ?? *)
50845 KILLH 9203 THEN KILLH 4704 THEN KILLH 3558 THEN KILLH 3114 THEN KILLH 5443 THEN KILLH 7079 THEN KILLH 1489 THEN KILLH 6007 THEN KILLH 9461 THEN KILLH 4797 THEN KILLH 8662 THEN KILLH 214;
50846 KILLH 4596 THEN KILLH 947 THEN KILLH 5282;
50848 TYPE_THEN `E' SUBSET C UNION (G (SUC i))` SUBAGOAL_TAC;
50849 IMATCH_MP_TAC SUBSET_TRANS;
50850 TYPE_THEN `E` EXISTS_TAC;
50851 TYPE_THEN `X` UNABBREV_TAC;
50853 TYPE_THEN `E' SUBSET (G (SUC i))` SUBAGOAL_TAC;
50854 UNDH 7718 THEN UNDH 7802 THEN REWRITE_TAC[EQ_EMPTY;INTER;SUBSET;UNION] THEN MESON_TAC[];
50856 KILLH 7292 THEN KILLH 4330 THEN KILLH 4248 THEN KILLH 2712 THEN KILLH 7665 THEN KILLH 5425 THEN KILLH 5357 THEN KILLH 1285;
50857 KILLH 145 THEN KILLH 7070 THEN KILLH 2483 THEN KILLH 9777;
50861 TYPE_THEN `cls C a' /\ cls C b'` SUBAGOAL_TAC;
50862 TYPE_THEN ` endpoint E' SUBSET cls C` SUBAGOAL_TAC;
50865 TYPE_THEN `endpoint E'` UNABBREV_TAC;
50866 REWRITE_TAC[SUBSET;INTER];
50868 USEH 6207 (REWRITE_RULE[SUBSET;INR in_pair]);
50869 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC ;
50871 TYPE_THEN `?A B. segment_end A a' b' /\ segment_end B a' b' /\ (C = A UNION B) /\ (A INTER B = EMPTY) /\ (cls A INTER cls B = {a',b'}) /\ (A ei) /\ (B ej)` SUBAGOAL_TAC;
50872 THM_INTRO_TAC[`C`;`a'`;`b'`] cut_rectagon_cls;
50873 TYPE_THEN `A ei` ASM_CASES_TAC;
50874 TYPE_THEN `A` EXISTS_TAC;
50875 TYPE_THEN `B` EXISTS_TAC;
50876 FULL_REWRITE_TAC[INTER_COMM];
50879 UNDH 469 THEN ASM_REWRITE_TAC[];
50880 FULL_REWRITE_TAC[DE_MORGAN_THM];
50881 UNDH 7424 THEN REP_CASES_TAC;
50882 PROOF_BY_CONTR_TAC;
50883 UNDH 3642 THEN REWRITE_TAC[SUBSET;UNION];
50884 USEH 8335 (REWRITE_RULE[INTER;EQ_EMPTY]);
50886 UNDH 8511 THEN ASM_REWRITE_TAC[];
50888 TYPE_THEN `B` EXISTS_TAC;
50889 TYPE_THEN `A` EXISTS_TAC;
50890 FULL_REWRITE_TAC[INTER_COMM;UNION_COMM];
50892 UNDH 4532 THEN (TYPE_THEN `C` UNABBREV_TAC) THEN ASM_REWRITE_TAC[UNION];
50895 PROOF_BY_CONTR_TAC;
50896 UNDH 937 THEN ASM_REWRITE_TAC[];
50897 REWRITE_TAC[SUBSET;UNION];
50900 TYPE_THEN `~(G (SUC i) ei)` SUBAGOAL_TAC THENL [FIRST_ASSUM IMATCH_MP_TAC ;ALL_TAC];
50901 UNDH 3810 THEN ARITH_TAC;
50902 TYPE_THEN `~(G (SUC i) ej)` SUBAGOAL_TAC THENL [FIRST_ASSUM IMATCH_MP_TAC ;ALL_TAC];
50905 TYPE_THEN `psegment_triple A B E'` SUBAGOAL_TAC;
50906 UNDH 830 THEN UNDH 8335 THEN UNDH 2130 THEN UNDH 4401 THEN UNDH 3688 THEN UNDH 8389 THEN UNDH 2907 THEN UNDH 6174 THEN UNDH 7802 THEN UNDH 4430 THEN UNDH 5107 THEN (POP_ASSUM_LIST (fun t-> ALL_TAC));
50907 FULL_REWRITE_TAC[psegment_triple;segment_end];
50909 TYPE_THEN `C` UNABBREV_TAC;
50910 TYPE_THEN `(A INTER E' = EMPTY) /\ (B INTER E' = EMPTY)` SUBAGOAL_TAC;
50911 TYPE_THEN `C` UNABBREV_TAC;
50912 UNDH 7714 THEN REWRITE_TAC[EQ_EMPTY;INTER;UNION] THEN MESON_TAC[];
50914 TYPE_THEN `(cls A INTER cls E' = {a',b'}) /\ (cls B INTER cls E' = {a',b'})` SUBAGOAL_TAC;
50915 TYPE_THEN `C` UNABBREV_TAC;
50916 USEH 9349 (REWRITE_RULE[cls_union]);
50917 CONJ_TAC THEN (IMATCH_MP_TAC SUBSET_ANTISYM);
50919 TYPE_THEN `endpoint E'` UNABBREV_TAC;
50920 TYPE_THEN `{a',b'}` UNABBREV_TAC;
50921 REWRITE_TAC[INTER;SUBSET;UNION];
50922 REWRITE_TAC[SUBSET_INTER];
50925 TYPE_THEN `{a',b'}` UNABBREV_TAC;
50926 REWRITE_TAC[INTER;SUBSET];
50927 TYPE_THEN `{a',b'}` UNABBREV_TAC;
50928 IMATCH_MP_TAC endpoint_cls;
50929 FULL_REWRITE_TAC[psegment;segment];
50931 TYPE_THEN `{a',b'}` UNABBREV_TAC;
50932 TYPE_THEN `endpoint E'` UNABBREV_TAC;
50933 REWRITE_TAC[INTER;SUBSET;UNION];
50934 REWRITE_TAC[SUBSET_INTER];
50937 IMATCH_MP_TAC endpoint_cls;
50938 USEH 4134 (REWRITE_RULE[psegment;segment]);
50940 IMATCH_MP_TAC endpoint_cls;
50941 USEH 4430 (REWRITE_RULE[psegment;segment]);
50942 CONJ_TAC THEN IMATCH_MP_TAC segment_end_union_rectagon;
50943 FULL_REWRITE_TAC[segment_end];
50945 FULL_REWRITE_TAC[segment_end];
50948 USEH 2518 (MATCH_MP psegment_triple3);
50950 USEH 7680 (MATCH_MP bounded_triple_inner_union);
50951 USEH 3265 (REWRITE_RULE [SUBSET]);
50952 (* TSPEC p deferred ///// *)
50954 TYPE_THEN `~(bounded_set (B UNION E') p)` SUBAGOAL_TAC;
50955 UNDH 3313 THEN DISCH_THEN (THM_INTRO_TAC[`B UNION E'`;`i`;`j`]);
50957 FULL_REWRITE_TAC[psegment_triple];
50959 UNDH 3810 THEN ARITH_TAC;
50960 IMATCH_MP_TAC SUBSET_TRANS;
50961 TYPE_THEN `C UNION E'` EXISTS_TAC ;
50963 REWRITE_TAC[UNION;SUBSET] THEN MESON_TAC[];
50964 TYPE_THEN `A UNION B` UNABBREV_TAC;
50965 REWRITE_TAC[union_subset];
50966 REWRITE_TAC[SUBSET;UNIONS;IMAGE];
50967 CONV_TAC (dropq_conv "u");
50968 TYPE_THEN `SUC i` EXISTS_TAC;
50969 USEH 343 (REWRITE_RULE[SUBSET]);
50970 UNDH 3810 THEN ARITH_TAC;
50972 USEH 1598 (MATCH_MP (ARITH_RULE `x <=| y ==> ~(y < x)`));
50973 UNDH 5101 THEN REWRITE_TAC[];
50974 IMATCH_MP_TAC card_subset_lt;
50976 UNDH 343 THEN REWRITE_TAC[SUBSET;DIFF;UNION] THEN MESON_TAC[];
50978 USEH 7390 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
50980 USEH 4016 (REWRITE_RULE[UNION;DIFF]);
50981 UNDH 1090 THEN ASM_REWRITE_TAC[];
50982 FIRST_ASSUM DISJ_CASES_TAC;
50983 UNDH 8335 THEN ASM_REWRITE_TAC[EMPTY_EXISTS;INTER];
50984 TYPE_THEN `ei` EXISTS_TAC;
50985 UNDH 4837 THEN ASM_REWRITE_TAC[];
50986 ASM_MESON_TAC[subset_imp];
50987 IMATCH_MP_TAC FINITE_SUBSET;
50988 TYPE_THEN `A UNION B` EXISTS_TAC;
50991 USEH 5107 (REWRITE_RULE[rectagon]);
50992 REWRITE_TAC[SUBSET;DIFF];
50994 TYPE_THEN `~(bounded_set (E' UNION A) p)` SUBAGOAL_TAC;
50995 UNDH 3313 THEN DISCH_THEN (THM_INTRO_TAC[`E' UNION A`;`i`;`j`]);
50997 FULL_REWRITE_TAC[psegment_triple];
50999 UNDH 3810 THEN ARITH_TAC;
51000 IMATCH_MP_TAC SUBSET_TRANS;
51001 TYPE_THEN `E' UNION C` EXISTS_TAC ;
51003 REWRITE_TAC[UNION;SUBSET] THEN MESON_TAC[];
51004 TYPE_THEN `A UNION B` UNABBREV_TAC;
51005 REWRITE_TAC[union_subset];
51006 REWRITE_TAC[SUBSET;UNIONS;IMAGE];
51007 CONV_TAC (dropq_conv "u");
51008 TYPE_THEN `SUC i` EXISTS_TAC;
51009 USEH 343 (REWRITE_RULE[SUBSET]);
51010 UNDH 3810 THEN ARITH_TAC;
51012 USEH 4752 (MATCH_MP (ARITH_RULE `x <=| y ==> ~(y < x)`));
51013 UNDH 2448 THEN REWRITE_TAC[];
51014 IMATCH_MP_TAC card_subset_lt;
51016 UNDH 343 THEN REWRITE_TAC[SUBSET;DIFF;UNION] THEN MESON_TAC[];
51018 USEH 758 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
51020 USEH 5076 (REWRITE_RULE[UNION;DIFF]);
51021 UNDH 5580 THEN ASM_REWRITE_TAC[];
51022 USEH 3977 (MATCH_MP (TAUT `a \/ b ==> b\/ a`));
51023 FIRST_ASSUM DISJ_CASES_TAC;
51024 UNDH 8335 THEN ASM_REWRITE_TAC[EMPTY_EXISTS;INTER];
51025 TYPE_THEN `ej` EXISTS_TAC;
51026 UNDH 683 THEN ASM_REWRITE_TAC[];
51027 ASM_MESON_TAC[subset_imp];
51028 IMATCH_MP_TAC FINITE_SUBSET;
51029 TYPE_THEN `A UNION B` EXISTS_TAC;
51032 USEH 5107 (REWRITE_RULE[rectagon]);
51033 REWRITE_TAC[SUBSET;DIFF];
51035 KILLH 3313 THEN KILLH 4532 THEN KILLH 846 THEN KILLH 320 THEN KILLH 8416 THEN KILLH 1909 THEN KILLH 9803 THEN KILLH 5989 THEN KILLH 4430 THEN KILLH 7802 THEN KILLH 6174 THEN KILLH 2907;
51036 KILLH 683 THEN KILLH 4837 THEN KILLH 3627 THEN KILLH 2590 THEN KILLH 830 THEN KILLH 8335 THEN KILLH 4401 THEN KILLH 3688;
51037 POP_ASSUM_LIST (fun t-> EVERY (map MP_TAC t));
51039 TYPE_THEN `bounded_set (B UNION E' UNION A) p` SUBAGOAL_TAC;
51040 IMATCH_MP_TAC bounded_avoidance_subset;
51041 TYPE_THEN `C` EXISTS_TAC;
51043 REWRITE_TAC[SUBSET;UNION] THEN MESON_TAC[];
51045 REWRITE_TAC[union_subset];
51046 USEH 7680 (REWRITE_RULE[psegment_triple;segment_end;segment;psegment]);
51048 REWRITE_TAC[FINITE_UNION];
51049 USEH 7680 (REWRITE_RULE[psegment_triple;segment_end;segment;psegment]);
51051 TYPE_THEN `A UNION B` UNABBREV_TAC;
51052 IMATCH_MP_TAC conn2_rectagon;
51054 UNDH 8721 THEN REWRITE_TAC[] THEN (IMATCH_MP_TAC bounded_set_curve_cell_empty);
51055 TYPE_THEN `UNIONS (IMAGE G {i | i <=| N})` EXISTS_TAC;
51056 TYPE_THEN `B UNION E' UNION A = E' UNION C` SUBAGOAL_TAC;
51057 REWRITE_TAC[UNION_ACI ];
51058 REWRITE_TAC[union_subset];
51060 REWRITE_TAC[SUBSET;UNIONS;IMAGE];
51061 CONV_TAC (dropq_conv "u");
51062 TYPE_THEN `(SUC i)` EXISTS_TAC;
51063 USEH 343 (REWRITE_RULE[SUBSET]);
51064 UNDH 3810 THEN UNDH 5153 THEN ARITH_TAC;
51065 TYPE_THEN `A UNION B` UNABBREV_TAC;
51066 IMATCH_MP_TAC SUBSET_TRANS;
51068 IMATCH_MP_TAC UNIONS_UNIONS;
51069 REWRITE_TAC[IMAGE;SUBSET];
51070 TYPE_THEN `x` UNABBREV_TAC;
51071 TYPE_THEN `x'` EXISTS_TAC;
51072 UNDH 6996 THEN UNDH 5153 THEN ARITH_TAC;
51074 USEH 1588 (ONCE_REWRITE_RULE[UNION]);
51075 USEH 6893 (REWRITE_RULE[]);
51077 (* Tue Dec 28 15:56:13 EST 2004 *)
51081 (* ------------------------------------------------------------------ *)
51083 (* ------------------------------------------------------------------ *)
51086 (* finish proof of the connectedness of the complement of an arc *)
51088 let real_div_denom = prove_by_refinement(
51089 `!z x y . (&0 < z) ==> ((x/ z <= y/ z) <=> (x <= y))`,
51093 ASM_SIMP_TAC[REAL_LE_LDIV_EQ];
51094 ONCE_REWRITE_TAC[REAL_ARITH `x*y = y*x`];
51095 REWRITE_TAC[GSYM real_div_assoc];
51096 ASM_SIMP_TAC[REAL_LE_RDIV_EQ];
51097 FULL_REWRITE_TAC[REAL_MUL_AC];
51098 IMATCH_MP_TAC REAL_LE_RMUL_EQ;
51102 let real_div_denom_lt = prove_by_refinement(
51103 `!z x y . (&0 < z) ==> ((x/ z < y/ z) <=> (x < y))`,
51107 ASM_SIMP_TAC[REAL_LT_LDIV_EQ];
51108 ONCE_REWRITE_TAC[REAL_ARITH `x*y = y*x`];
51109 REWRITE_TAC[GSYM real_div_assoc];
51110 ASM_SIMP_TAC[REAL_LT_RDIV_EQ];
51111 FULL_REWRITE_TAC[REAL_MUL_AC];
51112 IMATCH_MP_TAC REAL_LT_RMUL_EQ;
51116 let simple_arc_constants = prove_by_refinement(
51117 `!C p q. simple_arc top2 C /\ ~C p /\ ~C q /\
51118 euclid 2 p /\ euclid 2 q ==>
51119 (?d N B a d'. (&0 <. d) /\ (&0 <. d') /\ (0 < N) /\
51120 (!i. (i <| N) ==> simple_arc_end (B i) (a i) (a (SUC i))) /\
51121 (C = UNIONS (IMAGE B {i | i <| N})) /\
51123 (&8 * d <= d_euclid x p) /\ (&8 * d <= d_euclid x q)) /\
51124 (!i j x y. (SUC i < j) /\ (j <| N) /\ B i x /\ B j y ==>
51125 (&16 * d' < d_euclid x y)) /\
51127 (?x. B i x /\ B i SUBSET (open_ball (euclid 2,d_euclid) x d))))
51132 THM_INTRO_TAC[`C`]simple_arc_compact;
51133 THM_INTRO_TAC[`2`] metric_euclid;
51134 THM_INTRO_TAC[`C`] simple_arc_nonempty;
51135 THM_INTRO_TAC[`top2`] compact_point;
51136 FULL_REWRITE_TAC[top2_unions];
51137 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`C`;`{p}`] compact_distance;
51138 FULL_REWRITE_TAC[top2];
51139 REWRITE_TAC[EMPTY_EXISTS];
51141 FULL_REWRITE_TAC[INR IN_SING];
51142 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`C`;`{q}`] compact_distance;
51143 FULL_REWRITE_TAC[top2];
51144 REWRITE_TAC[EMPTY_EXISTS];
51146 FULL_REWRITE_TAC[INR IN_SING];
51148 TYPE_THEN `p''''` UNABBREV_TAC;
51149 TYPE_THEN `p''` UNABBREV_TAC;
51150 TYPE_THEN `d = (min_real (d_euclid p''' q) (d_euclid p' p))/(&8)` ABBREV_TAC ;
51151 TYPE_THEN `d` EXISTS_TAC;
51152 TYPE_THEN `&0 < d` SUBAGOAL_TAC;
51153 TYPE_THEN `d` UNABBREV_TAC;
51154 IMATCH_MP_TAC REAL_LT_DIV;
51155 ASSUME_TAC (REAL_ARITH `&0 < &8`);
51156 REWRITE_TAC[min_real] ;
51157 THM_INTRO_TAC[`C`] simple_arc_euclid;
51159 IMATCH_MP_TAC d_euclid_pos2;
51160 TYPE_THEN `2` EXISTS_TAC;
51161 ASM_MESON_TAC[subset_imp];
51162 IMATCH_MP_TAC d_euclid_pos2;
51163 TYPE_THEN `2` EXISTS_TAC;
51164 ASM_MESON_TAC[subset_imp];
51166 TYPE_THEN `(!x. C x ==> &8 * d <= d_euclid x p /\ &8 * d <= d_euclid x q)` SUBAGOAL_TAC;
51167 TYPE_THEN `&8 * d = min_real (d_euclid p''' q) (d_euclid p' p)` SUBAGOAL_TAC;
51168 TYPE_THEN `d` UNABBREV_TAC;
51169 IMATCH_MP_TAC REAL_DIV_LMUL;
51170 UND 10 THEN REAL_ARITH_TAC ;
51171 UNDH 6289 THEN DISCH_THEN (THM_INTRO_TAC[`x`;`q`]);
51173 UNDH 4386 THEN DISCH_THEN (THM_INTRO_TAC[`x`;`p`]);
51175 THM_INTRO_TAC[`(d_euclid p''' q)`;`d_euclid p' p `] min_real_le;
51176 UNDH 4228 THEN UNDH 5042 THEN UNDH 8570 THEN UNDH 8336 THEN REAL_ARITH_TAC;
51177 KILLH 8745 THEN KILLH 6021 THEN KILLH 6289 THEN KILLH 371;
51178 KILLH 4386 THEN KILLH 6186;
51181 USEH 3550 (REWRITE_RULE[simple_arc]);
51182 FULL_REWRITE_TAC[top2_unions];
51183 THM_INTRO_TAC[`f`] simple_arc_uniformly_continuous;
51184 FULL_REWRITE_TAC[uniformly_continuous];
51186 FULL_REWRITE_TAC[];
51188 TYPE_THEN `?N. &1/delta <= &N` SUBAGOAL_TAC;
51189 REWRITE_TAC[REAL_ARCH_SIMPLE];
51190 TYPE_THEN `&0 < &N` SUBAGOAL_TAC;
51191 IMATCH_MP_TAC REAL_LTE_TRANS;
51193 TYPE_THEN `&1/ &N <= delta` SUBAGOAL_TAC;
51194 UNDH 338 THEN ASM_SIMP_TAC[REAL_LE_LDIV_EQ];
51195 FULL_REWRITE_TAC[REAL_MUL_AC];
51196 TYPE_THEN `N' = 2*N` ABBREV_TAC ;
51197 TYPE_THEN `&0 < &N'` SUBAGOAL_TAC;
51198 TYPE_THEN `N'` UNABBREV_TAC;
51199 FULL_REWRITE_TAC[REAL_OF_NUM_LT];
51200 UNDH 7562 THEN ARITH_TAC;
51202 TYPE_THEN `!r. (r <= &1/ (&N')) ==> (r < delta)` SUBAGOAL_TAC;
51203 TYPE_THEN `&1/ &N' < &1/ &N` SUBAGOAL_TAC;
51204 ASM_SIMP_TAC[REAL_LT_LDIV_EQ];
51205 ONCE_REWRITE_TAC[REAL_ARITH `x*y = y*x`];
51206 REWRITE_TAC[GSYM real_div_assoc];
51207 ASM_SIMP_TAC[REAL_LT_RDIV_EQ];
51208 TYPE_THEN `N'` UNABBREV_TAC;
51210 UNDH 5547 THEN REWRITE_TAC[REAL_OF_NUM_LT] THEN ARITH_TAC;
51211 UNDH 5945 THEN UNDH 3160 THEN UNDH 532 THEN REAL_ARITH_TAC;
51213 KILLH 1557 THEN KILLH 5945 THEN KILLH 5547 THEN KILLH 338;
51214 TYPE_THEN `N'` EXISTS_TAC;
51215 TYPE_THEN `B = (\ i. IMAGE f {x | (&i / &N') <= x /\ (x <= &(SUC i)/(&N'))} )` ABBREV_TAC ;
51216 TYPE_THEN `B` EXISTS_TAC;
51217 TYPE_THEN `a = (\ i. f(&i / &N'))` ABBREV_TAC ;
51218 TYPE_THEN `a` EXISTS_TAC;
51220 THM_INTRO_TAC[`&N'`] real_div_denom;
51223 TYPE_THEN `!x. (&0 <= x/ &N') <=> (&0 <= x)` SUBAGOAL_TAC;
51224 UNDH 5498 THEN DISCH_THEN (THM_INTRO_TAC[`&0`;`x`]);
51225 FULL_REWRITE_TAC[REAL_DIV_LZERO];
51227 TYPE_THEN `!x. (x/ &N' <= &1) <=> (x <= &N')` SUBAGOAL_TAC;
51228 UNDH 5498 THEN DISCH_THEN (THM_INTRO_TAC[`x`;`&N'`]);
51229 THM_INTRO_TAC[`&N'`] REAL_DIV_REFL;
51230 TYPE_THEN `&N'` UNABBREV_TAC;
51231 UNDH 869 THEN REAL_ARITH_TAC;
51234 TYPE_THEN `!i x. (i <| N') /\ (&i / &N' <= x) /\ (x <= &(SUC i) / &N') ==> (&0 <= x /\ x <= &1)` SUBAGOAL_TAC;
51235 TYPE_THEN `&0 <= &i / &N' /\ &(SUC i) / (&N') <= &1` BACK_TAC;
51236 UNDH 601 THEN UNDH 1707 THEN UNDH 167 THEN UNDH 1199 THEN REAL_ARITH_TAC;
51237 REWRITE_TAC[REAL_OF_NUM_LE];
51238 UNDH 9580 THEN ARITH_TAC;
51240 TYPE_THEN `(!i. i <| N' ==> (?x. B i x /\ B i SUBSET open_ball (euclid 2,d_euclid) x d))` SUBAGOAL_TAC;
51241 TYPE_THEN `a i` EXISTS_TAC;
51242 TYPE_THEN `a` UNABBREV_TAC;
51244 TYPE_THEN `B` UNABBREV_TAC;
51245 IMATCH_MP_TAC image_imp;
51246 ASM_REWRITE_TAC[REAL_OF_NUM_LE ];
51249 TYPE_THEN `B` UNABBREV_TAC;
51250 REWRITE_TAC[open_ball;IMAGE;SUBSET;];
51251 TYPE_THEN `x` UNABBREV_TAC;
51252 USEH 3550 (MATCH_MP simple_arc_euclid);
51253 TYPE_THEN `C` UNABBREV_TAC;
51254 USEH 3429 (REWRITE_RULE[SUBSET]);
51256 FIRST_ASSUM IMATCH_MP_TAC ;
51257 IMATCH_MP_TAC image_imp;
51258 ASM_REWRITE_TAC[REAL_OF_NUM_LE ];
51259 UNDH 9580 THEN ARITH_TAC;
51262 FIRST_ASSUM IMATCH_MP_TAC ;
51263 IMATCH_MP_TAC image_imp;
51264 FIRST_ASSUM IMATCH_MP_TAC ;
51265 TYPE_THEN `i` EXISTS_TAC;
51266 FIRST_ASSUM IMATCH_MP_TAC ;
51267 ASM_REWRITE_TAC[REAL_OF_NUM_LE];
51269 UNDH 9580 THEN ARITH_TAC;
51271 FIRST_ASSUM IMATCH_MP_TAC ;
51272 TYPE_THEN `i` EXISTS_TAC;
51273 REWRITE_TAC[d_real];
51274 TYPE_THEN `x' <= &i/ &N' + &1/ &N'` SUBAGOAL_TAC;
51275 UNDH 3570 THEN REWRITE_TAC[REAL];
51276 REWRITE_TAC[real_div;GSYM REAL_ADD_RDISTRIB];
51277 REWRITE_TAC[GSYM real_div];
51278 FIRST_ASSUM IMATCH_MP_TAC ;
51279 UNDH 4551 THEN UNDH 1464 THEN REAL_ARITH_TAC;
51280 KILLH 8623 THEN KILLH 2193;
51281 KILLH 626 THEN KILLH 4538;
51283 TYPE_THEN `!i. &i / &N' < &(SUC i)/ &N'` SUBAGOAL_TAC;
51284 ASM_SIMP_TAC[real_div_denom_lt];
51285 REWRITE_TAC[REAL_OF_NUM_LT];
51288 TYPE_THEN `(!i. i <| N' ==> simple_arc_end (B i) (a i) (a (SUC i)))` SUBAGOAL_TAC;
51289 TYPE_THEN `a` UNABBREV_TAC;
51290 TYPE_THEN `B` UNABBREV_TAC;
51291 REWRITE_TAC[simple_arc_end];
51292 THM_INTRO_TAC[`f`;`&0`;`&1`;`&i/ &N'`;`&(SUC i)/ &N'`] arc_reparameter_gen;
51293 IMATCH_MP_TAC inj_subset_domain;
51295 REWRITE_TAC[SUBSET];
51296 FIRST_ASSUM IMATCH_MP_TAC ;
51297 TYPE_THEN `i` EXISTS_TAC;
51298 TYPE_THEN `g` EXISTS_TAC;
51301 TYPE_THEN `(IMAGE f {x | &0 <= x /\ x <= &1} = UNIONS (IMAGE B {i | i <| N'}))` SUBAGOAL_TAC;
51302 IMATCH_MP_TAC EQ_EXT;
51303 REWRITE_TAC[UNIONS;IMAGE];
51304 TYPE_THEN `B` UNABBREV_TAC;
51305 REWRITE_TAC[IMAGE];
51306 IMATCH_MP_TAC EQ_ANTISYM;
51308 CONV_TAC (dropq_conv "u");
51312 TYPE_THEN `x'` EXISTS_TAC;
51314 TYPE_THEN `x' = &1` ASM_CASES_TAC;
51315 TYPE_THEN `N' -| 1` EXISTS_TAC;
51316 FULL_REWRITE_TAC[REAL_LT;REAL_LE];
51317 TYPE_THEN `N' -| 1 <| N'` SUBAGOAL_TAC;
51318 UNDH 8859 THEN ARITH_TAC;
51320 UNDH 9064 THEN ARITH_TAC;
51321 FULL_REWRITE_TAC[GSYM REAL_LT];
51322 ASM_SIMP_TAC[REAL_LE_RDIV_EQ];
51324 FULL_REWRITE_TAC[REAL_LT];
51325 UND 25 THEN ARITH_TAC;
51327 TYPE_THEN `num_abs_of_int (floor (&N' * x'))` EXISTS_TAC;
51328 TYPE_THEN `t = &N' * x'` ABBREV_TAC ;
51329 TYPE_THEN `x' = t/(&N')` SUBAGOAL_TAC;
51330 TYPE_THEN `t` UNABBREV_TAC;
51331 REWRITE_TAC[real_div_assoc];
51332 ONCE_REWRITE_TAC[EQ_SYM_EQ ];
51333 IMATCH_MP_TAC REAL_DIV_LMUL;
51334 UNDH 3200 THEN UNDH 7688 THEN REAL_ARITH_TAC;
51335 TYPE_THEN `&0 <= t` SUBAGOAL_TAC;
51336 TYPE_THEN `t` UNABBREV_TAC;
51337 IMATCH_MP_TAC REAL_LE_MUL;
51338 TYPE_THEN `&:0 <=: (floor t)` SUBAGOAL_TAC;
51339 REWRITE_TAC[int_of_num_th;GSYM floor_le];
51340 REWRITE_TAC[GSYM REAL_OF_NUM_LT];
51341 ASM_REWRITE_TAC[REAL;num_abs_of_int_th;GSYM int_abs_th;];
51342 TYPE_THEN `(||: (floor t) = (floor t))` SUBAGOAL_TAC;
51343 REWRITE_TAC[INT_ABS_REFL;];
51344 THM_INTRO_TAC[`t`] floor_ineq;
51345 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
51346 TYPE_THEN `t < &N' * &1` SUBAGOAL_TAC;
51347 TYPE_THEN `t` UNABBREV_TAC;
51348 ASM_SIMP_TAC[REAL_LT_LMUL_EQ];
51349 UNDH 6268 THEN UNDH 3324 THEN REAL_ARITH_TAC;
51351 UNDH 5082 THEN REAL_ARITH_TAC;
51352 TYPE_THEN `real_of_int (floor (&N' )) = &N'` SUBAGOAL_TAC;
51353 REWRITE_TAC[floor_num;int_of_num_th;];
51354 UNDH 6307 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t]);
51355 REWRITE_TAC[GSYM int_lt ];
51356 IMATCH_MP_TAC (INT_ARITH `~(x = y) /\ (x <= y) ==> (x <: y)`);
51358 FULL_REWRITE_TAC[floor_range];
51359 FULL_REWRITE_TAC[int_of_num_th;floor_num];
51360 UNDH 1048 THEN UNDH 6689 THEN REAL_ARITH_TAC;
51361 IMATCH_MP_TAC floor_mono;
51362 UNDH 1048 THEN REAL_ARITH_TAC;
51363 TYPE_THEN `u` UNABBREV_TAC;
51364 TYPE_THEN `x` UNABBREV_TAC;
51365 TYPE_THEN `x''` EXISTS_TAC;
51366 FIRST_ASSUM IMATCH_MP_TAC ;
51367 TYPE_THEN `x'` EXISTS_TAC;
51369 TYPE_THEN `!i. (i <| N') ==> compact top2 (B i)` SUBAGOAL_TAC;
51370 UNDH 8913 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
51371 USEH 9744 (MATCH_MP simple_arc_end_simple);
51372 USEH 3463 (MATCH_MP simple_arc_compact);
51374 TYPE_THEN `!i. (i <| N') ==> ~(B i = EMPTY)` SUBAGOAL_TAC;
51375 UNDH 8913 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
51376 USEH 9744 (MATCH_MP simple_arc_end_simple);
51377 USEH 3463 (MATCH_MP simple_arc_nonempty);
51378 UNDH 8481 THEN ASM_REWRITE_TAC[];
51380 TYPE_THEN `!k. ?dij. !i j. (k = (i,j)) /\ SUC i < j /\ j < N' ==> (&0 < dij /\ (!x y. B i x /\ B j y ==> dij <= d_euclid x y))` SUBAGOAL_TAC;
51381 REWRITE_TAC[PAIR_SPLIT];
51382 CONV_TAC (dropq_conv "i");
51383 CONV_TAC (dropq_conv "j");
51384 TYPE_THEN `i = FST k` ABBREV_TAC ;
51385 TYPE_THEN `j = SND k` ABBREV_TAC ;
51389 THM_INTRO_TAC[`(euclid 2)`;`d_euclid`;`(B i)`;`(B j)`] compact_distance;
51390 CONJ_TAC THENL [FIRST_ASSUM IMATCH_MP_TAC ;ALL_TAC];
51391 UNDH 3810 THEN UNDH 2985 THEN ARITH_TAC;
51392 FULL_REWRITE_TAC[top2];
51393 FIRST_ASSUM IMATCH_MP_TAC ;
51394 UNDH 3810 THEN UNDH 2985 THEN ARITH_TAC;
51395 TYPE_THEN `d_euclid p' p''` EXISTS_TAC;
51398 IMATCH_MP_TAC d_euclid_pos2;
51399 TYPE_THEN `2` EXISTS_TAC;
51401 TYPE_THEN `p''` UNABBREV_TAC;
51402 TYPE_THEN `B` UNABBREV_TAC;
51403 USEH 7066 (REWRITE_RULE[IMAGE]);
51404 USEH 6258 (REWRITE_RULE[IMAGE]);
51405 TYPE_THEN `p'` UNABBREV_TAC;
51406 TYPE_THEN `x = x'` SUBAGOAL_TAC;
51407 FULL_REWRITE_TAC[INJ];
51408 FIRST_ASSUM IMATCH_MP_TAC ;
51409 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
51412 UNDH 3810 THEN UNDH 2985 THEN ARITH_TAC;
51413 TYPE_THEN `x'` UNABBREV_TAC;
51414 TYPE_THEN `&j/ &N' <= &(SUC i) / (&N')` SUBAGOAL_TAC THENL[IMATCH_MP_TAC REAL_LE_TRANS;ALL_TAC];
51416 UNDH 5902 THEN ASM_REWRITE_TAC[];
51417 UNDH 4223 THEN UNDH 3810 THEN REWRITE_TAC[REAL_LE] THEN ARITH_TAC;
51419 TYPE_THEN `(i <| N')` SUBAGOAL_TAC;
51420 UNDH 3810 THEN UNDH 2985 THEN ARITH_TAC;
51421 TYPE_THEN `!i x. (i <| N') /\ (B i x) ==> (euclid 2 x)` SUBAGOAL_TAC;
51423 USEH 9316 (MATCH_MP simple_arc_end_simple);
51424 USEH 5604 (MATCH_MP simple_arc_euclid);
51425 ASM_MESON_TAC[subset_imp];
51426 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
51430 FIRST_ASSUM IMATCH_MP_TAC ;
51433 TYPE_THEN `?d''. (&0 < d'') /\ (!i j. (SUC i < j /\ j <| N') ==> (d'' <= dij (i,j)))` SUBAGOAL_TAC;
51434 TYPE_THEN `X = { r | (?i j. SUC i < j /\ j <| N' /\ (r = dij (i,j))) }` ABBREV_TAC ;
51435 TYPE_THEN `d'' = inf X` ABBREV_TAC ;
51436 TYPE_THEN `X = IMAGE dij {(i,j) | (SUC i < j /\ j < N')}` SUBAGOAL_TAC;
51437 TYPE_THEN `X` UNABBREV_TAC;
51438 IMATCH_MP_TAC EQ_EXT;
51439 REWRITE_TAC[IMAGE;];
51441 POP_ASSUM_LIST (fun t->ALL_TAC);
51442 IMATCH_MP_TAC EQ_ANTISYM;
51444 CONV_TAC (dropq_conv "x'");
51446 TYPE_THEN `x'` UNABBREV_TAC;
51449 TYPE_THEN `FINITE X` SUBAGOAL_TAC;
51450 IMATCH_MP_TAC FINITE_IMAGE;
51451 IMATCH_MP_TAC FINITE_SUBSET;
51452 TYPE_THEN `A = {i | (i <| N')}` ABBREV_TAC ;
51453 TYPE_THEN `{(i,j) | A i /\ A j}` EXISTS_TAC;
51455 THM_INTRO_TAC[`A`;`A`] FINITE_PRODUCT;
51456 TYPE_THEN `A` UNABBREV_TAC;
51457 REWRITE_TAC[FINITE_NUMSEG_LT];
51458 REWRITE_TAC[SUBSET;];
51459 TYPE_THEN `A` UNABBREV_TAC;
51460 TYPE_THEN`i` EXISTS_TAC;
51461 TYPE_THEN `j` EXISTS_TAC;
51462 UNDH 3810 THEN UNDH 2985 THEN ARITH_TAC;
51464 TYPE_THEN `X = EMPTY` ASM_CASES_TAC;
51465 TYPE_THEN `&1` EXISTS_TAC;
51468 USEH 7502 (REWRITE_RULE[image_empty]);
51469 USEH 1549 (REWRITE_RULE[EQ_EMPTY]);
51470 TSPECH `(i,j)` 7313 ;
51475 UNDH 5891 THEN ASM_REWRITE_TAC[];
51477 THM_INTRO_TAC[`X`] finite_inf_min;
51478 THM_INTRO_TAC[`X`] finite_inf;
51479 TYPE_THEN `d''` EXISTS_TAC;
51481 (* TYPE_THEN `d''` UNABBREV_TAC; *)
51484 TYPE_THEN `?i j. SUC i <| j /\ j <| N' /\ (d'' = dij (i,j))` SUBAGOAL_TAC;
51485 UNDH 7611 THEN ASM_REWRITE_TAC[] THEN UNDH 3235 THEN DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]);
51486 UNDH 3572 THEN DISCH_THEN (THM_INTRO_TAC[`(i,j)`;`i`;`j`]);
51489 UNDH 6732 THEN DISCH_THEN (THM_INTRO_TAC[`dij (i,j)`]);
51490 UNDH 3235 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[GSYM t]);
51495 TYPE_THEN `d' = d''/ &32` ABBREV_TAC ;
51496 TYPE_THEN `&0 < &32` SUBAGOAL_TAC;
51498 TYPE_THEN `d'` EXISTS_TAC;
51500 TYPE_THEN `d'` UNABBREV_TAC;
51501 ASM_SIMP_TAC[REAL_LT_RDIV_0];
51503 FULL_REWRITE_TAC[REAL_LT];
51505 IMATCH_MP_TAC REAL_LTE_TRANS;
51506 TYPE_THEN `d''` EXISTS_TAC;
51508 TYPE_THEN `d'` UNABBREV_TAC;
51509 REWRITE_TAC[GSYM real_div_assoc];
51510 ASM_SIMP_TAC[REAL_LT_LDIV_EQ];
51511 REWRITE_TAC[REAL_MUL_AC];
51512 IMATCH_MP_TAC REAL_LT_LMUL;
51515 UNDH 3572 THEN DISCH_THEN (THM_INTRO_TAC[`(i,j)`;`i`;`j`]);
51517 IMATCH_MP_TAC REAL_LE_TRANS;
51518 TYPE_THEN `dij (i,j)` EXISTS_TAC;
51519 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
51520 (* Wed Dec 29 17:40:18 EST 2004 *)
51525 let euclid_scale_rinv = prove_by_refinement(
51526 `!x r. (&0 < r) ==> ((r * &1/ r) *# x = x)`,
51530 USEH 6412 (MATCH_MP (REAL_ARITH `&0 < r ==> ~(r = &0)`));
51531 ASM_SIMP_TAC[REAL_DIV_LMUL;euclid_scale_one];
51535 let euclid_scale_bij = prove_by_refinement(
51536 `!r . (&0 < r) ==> BIJ (euclid_scale r) (euclid 2) (euclid 2)`,
51540 REWRITE_TAC[BIJ;INJ;];
51541 TYPE_THEN `!x. (r * &1 / r) *# x = x` SUBAGOAL_TAC;
51542 USEH 6412 (MATCH_MP (REAL_ARITH `&0 < r ==> ~(r = &0)`));
51543 ASM_SIMP_TAC[REAL_DIV_LMUL;euclid_scale_one];
51546 IMATCH_MP_TAC euclid_scale_closure;
51547 TYPE_THEN `euclid_scale (&1/ r)` (fun t -> USEH 9290 (AP_TERM t));
51548 FULL_REWRITE_TAC[euclid_scale_act];
51549 USEH 7114 (ONCE_REWRITE_RULE[REAL_ARITH `x * y = y *x`]);
51553 TYPE_THEN`(&1/ r) *# x` EXISTS_TAC;
51555 IMATCH_MP_TAC euclid_scale_closure;
51556 REWRITE_TAC[euclid_scale_act];
51560 let euclid_scale_cont = prove_by_refinement(
51561 `!r. (&0 < r) ==> (continuous (euclid_scale r) top2 top2)`,
51565 THM_INTRO_TAC[`( *# ) r`] metric_continuous_continuous_top2;
51566 REWRITE_TAC[IMAGE;SUBSET];
51567 IMATCH_MP_TAC euclid_scale_closure;
51568 REWRITE_TAC[metric_continuous;metric_continuous_pt];
51569 TYPE_THEN `epsilon/r` EXISTS_TAC;
51571 IMATCH_MP_TAC REAL_LT_DIV;
51572 THM_INTRO_TAC[`2`;`r`;`x`;`y`] norm_scale_vec;
51573 TYPE_THEN `abs r = r` SUBAGOAL_TAC;
51574 REWRITE_TAC[REAL_ABS_REFL];
51575 UNDH 6412 THEN REAL_ARITH_TAC;
51576 UNDH 3108 THEN ASM_SIMP_TAC[REAL_LT_RDIV_EQ];
51577 FULL_REWRITE_TAC[REAL_MUL_AC];
51581 let euclid_scale_inv = prove_by_refinement(
51582 `!r x. (&0 < r) /\ (euclid 2 x) ==>
51583 (INV (( *# ) r) (euclid 2) (euclid 2) x = (( *# ) (&1 / r)) x)`,
51587 THM_INTRO_TAC[`( *# ) r`;`(euclid 2)`;`(euclid 2)`;`&1 / r *# x`;`x`] INVERSE_XY;
51588 ASM_SIMP_TAC[euclid_scale_bij];
51589 IMATCH_MP_TAC euclid_scale_closure;
51590 USEH 6412 (MATCH_MP (REAL_ARITH `&0 < r ==> ~(r = &0)`));
51591 REWRITE_TAC[euclid_scale_act];
51592 ASM_SIMP_TAC[REAL_DIV_LMUL;euclid_scale_one];
51596 let euclid_scale_homeo = prove_by_refinement(
51597 `!r. (&0 < r) ==> homeomorphism (euclid_scale r) top2 top2`,
51601 IMATCH_MP_TAC bicont_homeomorphism;
51602 REWRITE_TAC[top2_unions];
51603 ASM_SIMP_TAC [euclid_scale_bij];
51604 ASM_SIMP_TAC[euclid_scale_cont];
51605 IMATCH_MP_TAC cont_domain;
51606 TYPE_THEN `( *# ) (&1 / r)` EXISTS_TAC;
51607 TYPE_THEN `&0 < &1 /r` SUBAGOAL_TAC;
51608 ASM_SIMP_TAC[euclid_scale_cont];
51609 FULL_REWRITE_TAC[top2_unions];
51610 ASM_SIMP_TAC[euclid_scale_inv];
51611 (* Wed Dec 29 18:45:44 EST 2004 *)
51615 let simple_arc_end_homeo = prove_by_refinement(
51616 `!f C a b. simple_arc_end C a b /\ homeomorphism f top2 top2 ==>
51617 simple_arc_end (IMAGE f C) (f a) (f b)`,
51620 REWRITE_TAC[simple_arc_end_cont];
51621 TYPE_THEN `f o f'` EXISTS_TAC;
51622 REWRITE_TAC[IMAGE_o];
51623 TYPE_THEN `metric_space ({x | &0 <= x /\ x <= &1},d_real)` SUBAGOAL_TAC;
51624 IMATCH_MP_TAC metric_subspace;
51625 TYPE_THEN `UNIV:real->bool` EXISTS_TAC;
51626 REWRITE_TAC[metric_real];
51628 TYPE_THEN `UNIONS (top_of_metric (({x | &0 <= x /\ x <= &1},d_real))) = {x | &0 <= x /\ x <= &1}` SUBAGOAL_TAC;
51629 IMATCH_MP_TAC (GSYM top_of_metric_unions);
51632 IMATCH_MP_TAC continuous_comp;
51633 TYPE_THEN `top2` EXISTS_TAC;
51634 REWRITE_TAC[top2_unions];
51635 FULL_REWRITE_TAC[homeomorphism];
51637 IMATCH_MP_TAC inj_image_subset;
51640 REWRITE_TAC[comp_comp];
51641 IMATCH_MP_TAC COMP_INJ;
51642 TYPE_THEN `(euclid 2)` EXISTS_TAC;
51643 FULL_REWRITE_TAC[homeomorphism];
51644 FULL_REWRITE_TAC[top2_unions;BIJ];
51645 REWRITE_TAC[o_DEF];
51649 let simple_arc_homeo = prove_by_refinement(
51650 `!f C. simple_arc top2 C /\ homeomorphism f top2 top2 ==>
51651 simple_arc top2 (IMAGE f C)`,
51655 RULE_ASSUM_TAC (REWRITE_RULE[simple_arc]);
51656 TYPE_THEN `simple_arc_end C (f' (&0)) (f' (&1))` SUBAGOAL_TAC;
51657 REWRITE_TAC[simple_arc_end];
51658 TYPE_THEN `f'` EXISTS_TAC;
51659 FULL_REWRITE_TAC[top2_unions];
51660 THM_INTRO_TAC[`f`;`C`;`f' (&0)`;`f' (&1)`] simple_arc_end_homeo;
51661 USEH 6603 (MATCH_MP simple_arc_end_simple);
51662 TYPE_THEN `C` UNABBREV_TAC;
51666 let euclid_scale_simple_arc_ver2 = prove_by_refinement(
51667 `!C p q. simple_arc top2 C /\ ~C p /\ ~C q /\ (euclid 2 p) /\
51668 (euclid 2 q) /\ ~(p = q) /\
51669 (!A. simple_arc_end A p q ==> ~(C INTER A = EMPTY)) ==>
51670 (?C' p' q' d N B a d'.
51671 simple_arc top2 C' /\ ~C' p' /\ ~C' q' /\ (euclid 2 p') /\
51672 (euclid 2 q') /\ ~(p' = q') /\
51673 (!A. simple_arc_end A p' q' ==> ~(C' INTER A = EMPTY)) /\
51674 (&1 <=. d) /\ (&1 <=. d') /\ (0 < N) /\
51675 (!i. (i <| N) ==> simple_arc_end (B i) (a i) (a (SUC i))) /\
51676 (C' = UNIONS (IMAGE B {i | i <| N})) /\
51678 (&8 * d <= d_euclid x p') /\ (&8 * d <= d_euclid x q')) /\
51679 (!i j x y. (SUC i < j) /\ (j <| N) /\ B i x /\ B j y ==>
51680 (&16 * d' < d_euclid x y)) /\
51682 (?x. B i x /\ B i SUBSET (open_ball (euclid 2,d_euclid) x d))))
51688 THM_INTRO_TAC[`C`;`p`;`q`] simple_arc_constants;
51689 TYPE_THEN `r = min_real d d'` ABBREV_TAC ;
51690 TYPE_THEN `f = ( *# ) (&1 /r)` ABBREV_TAC ;
51691 TYPE_THEN `C' = IMAGE f C` ABBREV_TAC ;
51692 TYPE_THEN `B' = (IMAGE f) o B` ABBREV_TAC ;
51693 TYPE_THEN `p' = f p` ABBREV_TAC ;
51694 TYPE_THEN `q' = f q` ABBREV_TAC ;
51695 TYPE_THEN `dr = d/r` ABBREV_TAC ;
51696 TYPE_THEN `dr' = d'/r` ABBREV_TAC ;
51697 TYPE_THEN `a' = f o a` ABBREV_TAC ;
51698 TYPE_THEN `C'` EXISTS_TAC;
51699 TYPE_THEN `p'` EXISTS_TAC;
51700 TYPE_THEN `q'` EXISTS_TAC;
51701 TYPE_THEN `dr` EXISTS_TAC;
51702 TYPE_THEN `N` EXISTS_TAC;
51703 TYPE_THEN `B'` EXISTS_TAC;
51704 TYPE_THEN `a'` EXISTS_TAC;
51705 TYPE_THEN `dr'` EXISTS_TAC;
51707 TYPE_THEN `&0 < r` SUBAGOAL_TAC;
51708 TYPE_THEN `r` UNABBREV_TAC;
51709 REWRITE_TAC[min_real];
51711 TYPE_THEN `&0 < &1/ r` SUBAGOAL_TAC;
51713 TYPE_THEN `homeomorphism f top2 top2` SUBAGOAL_TAC;
51714 TYPE_THEN `f` UNABBREV_TAC;
51715 IMATCH_MP_TAC euclid_scale_homeo;
51718 TYPE_THEN `C'` UNABBREV_TAC;
51719 IMATCH_MP_TAC simple_arc_homeo;
51721 TYPE_THEN `!x. C x ==> euclid 2 x` SUBAGOAL_TAC;
51722 USEH 3550 (MATCH_MP simple_arc_euclid);
51723 IMATCH_MP_TAC subset_imp;
51727 TYPE_THEN `C'` UNABBREV_TAC;
51728 TYPE_THEN `p'` UNABBREV_TAC;
51729 UNDH 9726 THEN ASM_REWRITE_TAC[];
51730 USEH 7428 (REWRITE_RULE[IMAGE]);
51731 FULL_REWRITE_TAC[homeomorphism;BIJ;INJ];
51732 TYPE_THEN `(x = p)` SUBAGOAL_TAC;
51733 FIRST_ASSUM IMATCH_MP_TAC ;
51734 FULL_REWRITE_TAC[top2_unions];
51735 TYPE_THEN `p` UNABBREV_TAC;
51738 TYPE_THEN `C'` UNABBREV_TAC;
51739 TYPE_THEN `q'` UNABBREV_TAC;
51740 UNDH 6497 THEN ASM_REWRITE_TAC[];
51741 USEH 4199 (REWRITE_RULE[IMAGE]);
51742 FULL_REWRITE_TAC[homeomorphism;BIJ;INJ];
51743 TYPE_THEN `(q = x)` SUBAGOAL_TAC;
51744 FIRST_ASSUM IMATCH_MP_TAC ;
51745 FULL_REWRITE_TAC[top2_unions];
51746 TYPE_THEN `q` UNABBREV_TAC;
51748 TYPE_THEN `euclid 2 p' /\ euclid 2 q'` SUBAGOAL_TAC;
51749 TYPE_THEN `p'` UNABBREV_TAC;
51750 TYPE_THEN `q'` UNABBREV_TAC;
51751 FULL_REWRITE_TAC[homeomorphism;BIJ;SURJ;top2_unions];
51754 TYPE_THEN `p'` UNABBREV_TAC;
51755 TYPE_THEN `q'` UNABBREV_TAC;
51756 FULL_REWRITE_TAC[homeomorphism;BIJ;INJ];
51757 UNDH 11 THEN REWRITE_TAC[];
51758 FIRST_ASSUM IMATCH_MP_TAC ;
51759 REWRITE_TAC[top2_unions];
51762 TYPE_THEN `g = ( *# ) r` ABBREV_TAC ;
51763 TYPE_THEN `A' = IMAGE g A` ABBREV_TAC ;
51764 TYPE_THEN`homeomorphism g top2 top2` SUBAGOAL_TAC;
51765 TYPE_THEN `g` UNABBREV_TAC;
51766 ASM_SIMP_TAC[euclid_scale_homeo];
51768 TYPE_THEN `!x. (g (f x) = x)` SUBAGOAL_TAC;
51769 TYPE_THEN `g` UNABBREV_TAC;
51770 TYPE_THEN `f` UNABBREV_TAC;
51771 REWRITE_TAC[euclid_scale_act];
51772 ASM_SIMP_TAC [euclid_scale_rinv];
51774 UNDH 5082 THEN DISCH_THEN (THM_INTRO_TAC[]);
51775 TYPE_THEN `A'` UNABBREV_TAC;
51776 TYPE_THEN `(p = g p') /\ (q = g q')` SUBAGOAL_TAC;
51777 TYPE_THEN `p'` UNABBREV_TAC;
51778 TYPE_THEN `q'` UNABBREV_TAC;
51779 IMATCH_MP_TAC simple_arc_end_homeo;
51780 USEH 7123 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
51781 USEH 8329 (REWRITE_RULE[EQ_EMPTY;INTER]);
51783 UNDH 1812 THEN REWRITE_TAC[];
51784 TYPE_THEN `C'` UNABBREV_TAC;
51786 IMATCH_MP_TAC image_imp;
51787 TYPE_THEN `A'` UNABBREV_TAC;
51788 USEH 1648 (REWRITE_RULE[IMAGE]);
51789 TYPE_THEN `f` UNABBREV_TAC;
51790 TYPE_THEN `g` UNABBREV_TAC;
51791 REWRITE_TAC[euclid_scale_act];
51792 ONCE_REWRITE_TAC[REAL_ARITH `x * y = y*x`];
51793 ASM_SIMP_TAC[euclid_scale_rinv];
51796 TYPE_THEN `dr` UNABBREV_TAC;
51797 TYPE_THEN `r` UNABBREV_TAC;
51798 ASM_SIMP_TAC[REAL_LE_RDIV_EQ];
51800 REWRITE_TAC[min_real_le];
51802 TYPE_THEN `dr'` UNABBREV_TAC;
51803 TYPE_THEN `r` UNABBREV_TAC;
51804 ASM_SIMP_TAC[REAL_LE_RDIV_EQ];
51806 REWRITE_TAC[min_real_le];
51809 TYPE_THEN `B'` UNABBREV_TAC;
51810 TYPE_THEN `a'` UNABBREV_TAC;
51811 REWRITE_TAC[o_DEF];
51812 IMATCH_MP_TAC simple_arc_end_homeo;
51815 TYPE_THEN `C'` UNABBREV_TAC;
51816 TYPE_THEN `B'` UNABBREV_TAC;
51817 REWRITE_TAC[IMAGE_o];
51818 REWRITE_TAC[GSYM image_unions];
51820 TYPE_THEN `!x y. (euclid 2 x) /\ (euclid 2 y) ==> (d_euclid (f x) (f y) = (d_euclid x y)/r)` SUBAGOAL_TAC;
51821 TYPE_THEN `f` UNABBREV_TAC;
51822 THM_INTRO_TAC[`2`;`&1 / r`;`x`;`y`] norm_scale_vec;
51823 TYPE_THEN `abs (&1/r) = &1/r` SUBAGOAL_TAC;
51824 REWRITE_TAC[ABS_REFL];
51825 UNDH 4597 THEN REAL_ARITH_TAC;
51826 ONCE_REWRITE_TAC[REAL_ARITH `x * y = y* x`];
51827 REWRITE_TAC[GSYM real_div_assoc];
51831 TYPE_THEN `C'` UNABBREV_TAC;
51832 USEH 3184 (REWRITE_RULE[IMAGE]);
51833 TYPE_THEN `p'` UNABBREV_TAC;
51834 TYPE_THEN `q'` UNABBREV_TAC;
51836 TYPE_THEN `dr` UNABBREV_TAC;
51837 REWRITE_TAC[GSYM real_div_assoc];
51838 ASM_SIMP_TAC[real_div_denom];
51840 TYPE_THEN `!i x. (i <| N) /\ (B i x) ==> (euclid 2 x)` SUBAGOAL_TAC;
51841 UNDH 4963 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
51842 USEH 9744 (MATCH_MP simple_arc_end_simple);
51843 USEH 3463 (MATCH_MP simple_arc_euclid);
51844 USEH 4246 (REWRITE_RULE[SUBSET]);
51847 TYPE_THEN `B'` UNABBREV_TAC;
51848 FULL_REWRITE_TAC[o_DEF];
51849 USEH 407 (REWRITE_RULE[IMAGE]);
51850 USEH 3121 (REWRITE_RULE[IMAGE]);
51851 TYPE_THEN `i <| N` SUBAGOAL_TAC;
51852 UNDH 3810 THEN UNDH 1688 THEN ARITH_TAC;
51853 UNDH 2436 THEN DISCH_THEN (THM_INTRO_TAC[`x''`;`x'`]);
51854 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC ) THEN ASM_MESON_TAC[];
51855 TYPE_THEN `dr'` UNABBREV_TAC;
51856 REWRITE_TAC[GSYM real_div_assoc];
51857 ASM_SIMP_TAC[real_div_denom_lt];
51858 FIRST_ASSUM IMATCH_MP_TAC ;
51863 TYPE_THEN `f x` EXISTS_TAC;
51864 TYPE_THEN `B'` UNABBREV_TAC;
51865 REWRITE_TAC[o_DEF];
51867 IMATCH_MP_TAC image_imp;
51868 FULL_REWRITE_TAC[SUBSET;open_ball];
51869 USEH 4418 (REWRITE_RULE[IMAGE]);
51873 TYPE_THEN `f` UNABBREV_TAC;
51874 IMATCH_MP_TAC euclid_scale_closure;
51876 TYPE_THEN `f` UNABBREV_TAC;
51877 IMATCH_MP_TAC euclid_scale_closure;
51879 TYPE_THEN `dr` UNABBREV_TAC;
51880 ASM_SIMP_TAC[real_div_denom_lt];
51881 (* Thu Dec 30 10:14:03 EST 2004 *)
51887 let delta_pos_arch = prove_by_refinement(
51888 `!d. (&0 < d) ==> (?n. (0 <| n) /\ (&1/(&n) < d))`,
51892 THM_INTRO_TAC[`&1/d`] REAL_ARCH_SIMPLE;
51893 TYPE_THEN `2 * n` EXISTS_TAC;
51895 REWRITE_TAC[LT_MULT];
51898 REWRITE_TAC[GSYM REAL_LT];
51899 IMATCH_MP_TAC REAL_LTE_TRANS;
51900 TYPE_THEN `&1 / d` EXISTS_TAC;
51902 IMATCH_MP_TAC REAL_LTE_TRANS;
51903 TYPE_THEN `&1/ &n` EXISTS_TAC;
51905 TYPE_THEN `&0 < &(2 *| n)` SUBAGOAL_TAC;
51906 REWRITE_TAC[REAL_LT];
51907 TYPE_THEN `&0 < &n` SUBAGOAL_TAC;
51908 FULL_REWRITE_TAC[REAL_LT];
51909 FULL_REWRITE_TAC[LT_MULT];
51911 ASM_SIMP_TAC[REAL_LT_RDIV_EQ];
51912 ONCE_REWRITE_TAC[REAL_ARITH `x * y = y*x`];
51913 REWRITE_TAC[GSYM real_div_assoc];
51914 ASM_SIMP_TAC[REAL_LT_LDIV_EQ];
51916 FULL_REWRITE_TAC[REAL_LT];
51917 UNDH 3476 THEN ARITH_TAC;
51918 UNDH 27 THEN ASM_SIMP_TAC[REAL_LE_LDIV_EQ];
51919 FULL_REWRITE_TAC[REAL_MUL_AC];
51923 let suc_div = prove_by_refinement(
51924 `!i a. &(SUC i) / a = &i/ a + &1/a`,
51928 REWRITE_TAC[real_div];
51933 let delta_partition_lemma_ver2 = prove_by_refinement(
51934 `!delta. (&0 < delta) ==> (?M. !N. !x. ?i. (0 < M) /\
51935 ((M <= N) /\ (&0 <= x /\ x <= &1) ==>
51936 (i <= N) /\ abs (&i/ &N - x) < delta))`,
51940 THM_INTRO_TAC[ `&1/ delta` ] REAL_ARCH_SIMPLE;
51941 TYPE_THEN `n` EXISTS_TAC;
51942 TYPE_THEN `num_abs_of_int (floor (&N*x))` EXISTS_TAC;
51943 TYPE_THEN `&0 < &1/ delta` SUBAGOAL_TAC;
51944 TYPE_THEN `&0 < &n` SUBAGOAL_TAC;
51945 UND 1 THEN UND 2 THEN REAL_ARITH_TAC;
51946 TYPE_THEN `(&1 <= &n* delta)` SUBAGOAL_TAC;
51947 ASM_MESON_TAC[REAL_LE_LDIV_EQ];
51949 FULL_REWRITE_TAC[REAL_LT];
51950 TYPE_THEN `&:0 <= floor (&N * x)` SUBAGOAL_TAC;
51951 TYPE_THEN `floor (&0) <=: floor (&N * x)` BACK_TAC;
51952 FULL_REWRITE_TAC[floor_num];
51953 IMATCH_MP_TAC floor_mono;
51954 IMATCH_MP_TAC REAL_LE_MUL;
51957 TYPE_THEN `num_abs_of_int (floor (&N * x)) <= num_abs_of_int (floor (&N))` BACK_TAC;
51958 FULL_REWRITE_TAC[floor_num;num_abs_of_int_num];
51959 IMATCH_MP_TAC num_abs_of_int_mono;
51960 IMATCH_MP_TAC floor_mono;
51961 TYPE_THEN `&N * x <= &N * &1` BACK_TAC;
51962 UND 9 THEN REAL_ARITH_TAC;
51963 IMATCH_MP_TAC REAL_PROP_LE_LMUL;
51965 IMATCH_MP_TAC REAL_LT_LCANCEL_IMP;
51966 TYPE_THEN `&N` EXISTS_TAC;
51968 TYPE_THEN `&0 < &N` SUBAGOAL_TAC;
51969 FULL_REWRITE_TAC[REAL_LT];
51970 UNDH 3476 THEN UNDH 9390 THEN ARITH_TAC;
51971 IMATCH_MP_TAC REAL_LTE_TRANS;
51972 TYPE_THEN`&1` EXISTS_TAC;
51974 REWRITE_TAC[num_abs_of_int_th;];
51975 TYPE_THEN `abs (real_of_int (floor (&N * x))) = (real_of_int (floor (&N *x)))` SUBAGOAL_TAC;
51976 REWRITE_TAC[REAL_ABS_REFL];
51977 FULL_REWRITE_TAC [int_le; int_of_num_th;];
51978 TYPE_THEN `!u. &N * abs (u / &N - x) = abs (u - &N*x)` SUBAGOAL_TAC;
51979 TYPE_THEN `!t. &N * abs t = abs (&N *t)` SUBAGOAL_TAC;
51980 REWRITE_TAC[REAL_ABS_MUL;REAL_ABS_NUM];
51982 REWRITE_TAC[REAL_SUB_LDISTRIB];
51983 TYPE_THEN `&N * u/ &N = u` SUBAGOAL_TAC;
51984 IMATCH_MP_TAC REAL_DIV_LMUL;
51985 UND 12 THEN UND 9 THEN REAL_ARITH_TAC;
51986 TYPE_THEN `t = &N * x ` ABBREV_TAC ;
51987 TYPE_THEN `real_of_int(floor t) <= t` SUBAGOAL_TAC;
51988 REWRITE_TAC[floor_ineq];
51989 TYPE_THEN `abs (real_of_int (floor t) - t) = t - real_of_int (floor t)` SUBAGOAL_TAC;
51990 UND 13 THEN REAL_ARITH_TAC;
51991 THM_INTRO_TAC[`t`] floor_ineq;
51993 UND 15 THEN REAL_ARITH_TAC;
51995 IMATCH_MP_TAC REAL_LE_TRANS;
51996 TYPE_THEN `&n * delta` EXISTS_TAC;
51997 ASM_SIMP_TAC[REAL_LE_RMUL_EQ];
51998 FULL_REWRITE_TAC[REAL_LE];
52002 let simple_arc_ball_cover_ver2 = prove_by_refinement(
52003 `!f. continuous f (top_of_metric(UNIV,d_real)) top2 /\
52004 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) ==>
52005 (?M. !N. !x. ?i. (0 < M) /\ (( M <= N) /\ (&0 <= x /\ x <= &1) ==>
52007 open_ball (euclid 2,d_euclid) (f (&i / &N)) (&1) (f x)))`,
52011 THM_INTRO_TAC[`f`] simple_arc_uniformly_continuous;
52012 FULL_REWRITE_TAC[uniformly_continuous];
52014 UNDH 4636 THEN DISCH_THEN (THM_INTRO_TAC[]);
52015 REWRITE_TAC[open_ball];
52016 THM_INTRO_TAC[`delta`] delta_partition_lemma_ver2;
52017 TYPE_THEN `M` EXISTS_TAC;
52020 TYPE_THEN `i` EXISTS_TAC;
52022 UNDH 5594 THEN DISCH_THEN (THM_INTRO_TAC[]);
52024 TYPE_THEN `0 <| N` SUBAGOAL_TAC;
52025 UNDH 6734 THEN UNDH 4600 THEN ARITH_TAC;
52027 TYPE_THEN `&0 <= &i/ &N /\ &i/ &N <= &1` SUBAGOAL_TAC;
52029 IMATCH_MP_TAC REAL_LE_DIV;
52030 THM_INTRO_TAC[`&i`;`&1`;`&N`] REAL_LE_LDIV_EQ;
52031 REWRITE_TAC[REAL_LT];
52032 REWRITE_TAC[REAL_MUL;REAL_LE];
52033 UNDH 8395 THEN ARITH_TAC;
52035 FULL_REWRITE_TAC[INJ];
52037 FIRST_ASSUM IMATCH_MP_TAC ;
52040 FIRST_ASSUM IMATCH_MP_TAC ;
52042 FIRST_ASSUM IMATCH_MP_TAC ;
52043 REWRITE_TAC[d_real];
52047 let grid_image_bounded_ver2 = prove_by_refinement(
52048 `!f. continuous f (top_of_metric(UNIV,d_real)) top2 /\
52049 INJ f {x | &0 <= x /\ x <= &1} (euclid 2) ==>
52050 (?M. !N. (0 < M) /\ ((M <= N) ==>
52051 ((IMAGE f {x | &0 <= x /\ x <= &1}) INTER
52052 (unbounded_set (grid f N)) = EMPTY)) )`,
52056 REWRITE_TAC[EQ_EMPTY;INTER;];
52057 THM_INTRO_TAC[`f`] simple_arc_ball_cover_ver2;
52058 TYPE_THEN `M` EXISTS_TAC;
52059 REWRITE_TAC[IMAGE];
52064 TYPE_THEN `x''` UNABBREV_TAC;
52065 TYPE_THEN `0 <| N` SUBAGOAL_TAC;
52066 UNDH 4600 THEN UNDH 6734 THEN ARITH_TAC;
52067 FULL_REWRITE_TAC[unbounded_diff;DIFF;ctop_unions ];
52068 UNDH 5619 THEN REWRITE_TAC[]; (* ~bounded *)
52069 UNDH 1431 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
52071 FULL_REWRITE_TAC[open_ball];
52073 IMATCH_MP_TAC bounded_avoidance_subset;
52074 TYPE_THEN `E = grid33 (floor (f (&i/ &N) 0),floor (f (&i / &N) 1))` ABBREV_TAC ;
52075 TYPE_THEN `E` EXISTS_TAC;
52077 TYPE_THEN `conn2 E` SUBAGOAL_TAC;
52078 TYPE_THEN `E` UNABBREV_TAC;
52079 REWRITE_TAC[grid33_conn2];
52080 REWRITE_TAC[grid_edge;grid_finite];
52081 TYPE_THEN `E SUBSET grid f N` SUBAGOAL_TAC;
52083 TYPE_THEN `E` UNABBREV_TAC;
52084 TYPE_THEN `{j | j <=| N} = {i} UNION {j | j <=| N /\ ~(j = i)}` SUBAGOAL_TAC;
52085 IMATCH_MP_TAC EQ_EXT;
52086 REWRITE_TAC[UNION];
52087 UNDH 8395 THEN ARITH_TAC; (* i <=| N *)
52089 REWRITE_TAC[IMAGE_UNION;UNIONS_UNION];
52090 REWRITE_TAC[SUBSET;UNION];
52092 REWRITE_TAC[image_sing];
52094 TYPE_THEN `~UNIONS (curve_cell E) (f x')` SUBAGOAL_TAC;
52095 UNDH 4893 THEN REWRITE_TAC[];
52096 THM_INTRO_TAC[`E`;`grid f N`] curve_cell_imp_subset;
52097 USEH 2367 (MATCH_MP UNIONS_UNIONS); (* CURVE_CELL SUBSET curve-cell *)
52098 ASM_MESON_TAC[subset_imp];
52099 KILLH 3474; (* E SUBSET grid f N *)
52100 KILLH 4893; (* ~UNIONS (. grid f N) *)
52102 TYPE_THEN `E' = rectangle_grid (floor (f x' 0),floor (f x' 1)) (floor (f x' 0) +: &:1,floor (f x' 1) +: &:1)` ABBREV_TAC ;
52103 THM_INTRO_TAC[`(floor (f x' 0),floor (f x' 1))`] rectagon_rectangle_grid_sq;
52104 FULL_REWRITE_TAC [];
52106 TYPE_THEN `E' SUBSET E` SUBAGOAL_TAC;
52107 TYPE_THEN `E` UNABBREV_TAC;
52108 TYPE_THEN `E'` UNABBREV_TAC;
52109 REWRITE_TAC[grid33];
52110 IMATCH_MP_TAC rectangle_grid_subset;
52112 THM_INTRO_TAC[`f (&i/ &N)`;`f x'`;`0`;`2`] d_euclid_floor;
52113 THM_INTRO_TAC[`f (&i/ &N)`;`f x'`;`1`;`2`] d_euclid_floor;
52114 UNDH 7979 THEN UNDH 4359 THEN INT_ARITH_TAC;
52116 IMATCH_MP_TAC bounded_avoidance_subset;
52117 TYPE_THEN `E'` EXISTS_TAC;
52118 TYPE_THEN `conn2 E'` SUBAGOAL_TAC;
52119 IMATCH_MP_TAC conn2_rectagon;
52120 TYPE_THEN `FINITE E` SUBAGOAL_TAC;
52121 FULL_REWRITE_TAC[conn2];
52123 TYPE_THEN `E SUBSET edge` SUBAGOAL_TAC;
52124 TYPE_THEN `E` UNABBREV_TAC;
52125 REWRITE_TAC[grid33_edge];
52127 ASM_SIMP_TAC[GSYM odd_bounded];
52128 REWRITE_TAC[UNIONS];
52129 TYPE_THEN ` squ (floor (f x' 0),floor (f x' 1))` EXISTS_TAC;
52130 IMATCH_MP_TAC (TAUT ` a/\ b ==> b /\ a`);
52132 TYPE_THEN `~UNIONS (curve_cell E') (f x')` SUBAGOAL_TAC;
52133 UNDH 1109 THEN REWRITE_TAC[]; (* ~ E *)
52134 THM_INTRO_TAC[`E'`;`E`] curve_cell_imp_subset;
52135 USEH 2664 (MATCH_MP UNIONS_UNIONS); (* curve-cell SUBSET *)
52136 ASM_MESON_TAC[subset_imp];
52138 TYPE_THEN `m = (floor (f x' 0),floor (f x' 1))` ABBREV_TAC ;
52139 TYPE_THEN `~(h_edge m (f x'))` SUBAGOAL_TAC;
52140 UNDH 8466 THEN REWRITE_TAC[]; (* ~ *)
52141 REWRITE_TAC[UNIONS];
52142 TYPE_THEN `h_edge m` EXISTS_TAC;
52143 REWRITE_TAC[curve_cell_h_ver2];
52144 USEH 4743 (REWRITE_RULE[PAIR_SPLIT]); (* floor,floor = m *)
52145 REWRH 1242; (* rg flor,flor *)
52146 FULL_REWRITE_TAC[rectangle_grid_sq];
52147 TYPE_THEN `E'` UNABBREV_TAC;
52148 REWRITE_TAC[INSERT];
52150 TYPE_THEN `~(v_edge m (f x'))` SUBAGOAL_TAC;
52151 UNDH 8466 THEN REWRITE_TAC[]; (* ~UNIONS .. E' *)
52152 REWRITE_TAC[UNIONS];
52153 TYPE_THEN `v_edge m` EXISTS_TAC;
52154 REWRITE_TAC[curve_cell_v_ver2];
52155 USEH 4743 (REWRITE_RULE[PAIR_SPLIT]);
52157 FULL_REWRITE_TAC[rectangle_grid_sq];
52158 TYPE_THEN `E'` UNABBREV_TAC;
52159 REWRITE_TAC[INSERT];
52161 TYPE_THEN `~(f x' = pointI m)` SUBAGOAL_TAC;
52162 UNDH 8466 THEN REWRITE_TAC[];
52163 REWRITE_TAC[UNIONS];
52164 TYPE_THEN `{(pointI m)}` EXISTS_TAC;
52165 ASM_SIMP_TAC[rectagon_segment;curve_cell_cls];
52166 USEH 4743 (REWRITE_RULE[PAIR_SPLIT]);
52168 FULL_REWRITE_TAC[rectangle_grid_sq];
52169 TYPE_THEN `{(h_edge m)} SUBSET E'` SUBAGOAL_TAC;
52170 TYPE_THEN `E'` UNABBREV_TAC;
52171 REWRITE_TAC[SUBSET;INSERT];
52172 USEH 9677 (MATCH_MP cls_subset); (* { hedge } SUBSET E' *)
52173 USEH 1949 (REWRITE_RULE[SUBSET]);
52174 FIRST_ASSUM IMATCH_MP_TAC ;
52175 REWRITE_TAC[cls_h];
52177 USEH 2851 (MATCH_MP point_onto); (* euclid 2 (f x') *)
52178 THM_INTRO_TAC[`p`] square_domain;
52179 UNDH 4082 THEN LET_TAC;
52180 TYPE_THEN `(floor (FST p),floor (SND p)) = m` SUBAGOAL_TAC;
52181 TYPE_THEN `m` UNABBREV_TAC;
52182 REWRITE_TAC[PAIR_SPLIT];
52183 REWRH 2288; (* big ONE *)
52184 TYPE_THEN `point p` UNABBREV_TAC;
52185 USEH 459 (REWRITE_RULE[UNION;INR IN_SING;]); (* long *)
52186 REWRH 4739; (* \/ *)
52188 ASM_SIMP_TAC[rectagon_segment;par_cell_squ];
52189 FULL_REWRITE_TAC[num_lower];
52190 USEH 4743 (REWRITE_RULE[PAIR_SPLIT]);
52191 REWRH 1242; (* rect-grid *)
52192 FULL_REWRITE_TAC[rectangle_grid_sq];
52193 TYPE_THEN `!m'. E' (h_edge m') <=> (m' = up m) \/ (m' = m)` SUBAGOAL_TAC;
52194 TYPE_THEN `E'` UNABBREV_TAC;
52195 REWRITE_TAC[INSERT;cell_clauses];
52196 REWRH 5179; (* EVEN *)
52198 TYPE_THEN `{m' | ((m' = up m) \/ (m' = m)) /\ (FST m' = FST m) /\ SND m' <=: SND m} = {m}` SUBAGOAL_TAC;
52199 IMATCH_MP_TAC EQ_EXT;
52200 REWRITE_TAC[up;PAIR_SPLIT];
52202 REWRH 3452; (* EVEN *)
52203 FULL_REWRITE_TAC[card_sing;EVEN2];
52208 let grid33_h = prove_by_refinement(
52209 `!m. grid33 m (h_edge m)`,
52212 REWRITE_TAC[grid33];
52213 REWRITE_TAC[rectangle_grid];
52215 TYPE_THEN `m` EXISTS_TAC;
52220 let curve_cell_grid_unions = prove_by_refinement(
52221 `!f N. curve_cell (grid f N) =
52222 UNIONS (IMAGE curve_cell
52223 ((IMAGE (\i. grid33 (floor (f (&i / &N) 0),floor (f (&i / &N) 1)))
52230 TYPE_THEN `S = (IMAGE (\i. grid33 (floor (f (&i / &N) 0),floor (f (&i / &N) 1))) {j | j <=| N})` ABBREV_TAC ;
52231 IMATCH_MP_TAC thread_finite_union;
52232 REWRITE_TAC[curve_cell_union;curve_cell_empty];
52233 TYPE_THEN `S` UNABBREV_TAC;
52234 IMATCH_MP_TAC FINITE_IMAGE;
52235 REWRITE_TAC[FINITE_NUMSEG_LE];
52240 let curve_cell_finite_union = prove_by_refinement(
52242 ( curve_cell (UNIONS E) = UNIONS (IMAGE curve_cell E))`,
52246 IMATCH_MP_TAC thread_finite_union;
52247 REWRITE_TAC[curve_cell_empty;curve_cell_union];
52251 let grid33_unions = prove_by_refinement(
52254 { m | (FST p -: &:1 <=: FST m) /\ FST m <=: FST p +: &:1 /\
52255 SND p -: &:1 <=: SND m /\ (SND m <=: SND p +: &:2) })
52258 { m | FST p -: &:1 <=: FST m /\ FST m <= FST p +: &:2 /\
52259 SND p -: &:1 <=: SND m /\ SND m <= SND p +: &:1}) `,
52263 REWRITE_TAC[grid33;IMAGE;rectangle_grid];
52264 IMATCH_MP_TAC EQ_EXT;
52265 REWRITE_TAC[UNION];
52266 IMATCH_MP_TAC EQ_ANTISYM ;
52268 FIRST_ASSUM DISJ_CASES_TAC;
52269 TYPE_THEN `x` UNABBREV_TAC;
52270 FULL_REWRITE_TAC[cell_clauses];
52271 CONV_TAC (dropq_conv "x");
52272 TYPE_THEN `m'` UNABBREV_TAC;
52273 UNDH 3867 THEN INT_ARITH_TAC;
52275 TYPE_THEN `x` UNABBREV_TAC;
52276 FULL_REWRITE_TAC[cell_clauses];
52277 CONV_TAC (dropq_conv "x");
52278 TYPE_THEN `m'` UNABBREV_TAC;
52279 UNDH 2244 THEN INT_ARITH_TAC;
52281 FIRST_ASSUM DISJ_CASES_TAC;
52282 TYPE_THEN `x` UNABBREV_TAC;
52283 FULL_REWRITE_TAC[cell_clauses];
52284 CONV_TAC (dropq_conv "m");
52285 TYPE_THEN `x'` UNABBREV_TAC;
52286 UNDH 6786 THEN INT_ARITH_TAC;
52288 TYPE_THEN `x` UNABBREV_TAC;
52289 FULL_REWRITE_TAC[cell_clauses];
52290 CONV_TAC (dropq_conv "m");
52291 TYPE_THEN `x'` UNABBREV_TAC;
52292 UNDH 2096 THEN INT_ARITH_TAC;
52297 let int_range_finite = prove_by_refinement(
52298 `!a b. FINITE {t | a <=: t /\ t <=: b}`,
52302 TYPE_THEN `b <: a` ASM_CASES_TAC;
52303 TYPE_THEN `{ t | a <=: t /\ t <=: b} = EMPTY ` BACK_TAC;
52304 REWRITE_TAC[FINITE_RULES];
52305 IMATCH_MP_TAC EQ_EXT;
52306 UNDH 5826 THEN INT_ARITH_TAC;
52308 THM_INTRO_TAC[`a`] INT_REP;
52309 THM_INTRO_TAC[`b`] INT_REP;
52310 TYPE_THEN `a` UNABBREV_TAC;
52311 TYPE_THEN `b` UNABBREV_TAC;
52313 THM_INTRO_TAC[`{ i | i <=| (n' + m) - (n + m') }`;`{t | (&:n -: &:m) <=: t /\ t <=: &:n' -: &:m'}`;`(\ i. (&:i) + &:n -: &:m)`] SURJ_FINITE;
52314 REWRITE_TAC[FINITE_NUMSEG_LE];
52317 TYPE_THEN `(n +| m') <= (n' + m)` SUBAGOAL_TAC;
52318 REWRITE_TAC[GSYM INT_OF_NUM_LE];
52319 REWRITE_TAC[GSYM INT_OF_NUM_ADD];
52320 UNDH 6818 THEN INT_ARITH_TAC;
52321 USEH 2499 (MATCH_MP INT_OF_NUM_SUB);
52323 FULL_REWRITE_TAC[GSYM INT_OF_NUM_LE];
52325 FULL_REWRITE_TAC[INT_OF_NUM_ADD];
52327 TYPE_THEN `&:0 <=: &:x` SUBAGOAL_TAC;
52328 REWRITE_TAC[INT_OF_NUM_LE];
52330 UNDH 163 THEN ARITH_TAC;
52331 UNDH 1710 THEN ARITH_TAC;
52333 THM_INTRO_TAC[`x`] INT_REP;
52334 TYPE_THEN `x` UNABBREV_TAC;
52335 TYPE_THEN `(n'' + m) -| (m'' + n)` EXISTS_TAC;
52336 TYPE_THEN `&:n'' + &:m' <=: &:n' + &:m''` SUBAGOAL_TAC;
52337 UNDH 4837 THEN INT_ARITH_TAC;
52339 TYPE_THEN `&:m'' + &:n <=: &:n'' + &:m` SUBAGOAL_TAC;
52340 UNDH 9532 THEN INT_ARITH_TAC;
52345 FULL_REWRITE_TAC[INT_OF_NUM_ADD;INT_OF_NUM_LE];
52346 UNDH 8565 THEN UNDH 9575 THEN ARITH_TAC;
52348 FULL_REWRITE_TAC[INT_OF_NUM_ADD;INT_OF_NUM_LE];
52349 ASM_SIMP_TAC[GSYM INT_OF_NUM_SUB];
52350 FULL_REWRITE_TAC[GSYM INT_OF_NUM_ADD];
52351 FULL_REWRITE_TAC[GSYM INT_OF_NUM_LE;GSYM INT_OF_NUM_ADD ];
52352 UNDH 4630 THEN UNDH 1357 THEN INT_ARITH_TAC;
52356 let subs_lemma = prove_by_refinement(
52357 `!y (f:A->bool). (f y) ==> (!x. (x = y) ==> f x)`,
52361 TYPE_THEN `x` UNABBREV_TAC;
52365 (*** JRH changed the labels here because somehow
52366 some beta-redexes get contracted that did not before,
52367 (new IN_ELIM_THM?) and this changes the set comprehensions
52369 let int2_range_finite = prove_by_refinement(
52370 `! a b c d. FINITE {m | a <=: FST m /\ FST m <=: b /\
52371 c <=: SND m /\ SND m <=: d}`,
52375 THM_INTRO_TAC[`{t | a <=: t /\ t <=: b}`;`{u | c <=: u /\ u <=: d}`] FINITE_PRODUCT;
52376 REWRITE_TAC[int_range_finite];
52377 USEH 3506 (MATCH_MP subs_lemma);
52378 FIRST_ASSUM IMATCH_MP_TAC ;
52379 IMATCH_MP_TAC EQ_EXT;
52381 IMATCH_MP_TAC EQ_ANTISYM;
52384 CONV_TAC (dropq_conv "t'");
52385 CONV_TAC (dropq_conv "u'");
52386 REWRITE_TAC[PAIR_SPLIT];
52394 let int2_range_finite = prove_by_refinement(
52395 `! a b c d. FINITE {m | a <=: FST m /\ FST m <=: b /\
52396 c <=: SND m /\ SND m <=: d}`,
52400 THM_INTRO_TAC[`{t | a <=: t /\ t <=: b}`;`{u | c <=: u /\ u <=: d}`] FINITE_PRODUCT;
52401 REWRITE_TAC[int_range_finite];
52402 USEH 4853 (MATCH_MP subs_lemma);
52403 FIRST_ASSUM IMATCH_MP_TAC ;
52404 IMATCH_MP_TAC EQ_EXT;
52406 IMATCH_MP_TAC EQ_ANTISYM;
52409 CONV_TAC (dropq_conv "t'");
52410 CONV_TAC (dropq_conv "u'");
52411 REWRITE_TAC[PAIR_SPLIT];
52418 let grid33_finite = prove_by_refinement(
52419 `!p. FINITE (grid33 p)`,
52422 REWRITE_TAC[grid33_unions];
52423 REWRITE_TAC[FINITE_UNION];
52424 CONJ_TAC THEN (IMATCH_MP_TAC FINITE_IMAGE) THEN (REWRITE_TAC[int2_range_finite]);
52428 let d_euclid_bound2 = prove_by_refinement(
52429 `!x y eps. euclid 2 x /\ euclid 2 y /\ (abs (x 0 - y 0) <= eps) /\
52430 (abs (x 1 - y 1) <= eps) ==> (d_euclid x y <= sqrt(&2) * eps)`,
52434 IMATCH_MP_TAC D_EUCLID_BOUND;
52436 TYPE_THEN `(i=0) \/ (i = 1) \/ (2 <= i)` SUBAGOAL_TAC;
52438 UNDH 2744 THEN REP_CASES_TAC;
52439 TYPE_THEN `i` UNABBREV_TAC;
52440 TYPE_THEN `i` UNABBREV_TAC;
52441 FULL_REWRITE_TAC[euclid];
52442 UND 0 THEN REAL_ARITH_TAC;
52446 let grid33_radius = prove_by_refinement(
52447 `!x y. (euclid 2 x) /\
52448 (UNIONS (curve_cell (grid33 (floor (x 0),floor (x 1)))) y) ==>
52449 (d_euclid x y < &4 )`,
52453 TYPE_THEN `m = (floor (x 0),floor (x 1))` ABBREV_TAC ;
52454 THM_INTRO_TAC[`grid33 m`] (GSYM curve_closure_ver2);
52455 REWRITE_TAC[grid33_edge;grid33_finite];
52458 TYPE_THEN `(UNIONS (grid33 m)) SUBSET closed_ball (euclid 2,d_euclid) x (&3) ` BACK_TAC;
52459 THM_INTRO_TAC[`top2`;`UNIONS(grid33 m)`;`closed_ball (euclid 2,d_euclid) x (&3)`;] closure_subset;
52460 REWRITE_TAC [top2_top;];
52461 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`x`;`&3 `]closed_ball_closed;
52462 FULL_REWRITE_TAC[GSYM top2];
52464 FULL_REWRITE_TAC[SUBSET;closed_ball];
52466 FULL_REWRITE_TAC[];
52467 UNDH 9621 THEN REAL_ARITH_TAC;
52470 FULL_REWRITE_TAC [grid33_unions];
52471 REWRITE_TAC[UNIONS_UNION;union_subset];
52473 TYPE_THEN `sqrt (&2) * (&2) <= (&3)` SUBAGOAL_TAC;
52474 IMATCH_MP_TAC REAL_POW_2_LE;
52475 REWRITE_TAC[REAL_POW_MUL];
52477 IMATCH_MP_TAC REAL_LE_MUL;
52478 IMATCH_MP_TAC SQRT_POS_LE;
52479 TYPE_THEN `sqrt(&2) pow 2 = &2` SUBAGOAL_TAC;
52480 IMATCH_MP_TAC SQRT_POW_2;
52481 REWRITE_TAC[REAL_POW_2];
52485 FULL_REWRITE_TAC[UNION;UNIONS;IMAGE;SUBSET;closed_ball];
52486 TYPE_THEN `u` UNABBREV_TAC;
52488 ASM_MESON_TAC[h_edge_euclid;subset_imp];
52489 IMATCH_MP_TAC REAL_LE_TRANS;
52490 TYPE_THEN `sqrt(&2) * &2` EXISTS_TAC;
52491 IMATCH_MP_TAC d_euclid_bound2;
52492 FULL_REWRITE_TAC[h_edge];
52493 REWRITE_TAC[coord01];
52494 TYPE_THEN `v` UNABBREV_TAC;
52495 TYPE_THEN `x'` UNABBREV_TAC;
52496 TYPE_THEN `m` UNABBREV_TAC;
52497 THM_INTRO_TAC[`x 0`] floor_ineq;
52498 THM_INTRO_TAC[`x 1`] floor_ineq;
52499 FULL_REWRITE_TAC[int_of_num_th;int_add_th;int_sub_th;int_lt;int_le];
52500 POP_ASSUM_LIST (fun t-> EVERY (map MP_TAC t)) THEN REAL_ARITH_TAC;
52502 FULL_REWRITE_TAC[UNION;UNIONS;IMAGE;SUBSET;closed_ball];
52503 TYPE_THEN `u` UNABBREV_TAC;
52505 ASM_MESON_TAC[v_edge_euclid;subset_imp];
52506 IMATCH_MP_TAC REAL_LE_TRANS;
52507 TYPE_THEN `sqrt(&2) * &2` EXISTS_TAC;
52508 IMATCH_MP_TAC d_euclid_bound2;
52509 FULL_REWRITE_TAC[v_edge];
52510 REWRITE_TAC[coord01];
52511 TYPE_THEN `u` UNABBREV_TAC;
52512 TYPE_THEN `x'` UNABBREV_TAC;
52513 TYPE_THEN `m` UNABBREV_TAC;
52514 THM_INTRO_TAC[`x 0`] floor_ineq;
52515 THM_INTRO_TAC[`x 1`] floor_ineq;
52516 FULL_REWRITE_TAC[int_of_num_th;int_add_th;int_sub_th;int_lt;int_le];
52517 POP_ASSUM_LIST (fun t-> EVERY (map MP_TAC t)) THEN REAL_ARITH_TAC;
52518 (* Thu Dec 30 21:22:53 EST 2004 *)
52523 let simple_arc_grid_properties = prove_by_refinement(
52524 `!C a b. simple_arc_end C a b ==> (?E.
52526 (C INTER (unbounded_set E) = EMPTY) /\
52528 E (h_edge (floor (a 0),floor (a 1))) /\
52529 E (h_edge (floor (b 0),floor (b 1))) /\
52530 (!y. UNIONS (curve_cell E) y ==> (?x. C x /\ d_euclid x y < &4)))`,
52536 USEH 2895 (REWRITE_RULE [simple_arc_end]);
52537 THM_INTRO_TAC[`f`] simple_arc_uniformly_continuous;
52538 FULL_REWRITE_TAC[uniformly_continuous];
52540 TYPE_THEN `!N' x. (&0 < &N') ==> ((&0 <= x/ &N') <=> (&0 <= x))` SUBAGOAL_TAC;
52541 THM_INTRO_TAC[`&N'`;`&0`;`x`] real_div_denom;
52542 FULL_REWRITE_TAC[REAL_DIV_LZERO];
52544 TYPE_THEN `!N' x. (&0 < &N') ==> ((x/ &N' <= &1) <=> (x <= &N'))` SUBAGOAL_TAC;
52545 ASM_SIMP_TAC[REAL_LE_LDIV_EQ];
52548 TYPE_THEN `?N. (!i N'. (N <= N') /\ (i <| N') ==> d_euclid (f (&i / &N')) (f (&(SUC i) / &N')) < &1)` SUBAGOAL_TAC;
52550 FULL_REWRITE_TAC[REAL_ARITH `&0 < &1`];
52551 THM_INTRO_TAC[`delta`] delta_pos_arch;
52552 TYPE_THEN `n` EXISTS_TAC;
52553 FIRST_ASSUM IMATCH_MP_TAC ;
52554 FULL_REWRITE_TAC[GSYM REAL_LT];
52555 FULL_REWRITE_TAC[REAL_LE;REAL_LT;d_real];
52557 TYPE_THEN `0 <| N'` SUBAGOAL_TAC;
52558 UNDH 800 THEN UNDH 3476 THEN ARITH_TAC;
52560 FULL_REWRITE_TAC[REAL_LE;REAL_LT;];
52562 UNDH 9580 THEN ARITH_TAC;
52564 UNDH 9580 THEN ARITH_TAC;
52565 REWRITE_TAC[suc_div];
52566 REWRITE_TAC[REAL_ARITH `abs (x - (x + y)) = abs y`];
52567 REWRITE_TAC[REAL_ABS_DIV;REAL_ABS_NUM];
52568 IMATCH_MP_TAC REAL_LET_TRANS;
52569 TYPE_THEN `&1/ &n`EXISTS_TAC;
52570 FULL_REWRITE_TAC[GSYM REAL_LT];
52571 ASM_SIMP_TAC[RAT_LEMMA4];
52574 THM_INTRO_TAC[`f`] grid_image_bounded_ver2;
52575 TYPE_THEN `n = N +| M` ABBREV_TAC ;
52576 TYPE_THEN`E = grid f n` ABBREV_TAC ;
52577 TYPE_THEN `E` EXISTS_TAC;
52578 TYPE_THEN `0 <| n /\ M <= n /\ N <= n` SUBAGOAL_TAC;
52580 UNDH 8208 THEN UNDH 4600 THEN ARITH_TAC;
52583 TYPE_THEN `E` UNABBREV_TAC;
52584 REWRITE_TAC [ grid_edge];
52588 TYPE_THEN `E` UNABBREV_TAC;
52591 TYPE_THEN `E` UNABBREV_TAC;
52592 IMATCH_MP_TAC grid_conn2;
52594 IMATCH_MP_TAC inj_image_subset;
52596 FIRST_ASSUM IMATCH_MP_TAC ;
52599 TYPE_THEN `E` UNABBREV_TAC;
52601 TYPE_THEN `a` UNABBREV_TAC;
52602 REWRITE_TAC[IMAGE;UNIONS];
52603 CONV_TAC (dropq_conv "u");
52604 TYPE_THEN `0` EXISTS_TAC;
52606 UNDH 3476 THEN ARITH_TAC;
52607 REWRITE_TAC[REAL_DIV_LZERO;grid33_h];
52610 TYPE_THEN `E` UNABBREV_TAC;
52612 TYPE_THEN `b` UNABBREV_TAC;
52613 REWRITE_TAC[IMAGE;UNIONS];
52614 CONV_TAC (dropq_conv "u");
52615 TYPE_THEN `n` EXISTS_TAC;
52618 USEH 3476 (REWRITE_RULE [GSYM REAL_LT]);
52619 USEH 1089 (MATCH_MP (REAL_ARITH `&0 < y ==> ~(y = &0)`));
52620 ASM_SIMP_TAC[REAL_DIV_REFL];
52621 REWRITE_TAC[grid33_h];
52623 TYPE_THEN `E` UNABBREV_TAC;
52624 USEH 2127 (REWRITE_RULE[curve_cell_grid_unions]);
52625 USEH 957 (REWRITE_RULE[IMAGE;UNIONS]);
52626 TYPE_THEN `x` UNABBREV_TAC;
52627 TYPE_THEN `u'` UNABBREV_TAC;
52628 TYPE_THEN `f ( &x' / &n )` EXISTS_TAC;
52630 IMATCH_MP_TAC image_imp ;
52631 FULL_REWRITE_TAC[GSYM REAL_LT];
52632 FULL_REWRITE_TAC[REAL_LE;REAL_LT ];
52635 IMATCH_MP_TAC grid33_radius;
52637 USEH 2083 (REWRITE_RULE[IMAGE]);
52638 USEH 7215 (REWRITE_RULE[INJ]);
52639 FIRST_ASSUM IMATCH_MP_TAC ;
52641 REWRITE_TAC[UNIONS];
52643 (* Thu Dec 30 21:27:32 EST 2004 *)
52648 let unbounded_set_lemma = prove_by_refinement(
52649 `!E p. (FINITE E /\ E SUBSET edge) ==>
52650 (unbounded_set E p <=> (?r. !s. (r <= s) ==>
52651 (?C. simple_arc_end C p (point(s,&0)) /\
52652 (C INTER UNIONS (curve_cell E) = EMPTY))))`,
52656 IMATCH_MP_TAC EQ_ANTISYM;
52658 THM_INTRO_TAC[`E`;`p`] unbounded_euclid;
52659 USEH 7802 (MATCH_MP point_onto);
52660 TYPE_THEN `p` UNABBREV_TAC;
52662 FULL_REWRITE_TAC[unbounded_set;unbounded];
52663 TYPE_THEN `r' = max_real r (FST p' + &1)` ABBREV_TAC ;
52664 TYPE_THEN `r'` EXISTS_TAC;
52665 THM_INTRO_TAC[`E`;`point p'`;`point (s,&0)`] component_simple_arc;
52666 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
52667 THM_INTRO_TAC[`r`;`FST p' + &1`] max_real_le;
52668 TYPE_THEN `s` UNABBREV_TAC;
52669 TYPE_THEN `r'` UNABBREV_TAC;
52670 UNDH 5363 THEN UNDH 4629 THEN REAL_ARITH_TAC;
52671 USEH 3140 (ONCE_REWRITE_RULE[EQ_SYM_EQ]);
52672 FIRST_ASSUM IMATCH_MP_TAC ;
52673 THM_INTRO_TAC[`r`;`FST p' + &1`] max_real_le;
52674 UNDH 1263 THEN UNDH 5669 THEN UNDH 6232 THEN REAL_ARITH_TAC;
52676 REWRITE_TAC[unbounded_set;unbounded];
52677 TYPE_THEN `euclid 2 p` SUBAGOAL_TAC;
52679 FULL_REWRITE_TAC[REAL_ARITH `r <= r`];
52681 USEH 3604 (MATCH_MP simple_arc_end_end);
52682 USEH 3604 (MATCH_MP simple_arc_end_simple);
52683 USEH 3550 (MATCH_MP simple_arc_euclid);
52684 ASM_MESON_TAC[subset_imp];
52685 USEH 7802 (MATCH_MP point_onto);
52686 TYPE_THEN `p` UNABBREV_TAC;
52688 TYPE_THEN `r' = max_real r (FST p' + &1)` ABBREV_TAC ;
52689 TYPE_THEN `r'` EXISTS_TAC;
52690 THM_INTRO_TAC[`E`;`point p'`;`point (s,&0)`] component_simple_arc;
52691 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
52692 THM_INTRO_TAC[`r`;`FST p' + &1`] max_real_le;
52693 UNDH 5363 THEN UNDH 6232 THEN UNDH 5669 THEN UNDH 9420 THEN REAL_ARITH_TAC;
52694 FIRST_ASSUM IMATCH_MP_TAC ;
52695 TYPE_THEN `r'` UNABBREV_TAC;
52696 THM_INTRO_TAC[`r`;`FST p' + &1`] max_real_le;
52697 UNDH 1263 THEN UNDH 540 THEN REAL_ARITH_TAC;
52698 (* Fri Dec 31 07:35:03 EST 2004 *)
52703 let simple_arc_end_subset_trans_lemma = prove_by_refinement(
52704 `!C a b c. simple_arc_end C a b /\ C c /\ ~(c = a) ==>
52705 (?C'. C' SUBSET C /\ simple_arc_end C' a c)`,
52709 TYPE_THEN `b = c` ASM_CASES_TAC;
52710 TYPE_THEN `b` UNABBREV_TAC;
52711 TYPE_THEN `C` EXISTS_TAC;
52712 REWRITE_TAC[SUBSET_REFL];
52713 THM_INTRO_TAC[`C`;`a`;`b`;`c`] simple_arc_end_cut;
52714 TYPE_THEN `C'` EXISTS_TAC;
52715 TYPE_THEN `C` UNABBREV_TAC;
52716 REWRITE_TAC[SUBSET;UNION];
52720 let simple_arc_end_subset_trans = prove_by_refinement(
52721 `!C C' a b c. simple_arc_end C a b /\ simple_arc_end C' b c /\
52723 (?U. simple_arc_end U a c /\ U SUBSET (C UNION C'))`,
52727 TYPE_THEN `C' a` ASM_CASES_TAC;
52728 THM_INTRO_TAC[`C'`;`c`;`b`;`a`] simple_arc_end_subset_trans_lemma;
52729 IMATCH_MP_TAC simple_arc_end_symm;
52730 TYPE_THEN `C''` EXISTS_TAC;
52732 IMATCH_MP_TAC simple_arc_end_symm;
52733 IMATCH_MP_TAC SUBSET_TRANS;
52735 REWRITE_TAC[SUBSET;UNION];
52737 THM_INTRO_TAC[`C`;`{a}`;`C'`] simple_arc_end_restriction;
52739 USEH 2895 (MATCH_MP simple_arc_end_simple);
52741 USEH 2895 (MATCH_MP simple_arc_end_end_closed);
52743 USEH 3594 (MATCH_MP simple_arc_end_closed);
52745 PROOF_BY_CONTR_TAC;
52746 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER;INR IN_SING ];
52747 TYPE_THEN `u` UNABBREV_TAC;
52749 CONJ_TAC THEN REWRITE_TAC[INTER;EMPTY_EXISTS];
52750 TYPE_THEN `a` EXISTS_TAC;
52751 USEH 2895 (MATCH_MP simple_arc_end_end);
52752 TYPE_THEN `b` EXISTS_TAC;
52753 USEH 2895 (MATCH_MP simple_arc_end_end2);
52754 USEH 3594 (MATCH_MP simple_arc_end_end);
52756 TYPE_THEN `v = a` SUBAGOAL_TAC;
52757 USEH 6975 (REWRITE_RULE[eq_sing]);
52758 USEH 8361 (REWRITE_RULE[INTER;INR IN_SING]);
52759 TYPE_THEN `v` UNABBREV_TAC;
52761 TYPE_THEN `v' = c` ASM_CASES_TAC;
52762 TYPE_THEN `v'` UNABBREV_TAC;
52763 TYPE_THEN `C''` EXISTS_TAC;
52764 FULL_REWRITE_TAC[SUBSET;UNION];
52766 THM_INTRO_TAC[`C'`;`c`;`b`;`v'`] simple_arc_end_subset_trans_lemma;
52768 IMATCH_MP_TAC simple_arc_end_symm;
52769 USEH 9287 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
52770 USEH 6723 (MATCH_MP simple_arc_end_symm);
52771 THM_INTRO_TAC[`C''`;`C'''`;`a`;`v'`;`c`] simple_arc_end_trans;
52772 IMATCH_MP_TAC EQ_EXT;
52773 REWRITE_TAC[INTER];
52774 IMATCH_MP_TAC EQ_ANTISYM;
52776 FULL_REWRITE_TAC[INTER;eq_sing;INR IN_SING;SUBSET];
52780 USEH 3266 (MATCH_MP simple_arc_end_end2);
52781 USEH 2088 (MATCH_MP simple_arc_end_end);
52782 TYPE_THEN `C'' UNION C'''` EXISTS_TAC;
52783 FULL_REWRITE_TAC[SUBSET;UNION];
52784 FIRST_ASSUM DISJ_CASES_TAC;
52785 (* Fri Dec 31 08:49:20 EST 2004 *)
52790 let unbounded_set_trans_lemma = prove_by_refinement(
52791 `!E p q x r. FINITE E /\ E SUBSET edge /\
52792 (unbounded_set E p) /\
52793 (UNIONS E SUBSET (closed_ball(euclid 2,d_euclid) x r)) /\
52794 (?C. simple_arc_end C p q /\
52795 (C INTER closed_ball(euclid 2,d_euclid) x r = EMPTY)) ==>
52796 (unbounded_set E q)`,
52800 TYPE_THEN `closure top2 (UNIONS E) SUBSET (closed_ball (euclid 2,d_euclid) x r)` SUBAGOAL_TAC;
52801 IMATCH_MP_TAC closure_subset;
52802 REWRITE_TAC[top2_top];
52804 IMATCH_MP_TAC closed_ball_closed;
52806 THM_INTRO_TAC[`E`] curve_closure_ver2;
52811 TYPE_THEN `C INTER UNIONS (curve_cell E) = EMPTY` SUBAGOAL_TAC;
52812 PROOF_BY_CONTR_TAC;
52813 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
52814 FULL_REWRITE_TAC[EQ_EMPTY ];
52816 FULL_REWRITE_TAC[SUBSET];
52819 UNDH 2166 THEN ASM_SIMP_TAC [unbounded_set_lemma];
52820 TYPE_THEN `euclid 2 q` SUBAGOAL_TAC;
52822 USEH 5276 (MATCH_MP simple_arc_end_simple);
52823 USEH 5276 (MATCH_MP simple_arc_end_end2);
52824 USEH 3550 (MATCH_MP simple_arc_euclid);
52825 ASM_MESON_TAC[subset_imp];
52826 USEH 877 (MATCH_MP point_onto);
52827 TYPE_THEN `q` UNABBREV_TAC;
52829 TYPE_THEN `r'' = max_real r' (FST p' + &1)` ABBREV_TAC ;
52830 TYPE_THEN `r''` EXISTS_TAC;
52833 TYPE_THEN `r' <= s` SUBAGOAL_TAC;
52834 TYPE_THEN `r''` UNABBREV_TAC;
52835 THM_INTRO_TAC[`r'`;`FST p' + &1`] max_real_le;
52836 UNDH 6140 THEN UNDH 3019 THEN REAL_ARITH_TAC;
52838 USEH 9110 (MATCH_MP simple_arc_end_symm);
52840 TYPE_THEN `~(point p' = point (s,&0))` SUBAGOAL_TAC;
52841 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
52842 TYPE_THEN `s` UNABBREV_TAC;
52843 TYPE_THEN `r''` UNABBREV_TAC;
52844 THM_INTRO_TAC[`r'`;`FST p' + &1`] max_real_le;
52845 UNDH 9809 THEN UNDH 7108 THEN REAL_ARITH_TAC;
52846 THM_INTRO_TAC[`C`;`C'`;`point p'`;`p`;`(point(s,&0))`] simple_arc_end_subset_trans;
52847 TYPE_THEN `U` EXISTS_TAC;
52848 PROOF_BY_CONTR_TAC;
52849 FULL_REWRITE_TAC[INTER;EMPTY_EXISTS];
52850 FULL_REWRITE_TAC[SUBSET;UNION;EQ_EMPTY];
52852 (* Fri Dec 31 09:05:35 EST 2004 *)
52857 let unbounded_set_empty = prove_by_refinement(
52858 `(unbounded_set EMPTY = euclid 2)`,
52861 THM_INTRO_TAC[`EMPTY:((num->real)->bool)->bool`] unbound_set_x_axis;
52862 REWRITE_TAC[FINITE_RULES];
52864 FULL_REWRITE_TAC[REAL_ARITH `r <= r`];
52865 IMATCH_MP_TAC EQ_EXT;
52866 IMATCH_MP_TAC EQ_ANTISYM;
52868 IMATCH_MP_TAC unbounded_euclid;
52871 TYPE_THEN `x = (point(r,&0))` ASM_CASES_TAC;
52874 IMATCH_MP_TAC unbounded_set_trans_lemma;
52875 REWRITE_TAC[FINITE_RULES];
52876 TYPE_THEN `point(r,&0)` EXISTS_TAC;
52877 TYPE_THEN `point(&0,&0)` EXISTS_TAC;
52878 TYPE_THEN `-- &1` EXISTS_TAC;
52880 THM_INTRO_TAC[`2`;`point(&0,&0)`;`-- &1`] closed_ball_empty;
52882 TYPE_THEN `mk_segment (point (r,&0)) x` EXISTS_TAC;
52884 IMATCH_MP_TAC mk_segment_simple_arc_end;
52885 REWRITE_TAC[INTER_EMPTY];
52886 (* Fri Dec 31 09:37:30 EST 2004 *)
52891 let continuous_real_const = prove_by_refinement(
52892 `!r. continuous (\t. r) (top_of_metric (UNIV,d_real))
52893 (top_of_metric (UNIV,d_real))`,
52896 REWRITE_TAC[continuous;preimage];
52897 TYPE_THEN `v r` ASM_CASES_TAC;
52898 TYPE_THEN `{x | UNIONS (top_of_metric (UNIV,d_real)) x} = UNIONS (top_of_metric(UNIV,d_real))` SUBAGOAL_TAC;
52899 IMATCH_MP_TAC EQ_EXT;
52900 IMATCH_MP_TAC top_univ;
52901 IMATCH_MP_TAC top_of_metric_top;
52902 REWRITE_TAC[metric_real];
52903 (**** Modified by JRH to avoid GSPEC
52904 REWRITE_TAC[GSYM EMPTY;GSPEC;top_of_metric_empty ];
52906 (let lemma = prove(`{x | F} = {}`,
52907 REWRITE_TAC[EXTENSION; IN_ELIM_THM; NOT_IN_EMPTY]) in
52908 REWRITE_TAC[lemma; top_of_metric_empty])
52909 (* Fri Dec 31 10:30:48 EST 2004 *)
52914 let continuous_real_mul = prove_by_refinement(
52915 `!r. (&0 < r) ==> continuous (( *. ) r)
52916 (top_of_metric (UNIV,d_real))
52917 (top_of_metric (UNIV,d_real)) `,
52921 THM_INTRO_TAC[`( *. ) r`;`UNIV:real->bool`;`UNIV:real->bool`;`d_real`;`d_real`;] metric_continuous_continuous;
52922 REWRITE_TAC[metric_real];
52923 REWRITE_TAC[metric_continuous;metric_continuous_pt];
52924 FULL_REWRITE_TAC[d_real];
52925 TYPE_THEN `epsilon/r` EXISTS_TAC;
52927 IMATCH_MP_TAC REAL_LT_DIV;
52928 UNDH 5576 THEN (ASM_SIMP_TAC[REAL_LT_RDIV_EQ]);
52929 ASM_SIMP_TAC[REAL_ARITH `r * x - r *y = r*. (x - y)`;ABS_MUL ];
52930 UNDH 7175 THEN UNDH 6412 THEN REAL_ARITH_TAC;
52934 let polar_curve_lemma = prove_by_refinement(
52935 `!x theta r. euclid 2 x /\ &0 < theta /\ theta < &2 * pi /\ &0 < r ==>
52937 simple_arc_end C (x + point(r,&0)) (x + r *# (cis theta)) /\
52938 !y. C y ==> (d_euclid x y = r))`,
52942 TYPE_THEN `f = (\ (t:real) . r) ` ABBREV_TAC ;
52943 TYPE_THEN `g = ( *. ) theta` ABBREV_TAC ;
52944 THM_INTRO_TAC[`x`;`f`;`g`] polar_cont;
52945 TYPE_THEN `f` UNABBREV_TAC;
52946 TYPE_THEN `g` UNABBREV_TAC;
52947 ASM_SIMP_TAC [continuous_real_const;continuous_real_mul];
52948 TYPE_THEN `G = (\t. euclid_plus x (f t *# cis (g t))) ` ABBREV_TAC ;
52949 TYPE_THEN `C = IMAGE G {x | &0 <= x /\ x <= &1}` ABBREV_TAC ;
52950 TYPE_THEN `C` EXISTS_TAC;
52951 REWRITE_TAC[simple_arc_end];
52953 TYPE_THEN `G` EXISTS_TAC;
52955 TYPE_THEN `G (&0) = euclid_plus x (point (r,&0)) ` SUBAGOAL_TAC;
52956 TYPE_THEN `G` UNABBREV_TAC;
52958 TYPE_THEN `f` UNABBREV_TAC;
52959 TYPE_THEN `g` UNABBREV_TAC;
52962 REWRITE_TAC[point_scale;COS_0;SIN_0];
52965 TYPE_THEN `G (&1) = euclid_plus x (r *# cis theta)` SUBAGOAL_TAC;
52966 TYPE_THEN `G` UNABBREV_TAC;
52968 TYPE_THEN `f` UNABBREV_TAC;
52969 TYPE_THEN `g` UNABBREV_TAC;
52972 TYPE_THEN `G` UNABBREV_TAC;
52975 IMATCH_MP_TAC euclid_add_closure;
52976 REWRITE_TAC[polar_euclid];
52978 FULL_REWRITE_TAC[euclid_add_cancel];
52979 TYPE_THEN `f` UNABBREV_TAC;
52980 THM_INTRO_TAC[`g x'`;`g y`;`r`;`r`] polar_inj;
52981 TYPE_THEN `g` UNABBREV_TAC;
52982 ASSUME_TAC (REAL_ARITH `&0 < r ==> &0 <= r`);
52983 TYPE_THEN `!x. &0 <= x ==> &0 <= theta* x` SUBAGOAL_TAC;
52984 IMATCH_MP_TAC REAL_LE_MUL;
52985 UNDH 2540 THEN REAL_ARITH_TAC;
52986 TYPE_THEN `!x. (x <= &1) ==> (theta* x < &2 * pi)` SUBAGOAL_TAC;
52987 IMATCH_MP_TAC REAL_LET_TRANS;
52988 TYPE_THEN `theta* &1` EXISTS_TAC;
52990 IMATCH_MP_TAC REAL_LE_LMUL;
52991 UNDH 2540 THEN REAL_ARITH_TAC;
52993 FIRST_ASSUM DISJ_CASES_TAC;
52994 TYPE_THEN `r` UNABBREV_TAC;
52995 UNDH 869 THEN REAL_ARITH_TAC;
52996 TYPE_THEN `g` UNABBREV_TAC;
52997 FULL_REWRITE_TAC[REAL_EQ_MUL_LCANCEL];
52998 FIRST_ASSUM DISJ_CASES_TAC;
52999 TYPE_THEN `theta` UNABBREV_TAC;
53000 UNDH 869 THEN REAL_ARITH_TAC;
53002 TYPE_THEN `C` UNABBREV_TAC;
53003 TYPE_THEN `G` UNABBREV_TAC;
53004 USEH 1547 (REWRITE_RULE[IMAGE]);
53005 TYPE_THEN `f` UNABBREV_TAC;
53006 TYPE_THEN `g` UNABBREV_TAC;
53007 TYPE_THEN `d_euclid x (euclid_plus x (r *# cis (theta * x'))) = d_euclid (x + (&0 *# (cis (theta * x')))) (euclid_plus x (r *# cis (theta * x')))` SUBAGOAL_TAC;
53010 REWRITE_TAC[euclid_scale0;euclid_rzero];
53011 THM_INTRO_TAC[`2`;`(&0 *# cis (theta * x'))`;`(r *# cis (theta * x'))`;`x`] metric_translate_LEFT;
53012 REWRITE_TAC[polar_euclid];
53013 REWRITE_TAC[d_euclid_eq_arg];
53014 UNDH 6412 THEN REAL_ARITH_TAC;
53015 (* Fri Dec 31 11:25:13 EST 2004 *)
53020 let unbounded_set_ball = prove_by_refinement(
53021 `!E x r p. (&0 < r) /\
53022 FINITE E /\ E SUBSET edge /\ (euclid 2 p) /\
53023 UNIONS E SUBSET (closed_ball (euclid 2,d_euclid) x r) /\
53024 ~(closed_ball (euclid 2,d_euclid) x r p) ==>
53025 unbounded_set E p`,
53030 THM_INTRO_TAC[`E`] unbound_set_x_axis;
53032 TYPE_THEN `E = EMPTY` ASM_CASES_TAC;
53033 FULL_REWRITE_TAC[unbounded_set_empty];
53034 TYPE_THEN `UNIONS E = EMPTY` ASM_CASES_TAC;
53035 FULL_REWRITE_TAC[UNIONS_EQ_EMPTY];
53037 TYPE_THEN `E` UNABBREV_TAC;
53038 USEH 8908(REWRITE_RULE[SUBSET;INR IN_SING ]);
53039 TYPE_THEN `edge EMPTY` SUBAGOAL_TAC;
53040 USEH 1936 (MATCH_MP edge_cell);
53041 USEH 5731 (MATCH_MP cell_nonempty);
53043 FULL_REWRITE_TAC[EMPTY_EXISTS];
53045 TYPE_THEN `euclid 2 x` SUBAGOAL_TAC;
53046 FULL_REWRITE_TAC[SUBSET;closed_ball];
53048 USEH 1837 (MATCH_MP point_onto);
53049 TYPE_THEN `x` UNABBREV_TAC;
53051 TYPE_THEN `!x. (FST p' + r < x) ==> unbounded_set E (point(x,&0))` SUBAGOAL_TAC;
53052 TYPE_THEN `r' <= x'` ASM_CASES_TAC;
53053 IMATCH_MP_TAC unbounded_set_trans_lemma;
53054 TYPE_THEN `point(r',&0)` EXISTS_TAC;
53055 TYPE_THEN `point p'` EXISTS_TAC;
53056 TYPE_THEN `r` EXISTS_TAC;
53058 FIRST_ASSUM IMATCH_MP_TAC ;
53060 TYPE_THEN `mk_segment (point (r',&0)) (point(x',&0))` EXISTS_TAC;
53062 IMATCH_MP_TAC mk_segment_simple_arc_end;
53063 REWRITE_TAC[point_inj;PAIR_SPLIT];
53064 TYPE_THEN `x'` UNABBREV_TAC;
53065 UNDH 7236 THEN REAL_ARITH_TAC;
53066 ONCE_REWRITE_TAC[mk_segment_sym];
53067 PROOF_BY_CONTR_TAC;
53068 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
53069 THM_INTRO_TAC[`x'`;`r'`;`&0`;`u''`]mk_segment_h;
53070 UNDH 7636 THEN REAL_ARITH_TAC;
53072 TYPE_THEN `u''` UNABBREV_TAC;
53073 USEH 7067 (REWRITE_RULE[closed_ball]);
53074 THM_INTRO_TAC[`2`;`point p'`;`point(t,&0)`;`0`]proj_contraction;
53075 FULL_REWRITE_TAC[coord01];
53076 UNDH 9207 THEN UNDH 6790 THEN UNDH 9670 THEN UNDH 2823 THEN REAL_ARITH_TAC;
53082 TYPE_THEN `?R theta. r < R /\ &0 <= theta /\ theta < &2 * pi /\ (p = (point p') + (R *# cis theta))` SUBAGOAL_TAC;
53083 FULL_REWRITE_TAC[closed_ball];
53084 TYPE_THEN `?q. (euclid 2 q) /\ (p = point p' + q) ` SUBAGOAL_TAC;
53085 TYPE_THEN `euclid_minus p (point p')` EXISTS_TAC;
53087 IMATCH_MP_TAC euclid_sub_closure;
53088 IMATCH_MP_TAC EQ_EXT;
53089 REWRITE_TAC[euclid_plus;euclid_minus];
53091 TYPE_THEN `p` UNABBREV_TAC;
53093 USEH 877 (MATCH_MP polar_exist);
53094 TYPE_THEN `q` UNABBREV_TAC;
53095 TYPE_THEN `r'` EXISTS_TAC ;
53096 TYPE_THEN `t` EXISTS_TAC;
53098 PROOF_BY_CONTR_TAC;
53099 UNDH 1925 THEN ASM_REWRITE_TAC[];
53101 THM_INTRO_TAC[`2`;`&0 *# cis t`;`r' *# cis t`;`point p'`] metric_translate_LEFT;
53102 REWRITE_TAC[polar_euclid];
53103 TYPE_THEN `point p' + &0 *# cis t = point p'` SUBAGOAL_TAC;
53104 REWRITE_TAC[euclid_scale0;euclid_rzero];
53106 REWRITE_TAC[d_euclid_eq_arg];
53107 UNDH 3665 THEN UNDH 1444 THEN REAL_ARITH_TAC;
53109 TYPE_THEN `unbounded_set E (point (FST p' + R,SND p'))` SUBAGOAL_TAC;
53110 TYPE_THEN `SND p' = &0` ASM_CASES_TAC;
53111 FIRST_ASSUM IMATCH_MP_TAC ;
53112 UNDH 8204 THEN REAL_ARITH_TAC;
53113 IMATCH_MP_TAC unbounded_set_trans_lemma;
53114 TYPE_THEN `point (FST p' +R, &0)` EXISTS_TAC;
53115 TYPE_THEN `point p'` EXISTS_TAC;
53116 TYPE_THEN `r` EXISTS_TAC;
53118 FIRST_ASSUM IMATCH_MP_TAC ;
53119 UNDH 8204 THEN REAL_ARITH_TAC;
53120 TYPE_THEN `mk_segment (point (FST p' + R,&0)) (point(FST p' + R,SND p'))` EXISTS_TAC;
53122 IMATCH_MP_TAC mk_segment_simple_arc_end;
53123 REWRITE_TAC[point_inj;PAIR_SPLIT];
53124 UNDH 5038 THEN ASM_REWRITE_TAC[];
53126 TYPE_THEN `&0 <= SND p'` ASM_CASES_TAC;
53127 PROOF_BY_CONTR_TAC;
53128 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
53129 THM_INTRO_TAC[`&0`;`SND p'`;`FST p' + R`;`u`]mk_segment_v;
53131 TYPE_THEN `u` UNABBREV_TAC;
53132 FULL_REWRITE_TAC[closed_ball];
53133 THM_INTRO_TAC[`2`;`point p'`;`point (FST p' + R,t)`;`0`] proj_contraction;
53134 FULL_REWRITE_TAC[coord01];
53135 UNDH 643 THEN UNDH 8188 THEN UNDH 8204 THEN UNDH 6412 THEN REAL_ARITH_TAC;
53137 ONCE_REWRITE_TAC[mk_segment_sym];
53138 PROOF_BY_CONTR_TAC;
53139 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
53140 THM_INTRO_TAC[`SND p'`;`&0`;`FST p' + R`;`u`]mk_segment_v;
53141 UNDH 2479 THEN REAL_ARITH_TAC;
53143 TYPE_THEN `u` UNABBREV_TAC;
53144 FULL_REWRITE_TAC[closed_ball];
53145 THM_INTRO_TAC[`2`;`point p'`;`point (FST p' + R,t)`;`0`] proj_contraction;
53146 FULL_REWRITE_TAC[coord01];
53147 UNDH 643 THEN UNDH 8188 THEN UNDH 8204 THEN UNDH 6412 THEN REAL_ARITH_TAC;
53149 TYPE_THEN `theta= &0` ASM_CASES_TAC ;
53150 REWRITE_TAC[cis;COS_0;SIN_0;point_scale];
53151 TYPE_THEN `point p' + point (R * &1, R* &0) = point (FST p' + R , SND p')` SUBAGOAL_TAC;
53152 IMATCH_MP_TAC EQ_SYM;
53153 ONCE_REWRITE_TAC[euclid_add_comm];
53154 REWRITE_TAC[euclid_cancel1];
53155 REWRITE_TAC[euclid_minus_scale;point_scale;point_add;point_inj;PAIR_SPLIT];
53159 IMATCH_MP_TAC unbounded_set_trans_lemma;
53160 TYPE_THEN `point (FST p' + R,SND p')` EXISTS_TAC;
53161 TYPE_THEN `point p'` EXISTS_TAC;
53162 TYPE_THEN `r` EXISTS_TAC;
53163 THM_INTRO_TAC[`point p'`;`theta`;`R`] polar_curve_lemma;
53164 UNDH 6412 THEN UNDH 8204 THEN UNDH 6162 THEN UNDH 4026 THEN REAL_ARITH_TAC;
53165 TYPE_THEN `C` EXISTS_TAC;
53168 TYPE_THEN `?u v. (p' = (u,v))` SUBAGOAL_TAC ;
53169 REWRITE_TAC[PAIR_SPLIT];
53171 TYPE_THEN `p'` UNABBREV_TAC;
53172 FULL_REWRITE_TAC[point_add;REAL_ARITH `x + &0 = x`];
53174 PROOF_BY_CONTR_TAC;
53175 FULL_REWRITE_TAC[INTER;EMPTY_EXISTS];
53176 USEH 3064 (REWRITE_RULE[closed_ball]);
53178 TYPE_THEN `R` UNABBREV_TAC;
53179 UNDH 8265 THEN UNDH 4705 THEN REAL_ARITH_TAC;
53180 (* Fri Dec 31 12:28:22 EST 2004 *)
53186 let unbounded_connect = prove_by_refinement(
53187 `!E p q. FINITE E /\ E SUBSET edge /\ ~(p = q) /\
53188 unbounded_set E p /\ unbounded_set E q ==>
53189 (?C. C SUBSET unbounded_set E /\ simple_arc_end C p q)`,
53193 TYPE_THEN `(?r. !s. r <= s ==> (?C. simple_arc_end C p (point (s,&0)) /\ (C INTER UNIONS (curve_cell E) = {})))` SUBAGOAL_TAC;
53194 ASM_MESON_TAC[unbounded_set_lemma];
53195 TYPE_THEN `(?r. !s. r <= s ==> (?C. simple_arc_end C q (point (s,&0)) /\ (C INTER UNIONS (curve_cell E) = {})))` SUBAGOAL_TAC;
53196 ASM_MESON_TAC[unbounded_set_lemma];
53197 TYPE_THEN `r'' = max_real r r'` ABBREV_TAC ;
53200 THM_INTRO_TAC[`r`;`r'`] max_real_le;
53201 UNDH 4459 THEN DISCH_THEN (THM_INTRO_TAC[]);
53202 UNDH 6887 THEN UNDH 2 THEN REAL_ARITH_TAC;
53203 UNDH 5611 THEN DISCH_THEN (THM_INTRO_TAC[]);
53204 UNDH 7318 THEN UNDH 2 THEN REAL_ARITH_TAC;
53205 THM_INTRO_TAC[`C`;`C'`;`p`;`point(r'',&0)`;`q`] simple_arc_end_subset_trans;
53206 IMATCH_MP_TAC simple_arc_end_symm;
53207 TYPE_THEN `U` EXISTS_TAC;
53209 THM_INTRO_TAC[`E`] unbounded_set_comp;
53210 THM_INTRO_TAC[`E`;`x`] unbounded_set_comp_elt;
53211 THM_INTRO_TAC[`E`;`x`;`p`] unbounded_comp_unique;
53212 REWRITE_TAC[GSYM unbounded_set];
53213 IMATCH_MP_TAC rectagon_curve;
53214 TYPE_THEN `q` EXISTS_TAC;
53216 PROOF_BY_CONTR_TAC;
53217 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
53218 FULL_REWRITE_TAC[SUBSET;UNION];
53219 FULL_REWRITE_TAC[EQ_EMPTY];
53221 (* Fri Dec 31 16:38:36 EST 2004 *)
53226 let simple_arc_conn_complement = prove_by_refinement(
53227 `!C p q. simple_arc top2 C /\ ~C p /\ ~C q /\
53228 (euclid 2 p) /\ ~(p = q) /\
53229 (euclid 2 q) ==> (?A. simple_arc_end A p q /\ (C INTER A = EMPTY))`,
53233 PROOF_BY_CONTR_TAC;
53234 THM_INTRO_TAC[`C`;`p`;`q`] euclid_scale_simple_arc_ver2;
53238 KILLH 907 THEN KILLH 877 THEN KILLH 7802 THEN KILLH 6497 THEN KILLH 9726 THEN KILLH 3550 THEN KILLH 11;
53239 (* - simple-arc-grid-properties *)
53240 TYPE_THEN `!i. (?E. (i <| N) ==> ( E SUBSET edge /\ (B i INTER (unbounded_set E) = EMPTY) /\ conn2 E /\ E (h_edge (floor (a i 0),floor (a i 1))) /\ E (h_edge (floor (a (SUC i) 0),floor (a (SUC i) 1))) /\ (!y. UNIONS (curve_cell E) y ==> (?x. B i x /\ d_euclid x y < &4))))` SUBAGOAL_TAC;
53243 USEH 9744 (MATCH_MP simple_arc_grid_properties);
53244 TYPE_THEN `E` EXISTS_TAC;
53246 (* - conn2-sequence *)
53247 THM_INTRO_TAC[`E`;`N-1`] conn2_sequence;
53249 TYPE_THEN `!i. (i <=| N- 1) ==> (i <| N)` SUBAGOAL_TAC;
53250 UNDH 7562 THEN UNDH 6077 THEN ARITH_TAC;
53251 TYPE_THEN `(!i. i <=| N- 1 ==> conn2 (E i))` SUBAGOAL_TAC;
53253 UNDH 7200 THEN DISCH_THEN (THM_INTRO_TAC[]);
53256 TYPE_THEN `!i. (i <= N-| 1) ==> (E i SUBSET edge)` SUBAGOAL_TAC;
53258 UNDH 7200 THEN DISCH_THEN (THM_INTRO_TAC[]);
53261 TYPE_THEN `(!i. (SUC i <= N -| 1) ==> ~(E i INTER E (SUC i) = {}))` SUBAGOAL_TAC;
53262 UNDH 6943 THEN REWRITE_TAC[EMPTY_EXISTS;INTER];
53263 TYPE_THEN `h_edge (floor (a (SUC i) 0), floor (a (SUC i) 1))` EXISTS_TAC;
53266 UNDH 7200 THEN DISCH_THEN (THM_INTRO_TAC[]);
53267 UNDH 1989 THEN UNDH 7562 THEN ARITH_TAC;
53268 TSPECH `SUC i` 2188;
53269 UNDH 395 THEN DISCH_THEN (THM_INTRO_TAC[]);
53272 TYPE_THEN `(!i j. i <| j /\ j <=| N -| 1 /\ ~(SUC i = j) ==> (curve_cell (E i) INTER curve_cell (E j) = {}))` SUBAGOAL_TAC;
53273 PROOF_BY_CONTR_TAC;
53274 USEH 2591 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
53275 TYPE_THEN `~(u = EMPTY)` SUBAGOAL_TAC THENL [IMATCH_MP_TAC cell_nonempty ; ALL_TAC];
53276 THM_INTRO_TAC[`E i`] curve_cell_cell;
53277 FIRST_ASSUM IMATCH_MP_TAC ;
53278 UNDH 2236 THEN UNDH 2835 THEN ARITH_TAC;
53279 ASM_MESON_TAC[subset_imp];
53280 USEH 1008 (REWRITE_RULE[EMPTY_EXISTS]);
53282 TYPE_THEN `euclid 2 u'` SUBAGOAL_TAC;
53283 IMATCH_MP_TAC subset_imp;
53284 TYPE_THEN `u` EXISTS_TAC;
53285 IMATCH_MP_TAC cell_euclid;
53286 IMATCH_MP_TAC subset_imp;
53287 TYPE_THEN `curve_cell (E j)` EXISTS_TAC;
53288 IMATCH_MP_TAC curve_cell_cell;
53290 TYPE_THEN `(?x. B i x /\ d_euclid x u' < &4)` SUBAGOAL_TAC;
53292 UNDH 7200 THEN DISCH_THEN (THM_INTRO_TAC[]);
53293 UNDH 2236 THEN UNDH 2835 THEN ARITH_TAC;
53294 FIRST_ASSUM IMATCH_MP_TAC ;
53295 REWRITE_TAC[UNIONS];
53298 TYPE_THEN `(?y. B j y /\ d_euclid y u' < &4)` SUBAGOAL_TAC;
53300 UNDH 7711 THEN DISCH_THEN (THM_INTRO_TAC[]);
53301 FIRST_ASSUM IMATCH_MP_TAC ;
53302 REWRITE_TAC[UNIONS];
53305 UNDH 1512 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`x`;`y`]);
53306 UNDH 5462 THEN UNDH 2236 THEN ARITH_TAC;
53308 TYPE_THEN `!k x. B k x /\ (k <| N) ==> euclid 2 x` SUBAGOAL_TAC;
53309 UNDH 4963 THEN DISCH_THEN (THM_INTRO_TAC[`k`]);
53310 USEH 120 (MATCH_MP simple_arc_end_simple);
53311 USEH 6892 (MATCH_MP simple_arc_euclid);
53312 IMATCH_MP_TAC subset_imp;
53314 TYPE_THEN `euclid 2 x /\ euclid 2 y` SUBAGOAL_TAC;
53315 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
53316 TYPE_THEN `i` EXISTS_TAC;
53317 UNDH 2236 THEN UNDH 2835 THEN ARITH_TAC;
53318 TYPE_THEN `j` EXISTS_TAC;
53320 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`x`;`u'`;`y`] metric_space_triangle;
53321 TYPE_THEN `d_euclid x y <= &8` SUBAGOAL_TAC;
53322 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`y`;`u'`] metric_space_symm;
53323 UNDH 8326 THEN UNDH 204 THEN UNDH 2611 THEN UNDH 2778 THEN REAL_ARITH_TAC;
53324 UNDH 6749 THEN UNDH 4559 THEN UNDH 6444 THEN REAL_ARITH_TAC;
53327 TYPE_THEN `E' = UNIONS (IMAGE E {i | i <=| N -| 1})` ABBREV_TAC ;
53328 TYPE_THEN `E' SUBSET edge` SUBAGOAL_TAC;
53329 TYPE_THEN `E'` UNABBREV_TAC;
53330 REWRITE_TAC[IMAGE;UNIONS;SUBSET];
53331 TYPE_THEN `u` UNABBREV_TAC;
53333 UNDH 1746 THEN DISCH_THEN (THM_INTRO_TAC[]);
53334 IMATCH_MP_TAC subset_imp;
53337 TYPE_THEN `FINITE E'` SUBAGOAL_TAC;
53338 TYPE_THEN `E'` UNABBREV_TAC;
53339 THM_INTRO_TAC[`IMAGE E {i | i <=| N -| 1}`] FINITE_FINITE_UNIONS;
53340 IMATCH_MP_TAC FINITE_IMAGE;
53341 REWRITE_TAC[FINITE_NUMSEG_LE];
53342 USEH 3282 (REWRITE_RULE[IMAGE]);
53343 UNDH 2188 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
53344 FULL_REWRITE_TAC[conn2];
53346 TYPE_THEN `C' INTER unbounded_set E' = EMPTY` SUBAGOAL_TAC;
53347 PROOF_BY_CONTR_TAC;
53348 USEH 8327 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
53349 USEH 3168 (REWRITE_RULE [UNIONS;IMAGE]);
53350 TYPE_THEN `u'` UNABBREV_TAC;
53353 USEH 2251 (REWRITE_RULE[INTER;EQ_EMPTY]);
53355 UNDH 5490 THEN ASM_REWRITE_TAC[];
53356 IMATCH_MP_TAC unbounded_avoidance_subset_ver2;
53357 TYPE_THEN `E'` EXISTS_TAC;
53358 TYPE_THEN `E'` UNABBREV_TAC;
53359 REWRITE_TAC[SUBSET;UNIONS;IMAGE];
53360 CONV_TAC (dropq_conv "u");
53361 TYPE_THEN `x` EXISTS_TAC;
53362 UNDH 5971 THEN ARITH_TAC;
53364 TYPE_THEN `unbounded_set E' p' /\ unbounded_set E' q'` ASM_CASES_TAC;
53365 THM_INTRO_TAC[`E'`;`p'`;`q'`] unbounded_connect;
53367 USEH 8696 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
53368 USEH 5828 (REWRITE_RULE[SUBSET]);
53369 USEH 6174 (REWRITE_RULE[INTER;EQ_EMPTY]);
53372 UNDH 362 THEN ASM_REWRITE_TAC[];
53374 TYPE_THEN `N = 1` ASM_CASES_TAC;
53375 TYPE_THEN `N` UNABBREV_TAC;
53376 FULL_REWRITE_TAC[ARITH_RULE `i <| 1 <=> (i = 0)`];
53377 FULL_REWRITE_TAC[ARITH_RULE `i <= 1 -| 1 <=> (i = 0)`];
53379 TYPE_THEN `0 = 0` SUBAGOAL_TAC;
53380 TYPE_THEN `{i | i = 0} = {0}` SUBAGOAL_TAC;
53381 IMATCH_MP_TAC EQ_EXT;
53384 FULL_REWRITE_TAC[image_sing];
53385 TYPE_THEN `E'` UNABBREV_TAC;
53386 TYPE_THEN `C'` UNABBREV_TAC;
53388 UNDH 9174 THEN DISCH_THEN (THM_INTRO_TAC[]);
53390 UNDH 5439 THEN REWRITE_TAC[];
53391 TYPE_THEN `!p. (!x. B 0 x ==> &8 *d <= d_euclid x p) /\ (euclid 2 p) ==> unbounded_set (E 0) p` SUBAGOAL_TAC;
53392 IMATCH_MP_TAC unbounded_set_ball;
53393 TYPE_THEN `x` EXISTS_TAC;
53394 TYPE_THEN `&7* d` EXISTS_TAC;
53396 IMATCH_MP_TAC REAL_LT_MUL;
53397 UNDH 5147 THEN REAL_ARITH_TAC;
53400 REWRITE_TAC[SUBSET;closed_ball];
53403 UNDH 9405 THEN DISCH_THEN (THM_INTRO_TAC[]);
53404 USEH 4758 (MATCH_MP simple_arc_end_simple);
53405 USEH 6872 (MATCH_MP simple_arc_euclid);
53406 IMATCH_MP_TAC subset_imp;
53407 TYPE_THEN `B 0` EXISTS_TAC;
53409 USEH 6028 (REWRITE_RULE[UNIONS]);
53410 IMATCH_MP_TAC subset_imp;
53411 TYPE_THEN `u` EXISTS_TAC;
53412 IMATCH_MP_TAC cell_euclid;
53413 IMATCH_MP_TAC edge_cell;
53414 IMATCH_MP_TAC subset_imp;
53415 TYPE_THEN `E 0` EXISTS_TAC;
53417 UNDH 7489 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
53418 IMATCH_MP_TAC subset_imp;
53419 TYPE_THEN `UNIONS (E 0)` EXISTS_TAC;
53420 IMATCH_MP_TAC UNIONS_UNIONS;
53421 REWRITE_TAC[SUBSET];
53422 USEH 361 (REWRITE_RULE[SUBSET]);
53423 ASM_SIMP_TAC[curve_cell_edge];
53424 USEH 5290 (REWRITE_RULE[SUBSET;open_ball]);
53428 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`x`;`x''`;`x'`] metric_space_triangle;
53429 TYPE_THEN `d_euclid x x' <= d + &4` SUBAGOAL_TAC;
53430 UNDH 8092 THEN UNDH 8809 THEN UNDH 9378 THEN REAL_ARITH_TAC;
53431 IMATCH_MP_TAC REAL_LE_TRANS;
53432 TYPE_THEN `d + &4` EXISTS_TAC;
53433 UNDH 5147 THEN REAL_ARITH_TAC;
53435 USEH 129 (REWRITE_RULE[closed_ball]);
53437 UNDH 6465 THEN UNDH 5617 THEN UNDH 5147 THEN REAL_ARITH_TAC;
53439 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
53441 TYPE_THEN `0 <| N -| 1` SUBAGOAL_TAC;
53442 UNDH 426 THEN UNDH 7562 THEN ARITH_TAC;
53444 UNDH 7535 THEN REWRITE_TAC[];
53446 TYPE_THEN `!p. (euclid 2 p) /\ (!i. (SUC i <= (N-1)) ==> (&8 * d <= d_euclid (a (SUC i)) p)) ==> (unbounded_set E' p)` BACK_TAC;
53447 TYPE_THEN `!i. (SUC i <= (N-1)) ==> C' (a (SUC i))` SUBAGOAL_TAC;
53448 REWRITE_TAC[UNIONS;IMAGE];
53449 CONV_TAC (dropq_conv ("u"));
53450 TYPE_THEN `i` EXISTS_TAC;
53452 UNDH 1989 THEN ARITH_TAC;
53454 TYPE_THEN `i <| N` SUBAGOAL_TAC;
53455 UNDH 1989 THEN ARITH_TAC;
53456 USEH 9744 (MATCH_MP simple_arc_end_end2);
53457 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC ) THEN REP_BASIC_TAC THEN ASM_MESON_TAC[];
53459 FIRST_ASSUM IMATCH_MP_TAC ;
53460 UNDH 8137 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
53461 KILLH 6656 THEN KILLH 1512 THEN KILLH 7562 THEN KILLH 6444 THEN KILLH 7694 THEN KILLH 9229 THEN KILLH 2174 THEN KILLH 9099 THEN KILLH 3258 THEN KILLH 6487;
53463 UNDH 2188 THEN DISCH_THEN (THM_INTRO_TAC[`i`]);
53464 UNDH 1989 THEN ARITH_TAC;
53465 UNDH 2188 THEN DISCH_THEN (THM_INTRO_TAC[`SUC i`]);
53466 KILLH 5053 THEN KILLH 8136 THEN KILLH 5388 THEN KILLH 6737;
53468 IMATCH_MP_TAC unbounded_set_ball;
53469 TYPE_THEN `a(SUC i)` EXISTS_TAC;
53470 TYPE_THEN `&7 *d` EXISTS_TAC;
53473 IMATCH_MP_TAC REAL_LT_MUL;
53474 UNDH 5147 THEN REAL_ARITH_TAC;
53477 REWRITE_TAC[ FINITE_UNION];
53478 FULL_REWRITE_TAC[conn2];
53479 REWRITE_TAC[union_subset];
53480 REWRITE_TAC[UNIONS_UNION;union_subset];
53482 IMATCH_MP_TAC (TAUT `a/\ b ==> b/\ a`);
53484 USEH 9183 (REWRITE_RULE[closed_ball]);
53485 UNDH 6641 THEN UNDH 3603 THEN UNDH 5147 THEN REAL_ARITH_TAC;
53487 TYPE_THEN `!i x. (i <| N) /\ (B i x) ==> euclid 2 x` SUBAGOAL_TAC;
53488 UNDH 4963 THEN DISCH_THEN (THM_INTRO_TAC[`i'`]);
53489 USEH 9316 (MATCH_MP simple_arc_end_simple);
53490 USEH 5604 (MATCH_MP simple_arc_euclid);
53491 USEH 2996 (REWRITE_RULE[SUBSET]);
53494 TSPECH `SUC i` 3219;
53496 TYPE_THEN `(i <| N) /\ (SUC i <| N)` SUBAGOAL_TAC;
53497 UNDH 1989 THEN ARITH_TAC;
53501 TYPE_THEN `B i (a(SUC i))` SUBAGOAL_TAC;
53503 USEH 9744 (MATCH_MP simple_arc_end_end2);
53505 TYPE_THEN `B (SUC i) (a (SUC i))` SUBAGOAL_TAC;
53506 TSPECH `SUC i` 4963;
53507 USEH 9147 (MATCH_MP simple_arc_end_end);
53509 REWRITE_TAC[SUBSET;closed_ball];
53510 TYPE_THEN `euclid 2 (a(SUC i))` SUBAGOAL_TAC;
53512 TYPE_THEN `!i x y. (i <| N) /\ B i x /\ B i y /\ (euclid 2 x) /\ (euclid 2 y) ==> (d_euclid x y < &2 *d)` SUBAGOAL_TAC;
53513 IMATCH_MP_TAC BALL_DIST;
53514 TYPE_THEN `euclid 2` EXISTS_TAC;
53515 UNDH 4673 THEN DISCH_THEN (THM_INTRO_TAC[`i'`]);
53516 TYPE_THEN `x'` EXISTS_TAC;
53518 IMATCH_MP_TAC subset_imp;
53519 TYPE_THEN `B i'` EXISTS_TAC;
53520 IMATCH_MP_TAC subset_imp;
53521 TYPE_THEN `B i'` EXISTS_TAC;
53523 KILLH 3302 THEN KILLH 6317 THEN KILLH 4963 THEN KILLH 4847;
53524 KILLH 4673 THEN KILLH 3226 THEN KILLH 9755 THEN KILLH 8762 THEN KILLH 6174;
53525 KILLH 7802 THEN KILLH 3603 THEN KILLH 5957;
53527 TYPE_THEN `(!x. (euclid 2 x) /\ (?y. (euclid 2 y) /\ (d_euclid y x < &4) /\ (d_euclid (a (SUC i)) y < &2 * d)) ==> (d_euclid (a (SUC i)) x <= &7 *d))` SUBAGOAL_TAC;
53528 THM_INTRO_TAC[`euclid 2`;`d_euclid`;`a(SUC i)`;`y`;`x`] metric_space_triangle;
53529 UNDH 8917 THEN UNDH 3588 THEN UNDH 1391 THEN UNDH 5147 THEN REAL_ARITH_TAC;
53531 TYPE_THEN `!G x. G SUBSET edge /\ UNIONS G x ==> (euclid 2 x /\ UNIONS (curve_cell G) x)` SUBAGOAL_TAC;
53532 USEH 6599 (REWRITE_RULE[UNIONS]);
53533 TYPE_THEN `edge u` SUBAGOAL_TAC;
53534 IMATCH_MP_TAC subset_imp;
53535 TYPE_THEN `G` EXISTS_TAC;
53537 USEH 9350 (MATCH_MP edge_euclid2);
53538 IMATCH_MP_TAC subset_imp;
53539 TYPE_THEN `u` EXISTS_TAC;
53540 REWRITE_TAC[UNIONS];
53541 TYPE_THEN `u` EXISTS_TAC;
53542 ASM_SIMP_TAC[curve_cell_edge];
53545 UNDH 6604 THEN DISCH_THEN (THM_INTRO_TAC[`E i`;`x`]);
53546 UNDH 404 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
53547 FIRST_ASSUM IMATCH_MP_TAC ;
53548 TYPE_THEN `x'` EXISTS_TAC;
53549 FIRST_ASSUM IMATCH_MP_TAC ;
53550 TYPE_THEN `i` EXISTS_TAC;
53552 UNDH 6604 THEN DISCH_THEN (THM_INTRO_TAC[`E (SUC i)`;`x`]);
53553 UNDH 9352 THEN DISCH_THEN (THM_INTRO_TAC[`x`]);
53554 FIRST_ASSUM IMATCH_MP_TAC ;
53555 TYPE_THEN `x'` EXISTS_TAC;
53556 FIRST_ASSUM IMATCH_MP_TAC ;
53557 TYPE_THEN `SUC i` EXISTS_TAC;
53558 (* Sat Jan 1 19:23:34 EST 2005 *)
53564 jordan_def `cut_arc C v w = @B. simple_arc_end B v w /\ B SUBSET C`;;
53566 let cut_arc_symm = prove_by_refinement(
53567 `!C v w. cut_arc C v w = cut_arc C w v`,
53570 REWRITE_TAC[cut_arc];
53571 TYPE_THEN `!B. simple_arc_end B v w = simple_arc_end B w v` SUBAGOAL_TAC;
53572 MESON_TAC[simple_arc_end_symm];
53576 let cut_arc_simple = prove_by_refinement(
53577 `!C v w. simple_arc top2 C /\ C v /\ C w /\ ~(v = w) ==>
53578 simple_arc_end (cut_arc C v w) v w`,
53581 REWRITE_TAC[cut_arc];
53583 ASM_MESON_TAC[simple_arc_end_select];
53587 let cut_arc_subset = prove_by_refinement(
53588 `!C v w. simple_arc top2 C /\ C v /\ C w /\ ~(v = w) ==>
53589 cut_arc C v w SUBSET C`,
53592 REWRITE_TAC[cut_arc];
53594 ASM_MESON_TAC[simple_arc_end_select];
53598 let cut_arc_unique = prove_by_refinement(
53599 `!C v w B. simple_arc top2 C /\ (B SUBSET C) /\ simple_arc_end B v w
53600 ==> (cut_arc C v w = B)`,
53604 IMATCH_MP_TAC simple_arc_end_inj;
53605 TYPE_THEN `C` EXISTS_TAC;
53606 TYPE_THEN `v` EXISTS_TAC;
53607 TYPE_THEN `w` EXISTS_TAC;
53608 TYPE_THEN `~(v = w)` SUBAGOAL_TAC THENL[ (IMATCH_MP_TAC simple_arc_end_distinct);ALL_TAC];
53609 TYPE_THEN `B` EXISTS_TAC;
53610 TYPE_THEN `C v` SUBAGOAL_TAC;
53611 IMATCH_MP_TAC subset_imp;
53612 TYPE_THEN `B` EXISTS_TAC;
53613 IMATCH_MP_TAC simple_arc_end_end;
53614 TYPE_THEN `w` EXISTS_TAC;
53615 TYPE_THEN `C w` SUBAGOAL_TAC ;
53616 IMATCH_MP_TAC subset_imp;
53617 TYPE_THEN `B` EXISTS_TAC;
53618 IMATCH_MP_TAC simple_arc_end_end2;
53620 ASM_MESON_TAC [cut_arc_subset;cut_arc_simple];
53624 let cut_arc_inter = prove_by_refinement(
53625 `!C u v w. simple_arc_end C v w /\ C u /\ ~(u = v) /\ ~(u = w) ==>
53626 (cut_arc C v u INTER cut_arc C u w = {u}) /\
53627 (cut_arc C v u UNION cut_arc C u w = C)`,
53631 THM_INTRO_TAC[`C`;`v`;`w`;`u`] simple_arc_end_cut;
53632 TYPE_THEN `simple_arc top2 C` SUBAGOAL_TAC;
53633 USEH 8829 (MATCH_MP simple_arc_end_simple);
53634 TYPE_THEN `cut_arc C v u = C'` SUBAGOAL_TAC;
53635 IMATCH_MP_TAC cut_arc_unique;
53636 TYPE_THEN `C` UNABBREV_TAC;
53637 REWRITE_TAC[SUBSET;UNION];
53638 TYPE_THEN `cut_arc C u w = C''` SUBAGOAL_TAC;
53639 IMATCH_MP_TAC cut_arc_unique;
53640 TYPE_THEN `C` UNABBREV_TAC;
53641 REWRITE_TAC[SUBSET;UNION];
53643 (* Sat Jan 1 19:57:51 EST 2005 *)
53648 let simple_closed_curve_euclid = prove_by_refinement(
53649 `!C . simple_closed_curve top2 C ==> (C SUBSET euclid 2) `,
53652 REWRITE_TAC[simple_closed_curve];
53653 REWRITE_TAC[IMAGE;SUBSET];
53654 TYPE_THEN `!u. &0 <= u /\ u < &1 ==> euclid 2 (f u)` SUBAGOAL_TAC;
53655 FULL_REWRITE_TAC[INJ;top2_unions];
53656 FIRST_ASSUM IMATCH_MP_TAC ;
53658 TYPE_THEN `x' = &1` ASM_CASES_TAC;
53660 FIRST_ASSUM IMATCH_MP_TAC ;
53661 FIRST_ASSUM IMATCH_MP_TAC ;
53662 UNDH 6268 THEN UNDH 3324 THEN REAL_ARITH_TAC;
53666 let open_real_interval = prove_by_refinement(
53667 `!a b. top_of_metric (UNIV,d_real) {x | a < x /\ x < b}`,
53671 THM_INTRO_TAC[`b`] half_open;
53672 THM_INTRO_TAC[`a`] half_open_above;
53673 TYPE_THEN `{x | a < x /\ x < b} = {x | a < x} INTER {x | x < b}` SUBAGOAL_TAC;
53674 IMATCH_MP_TAC EQ_EXT;
53675 REWRITE_TAC[INTER];
53676 IMATCH_MP_TAC top_inter;
53677 IMATCH_MP_TAC top_of_metric_top;
53678 REWRITE_TAC[metric_real];
53682 let simple_closed_curve_cut_unique = prove_by_refinement(
53683 `!A A' A'' C v w. simple_closed_curve top2 C /\
53684 simple_arc_end A v w /\
53685 simple_arc_end A' v w /\
53686 simple_arc_end A'' v w /\
53688 (A SUBSET C ) /\ (A' SUBSET C) /\ (A'' SUBSET C) ==>
53689 (A = A') \/ (A = A'')`,
53693 TYPE_THEN `C v /\ C w /\ ~(v = w)` SUBAGOAL_TAC;
53695 IMATCH_MP_TAC subset_imp;
53696 TYPE_THEN `A'` EXISTS_TAC;
53697 IMATCH_MP_TAC simple_arc_end_end;
53698 TYPE_THEN`w` EXISTS_TAC;
53700 IMATCH_MP_TAC subset_imp;
53701 TYPE_THEN `A'` EXISTS_TAC;
53702 REWRITE_TAC[SUBSET_UNION];
53703 IMATCH_MP_TAC simple_arc_end_end2;
53704 TYPE_THEN `v` EXISTS_TAC;
53705 USEH 4051 (MATCH_MP simple_arc_end_distinct);
53706 UNDH 1472 THEN ASM_REWRITE_TAC[];
53708 THM_INTRO_TAC[`C`;`v`] simple_closed_curve_pt;
53709 TYPE_THEN `?t. (&0 < t /\ t < &1 /\ (f t = w))` SUBAGOAL_TAC ;
53711 TYPE_THEN `C` UNABBREV_TAC ;
53712 FULL_REWRITE_TAC[IMAGE];
53713 TYPE_THEN `x` EXISTS_TAC;
53714 TYPE_THEN `x = &0` ASM_CASES_TAC;
53715 TYPE_THEN `x` UNABBREV_TAC;
53717 TYPE_THEN `x = &1` ASM_CASES_TAC;
53719 UNDH 3483 THEN UNDH 9557 THEN UNDH 953 THEN UNDH 8032 THEN REAL_ARITH_TAC;
53720 TYPE_THEN `w` UNABBREV_TAC;
53721 TYPE_THEN `v` UNABBREV_TAC;
53723 (* USEH 9405 SYM; // *)
53724 FULL_REWRITE_TAC[top2_unions];
53725 TYPE_THEN `simple_arc_end (IMAGE f {x | &0 <= x /\ x <= t}) (f (&0)) (f t)` SUBAGOAL_TAC;
53727 IMATCH_MP_TAC simple_arc_segment;
53728 UNDH 6523 THEN REAL_ARITH_TAC;
53730 TYPE_THEN `simple_arc_end (IMAGE f {x | t <= x /\ x <= &1}) (f t) (f (&1))` SUBAGOAL_TAC;
53731 IMATCH_MP_TAC simple_arc_segment;
53732 UNDH 2449 THEN REAL_ARITH_TAC;
53736 TYPE_THEN `!q. {x | q <= x /\ x <= q} = {q}` SUBAGOAL_TAC;
53737 IMATCH_MP_TAC EQ_EXT;
53740 TYPE_THEN `!x. &0 <= x /\ x <= &1 ==> euclid 2 (f x)` SUBAGOAL_TAC;
53741 IMATCH_MP_TAC subset_imp;
53742 TYPE_THEN `C` EXISTS_TAC;
53744 IMATCH_MP_TAC image_imp;
53747 IMATCH_MP_TAC simple_closed_curve_euclid;
53749 TYPE_THEN `! r s. &0 <= r /\ s <= &1 /\ r < s ==> (?U. top2 U /\ (IMAGE f {x | r < x /\ x < s} = U INTER C))` SUBAGOAL_TAC;
53750 TYPE_THEN `closed_ top2 (IMAGE f {x | &0 <= x /\ x <= r})` SUBAGOAL_TAC;
53751 TYPE_THEN `r = &0` ASM_CASES_TAC ;
53753 REWRITE_TAC[image_sing];
53754 IMATCH_MP_TAC closed_point;
53755 FIRST_ASSUM IMATCH_MP_TAC ;
53756 IMATCH_MP_TAC simple_arc_end_closed;
53757 TYPE_THEN `f( &0)` EXISTS_TAC;
53758 TYPE_THEN `f (r)` EXISTS_TAC;
53759 IMATCH_MP_TAC simple_arc_segment;
53760 UNDH 5145 THEN UNDH 147 THEN UNDH 7080 THEN UNDH 1908 THEN REAL_ARITH_TAC;
53761 TYPE_THEN `closed_ top2 (IMAGE f {x | s <= x /\ x <= &1})` SUBAGOAL_TAC;
53762 TYPE_THEN `s = &1` ASM_CASES_TAC ;
53764 REWRITE_TAC[image_sing];
53765 IMATCH_MP_TAC closed_point;
53766 FIRST_ASSUM IMATCH_MP_TAC ;
53767 IMATCH_MP_TAC simple_arc_end_closed;
53768 TYPE_THEN `f(s)` EXISTS_TAC;
53770 TYPE_THEN `f (&1)` EXISTS_TAC;
53771 IMATCH_MP_TAC simple_arc_segment;
53772 UNDH 2144 THEN UNDH 147 THEN UNDH 7080 THEN UNDH 1908 THEN REAL_ARITH_TAC;
53773 TYPE_THEN `closed_ top2 ((IMAGE f {x | &0 <= x /\ x <= r}) UNION (IMAGE f {x | s <= x /\ x <= &1}))` SUBAGOAL_TAC;
53774 IMATCH_MP_TAC closed_union;
53775 REWRITE_TAC[top2_top];
53776 USEH 9076 (MATCH_MP closed_open);
53777 FULL_REWRITE_TAC[open_DEF;top2_unions ];
53778 TYPE_THEN `(euclid 2 DIFF (IMAGE f {x | &0 <= x /\ x <= r} UNION IMAGE f {x | s <= x /\ x <= &1}))` EXISTS_TAC;
53779 IMATCH_MP_TAC EQ_EXT;
53780 REWRITE_TAC[IMAGE;DIFF;UNION;INTER];
53782 IMATCH_MP_TAC EQ_ANTISYM;
53784 TYPE_THEN `x` UNABBREV_TAC;
53785 REWRITE_TAC[DE_MORGAN_THM;CONJ_ACI];
53786 TYPE_THEN `&0 <= x' /\ x' <= &1` SUBAGOAL_TAC;
53787 UNDH 507 THEN UNDH 3413 THEN UNDH 1908 THEN UNDH 147 THEN REAL_ARITH_TAC;
53789 TYPE_THEN `x'` EXISTS_TAC;
53792 FIRST_ASSUM IMATCH_MP_TAC ;
53794 USEH 2422 (REWRITE_RULE[INJ]);
53795 TYPE_THEN `x'' = &1` ASM_CASES_TAC;
53796 TYPE_THEN `x' = &0` SUBAGOAL_TAC;
53797 FIRST_ASSUM IMATCH_MP_TAC ;
53799 UNDH 507 THEN UNDH 1908 THEN REAL_ARITH_TAC;
53800 TYPE_THEN `x'` UNABBREV_TAC;
53801 UNDH 8462 THEN UNDH 147 THEN REAL_ARITH_TAC;
53802 TYPE_THEN `x' = x''` SUBAGOAL_TAC;
53803 FIRST_ASSUM IMATCH_MP_TAC ;
53804 UNDH 5595 THEN UNDH 8732 THEN UNDH 9674 THEN UNDH 507 THEN UNDH 9329 THEN UNDH 1908 THEN REAL_ARITH_TAC ;
53805 TYPE_THEN `x''` UNABBREV_TAC;
53806 UNDH 507 THEN UNDH 1162 THEN REAL_ARITH_TAC;
53808 TYPE_THEN `x' = x''` SUBAGOAL_TAC;
53809 USEH 2422 (REWRITE_RULE[INJ]);
53810 FIRST_ASSUM IMATCH_MP_TAC ;
53811 UNDH 8691 THEN UNDH 7080 THEN UNDH 1908 THEN UNDH 507 THEN REAL_ARITH_TAC;
53812 TYPE_THEN `x''` UNABBREV_TAC;
53813 UNDH 3283 THEN UNDH 3413 THEN REAL_ARITH_TAC;
53815 FULL_REWRITE_TAC[DE_MORGAN_THM];
53816 TYPE_THEN `x'` EXISTS_TAC;
53819 TYPE_THEN `x` UNABBREV_TAC;
53822 UNDH 1589 THEN UNDH 4223 THEN REWRITE_TAC[] THEN UNDH 3324 THEN UNDH 9329 THEN REAL_ARITH_TAC;
53825 UNDH 7922 THEN DISCH_THEN (THM_INTRO_TAC[`&0`;`t`]);
53826 UNDH 6523 THEN REAL_ARITH_TAC;
53827 UNDH 7922 THEN DISCH_THEN (THM_INTRO_TAC[`t`;`&1`]);
53828 UNDH 2449 THEN REAL_ARITH_TAC;
53831 TYPE_THEN `U INTER U' INTER C = EMPTY` SUBAGOAL_TAC;
53832 TYPE_THEN `U INTER U' INTER C = (U INTER C) INTER (U' INTER C)` SUBAGOAL_TAC;
53833 IMATCH_MP_TAC EQ_EXT;
53834 REWRITE_TAC[INTER] THEN MESON_TAC[];
53835 TYPE_THEN `U INTER C` UNABBREV_TAC;
53836 TYPE_THEN `U' INTER C` UNABBREV_TAC;
53837 PROOF_BY_CONTR_TAC;
53838 USEH 6182 (REWRITE_RULE[IMAGE;INTER;EMPTY_EXISTS]);
53839 TYPE_THEN `u` UNABBREV_TAC;
53840 TYPE_THEN `x = x'` SUBAGOAL_TAC;
53841 USEH 2422 (REWRITE_RULE[INJ]);
53842 FIRST_ASSUM IMATCH_MP_TAC ;
53843 UNDH 4410 THEN UNDH 8119 THEN UNDH 6523 THEN UNDH 5777 THEN UNDH 2449 THEN REAL_ARITH_TAC;
53844 TYPE_THEN `x'` UNABBREV_TAC;
53845 UNDH 4480 THEN UNDH 8119 THEN REAL_ARITH_TAC;
53847 TYPE_THEN `UNIONS (top_of_metric (UNIV,d_real)) = UNIV` SUBAGOAL_TAC;
53848 IMATCH_MP_TAC (GSYM top_of_metric_unions);
53849 REWRITE_TAC[metric_real];
53850 THM_INTRO_TAC[`&0`;`&1`] connect_real_open;
53851 THM_INTRO_TAC[`&0`;`&1`] open_real_interval;
53852 TYPE_THEN `!B. simple_arc_end B (f (&0)) (f t) /\ B SUBSET C ==> (B = IMAGE f {x | &0 <= x /\ x <= t}) \/ (B = IMAGE f {x | t <= x /\ x <= &1})` SUBAGOAL_TAC;
53854 USEH 3089 (REWRITE_RULE[simple_arc_end]);
53855 USEH 3272 (REWRITE_RULE[continuous;preimage]);
53857 TYPE_THEN `!v. top2 v ==> top_of_metric(UNIV,d_real) {x | &0 < x /\ x < &1 /\ v (f' x)}` SUBAGOAL_TAC;
53858 TYPE_THEN `{x | &0 < x /\ x < &1 /\ v' (f' x)} = {x | &0 < x /\ x < &1 } INTER {x | v' (f' x)}` SUBAGOAL_TAC;
53859 IMATCH_MP_TAC EQ_EXT;
53860 REWRITE_TAC[INTER];
53862 IMATCH_MP_TAC top_inter;
53863 IMATCH_MP_TAC top_of_metric_top;
53864 REWRITE_TAC[metric_real];
53868 FULL_REWRITE_TAC[connected];
53869 UNDH 868 THEN DISCH_THEN (THM_INTRO_TAC[`{x | &0 < x /\ x < &1 /\ U (f' x)}`;`{x | &0 < x /\ x < &1 /\ U' (f' x)}`]);
53871 PROOF_BY_CONTR_TAC;
53872 USEH 228 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
53873 TYPE_THEN `C (f' u)` SUBAGOAL_TAC;
53874 IMATCH_MP_TAC subset_imp;
53875 TYPE_THEN `B` EXISTS_TAC;
53876 IMATCH_MP_TAC image_imp;
53877 UNDH 5411 THEN UNDH 7814 THEN REAL_ARITH_TAC;
53878 USEH 161 (REWRITE_RULE[INTER;EQ_EMPTY]);
53879 TSPECH `f' u` 3418;
53880 UNDH 1284 THEN ASM_REWRITE_TAC[];
53881 REWRITE_TAC[SUBSET;UNION];
53882 TYPE_THEN `C (f' x)` SUBAGOAL_TAC;
53883 IMATCH_MP_TAC subset_imp;
53884 TYPE_THEN `B` EXISTS_TAC;
53885 IMATCH_MP_TAC image_imp;
53886 UNDH 4410 THEN UNDH 2236 THEN REAL_ARITH_TAC ;
53889 USEH 8548 (REWRITE_RULE[IMAGE]);
53890 TYPE_THEN `~(x' = &0)` SUBAGOAL_TAC;
53891 TYPE_THEN `x'` UNABBREV_TAC;
53892 TYPE_THEN `f(&0)` UNABBREV_TAC;
53893 TYPE_THEN `f(&1)` UNABBREV_TAC;
53894 TYPE_THEN `x = &0` SUBAGOAL_TAC;
53895 USEH 5798 (REWRITE_RULE[INJ]);
53896 FIRST_ASSUM IMATCH_MP_TAC ;
53897 UNDH 2236 THEN UNDH 4410 THEN REAL_ARITH_TAC;
53898 TYPE_THEN `x` UNABBREV_TAC;
53899 UNDH 869 THEN REAL_ARITH_TAC;
53900 TYPE_THEN `~(x' = &1)` SUBAGOAL_TAC;
53901 TYPE_THEN `x'` UNABBREV_TAC;
53902 TYPE_THEN `f(&0)` UNABBREV_TAC;
53903 TYPE_THEN `f(&1)` UNABBREV_TAC;
53904 TYPE_THEN `x = &0` SUBAGOAL_TAC;
53905 USEH 5798 (REWRITE_RULE[INJ]);
53906 FIRST_ASSUM IMATCH_MP_TAC ;
53907 UNDH 2236 THEN UNDH 4410 THEN REAL_ARITH_TAC;
53908 TYPE_THEN `x` UNABBREV_TAC;
53909 UNDH 869 THEN REAL_ARITH_TAC;
53910 TYPE_THEN `~(x' = t)` SUBAGOAL_TAC;
53911 TYPE_THEN `x'` UNABBREV_TAC;
53912 TYPE_THEN `f(&0)` UNABBREV_TAC;
53913 TYPE_THEN `f(&1)` UNABBREV_TAC;
53914 TYPE_THEN `f t` UNABBREV_TAC;
53915 TYPE_THEN `x = &1` SUBAGOAL_TAC;
53916 USEH 5798 (REWRITE_RULE[INJ]);
53917 FIRST_ASSUM IMATCH_MP_TAC ;
53918 UNDH 2236 THEN UNDH 4410 THEN REAL_ARITH_TAC;
53919 TYPE_THEN `x` UNABBREV_TAC;
53920 UNDH 6586 THEN REAL_ARITH_TAC;
53922 TYPE_THEN `x' < t` ASM_CASES_TAC;
53924 USEH 9545 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
53925 TSPECH `f x'` 4001;
53926 USEH 4175 (REWRITE_RULE[INTER]);
53927 USEH 4860 (MATCH_MP (TAUT `(a <=> b /\ c) ==> (a ==> b)`));
53928 FIRST_ASSUM IMATCH_MP_TAC ;
53929 IMATCH_MP_TAC image_imp;
53931 UNDH 2455 THEN UNDH 9329 THEN REAL_ARITH_TAC;
53933 USEH 6150 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
53934 TSPECH `f x'` 7907;
53935 USEH 1343 (REWRITE_RULE[INTER]);
53936 USEH 5291 (MATCH_MP (TAUT `(a <=> b /\ c) ==> (a ==> b)`));
53937 FIRST_ASSUM IMATCH_MP_TAC ;
53938 IMATCH_MP_TAC image_imp;
53940 UNDH 9585 THEN UNDH 7068 THEN UNDH 6268 THEN UNDH 3324 THEN REAL_ARITH_TAC;
53942 FIRST_ASSUM DISJ_CASES_TAC;
53944 IMATCH_MP_TAC simple_arc_end_inj;
53945 TYPE_THEN `IMAGE f {x | &0 <= x /\ x <= t}` EXISTS_TAC;
53946 TYPE_THEN `f (&0)` EXISTS_TAC;
53947 TYPE_THEN `f (t)` EXISTS_TAC;
53949 TYPE_THEN `B` UNABBREV_TAC;
53951 USEH 4679 (MATCH_MP simple_arc_end_simple);
53952 REWRITE_TAC[SUBSET_REFL];
53953 REWRITE_TAC[SUBSET;IMAGE];
53955 TYPE_THEN `x' = &0` ASM_CASES_TAC ;
53957 TYPE_THEN `&0` EXISTS_TAC;
53958 UNDH 2449 THEN REAL_ARITH_TAC;
53959 TYPE_THEN `x' = &1` ASM_CASES_TAC;
53961 TYPE_THEN `t` EXISTS_TAC;
53962 UNDH 2449 THEN REAL_ARITH_TAC;
53963 USEH 8833 (REWRITE_RULE[SUBSET]);
53964 UNDH 5386 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
53965 UNDH 6268 THEN UNDH 2455 THEN UNDH 9329 THEN UNDH 3324 THEN REAL_ARITH_TAC;
53966 TYPE_THEN `C (f' x')` SUBAGOAL_TAC;
53967 IMATCH_MP_TAC subset_imp;
53968 TYPE_THEN `B` EXISTS_TAC;
53969 IMATCH_MP_TAC image_imp;
53970 (*** Removed by JRH --- not quite sure why this changed
53971 UNDH 7473 THEN UNDH 5707 THEN UNDH 6268 THEN UNDH 2455 THEN REAL_ARITH_TAC;
53973 USEH 9545 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
53974 TSPECH `(f' x')` 4001;
53975 USEH 3320 (REWRITE_RULE[INTER;IMAGE]);
53977 TYPE_THEN `x''` EXISTS_TAC;
53978 UNDH 4332 THEN UNDH 4962 THEN REAL_ARITH_TAC;
53981 IMATCH_MP_TAC simple_arc_end_inj;
53982 TYPE_THEN `IMAGE f {x | t <= x /\ x <= &1}` EXISTS_TAC;
53983 TYPE_THEN `f t` EXISTS_TAC;
53984 TYPE_THEN `f (&1)` EXISTS_TAC;
53987 TYPE_THEN `B` UNABBREV_TAC;
53988 IMATCH_MP_TAC simple_arc_end_symm;
53991 USEH 9241 (MATCH_MP simple_arc_end_simple);
53992 REWRITE_TAC[SUBSET_REFL];
53993 REWRITE_TAC[SUBSET;IMAGE];
53995 TYPE_THEN `x' = &0` ASM_CASES_TAC ;
53997 TYPE_THEN `&1` EXISTS_TAC;
53998 UNDH 6523 THEN REAL_ARITH_TAC;
53999 TYPE_THEN `x' = &1` ASM_CASES_TAC;
54001 TYPE_THEN `t` EXISTS_TAC;
54002 UNDH 6523 THEN REAL_ARITH_TAC;
54003 TYPE_THEN `&0 < x' /\ x' < &1` SUBAGOAL_TAC;
54004 UNDH 9329 THEN UNDH 2455 THEN UNDH 3324 THEN UNDH 6268 THEN REAL_ARITH_TAC;
54005 USEH 1419 (REWRITE_RULE[SUBSET]);
54006 UNDH 7111 THEN DISCH_THEN (THM_INTRO_TAC[`x'`]);
54007 TYPE_THEN `C (f' x')` SUBAGOAL_TAC;
54008 IMATCH_MP_TAC subset_imp;
54009 TYPE_THEN `B` EXISTS_TAC;
54010 IMATCH_MP_TAC image_imp;
54012 USEH 6150 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
54013 TSPECH `(f' x')` 7907;
54014 USEH 1445 (REWRITE_RULE[INTER;IMAGE]);
54016 TYPE_THEN `x''` EXISTS_TAC;
54017 UNDH 4402 THEN UNDH 8966 THEN REAL_ARITH_TAC;
54019 TYPE_THEN `X = IMAGE f {x | &0 <= x /\ x <= t}` ABBREV_TAC ;
54020 TYPE_THEN `Y = IMAGE f {x | t <= x /\ x <= &1}` ABBREV_TAC ;
54021 TYPE_THEN `a = f(&0)` ABBREV_TAC ;
54022 TYPE_THEN `b = f t` ABBREV_TAC ;
54023 TYPE_THEN `f t` UNABBREV_TAC;
54024 TYPE_THEN `f (&0)` UNABBREV_TAC;
54025 TYPE_THEN `f (&1)` UNABBREV_TAC;
54026 UNDH 7556 THEN UNDH 7601 THEN UNDH 9279 THEN UNDH 3395 THEN UNDH 1702 THEN UNDH 2817 THEN UNDH 7605 THEN UNDH 1063 THEN POP_ASSUM_LIST (fun t-> ALL_TAC);
54027 TYPE_THEN `(A = X) \/ (A = Y)` SUBAGOAL_TAC;
54028 FIRST_ASSUM IMATCH_MP_TAC ;
54029 TYPE_THEN `(A' = X) \/ (A' = Y)` SUBAGOAL_TAC;
54030 FIRST_ASSUM IMATCH_MP_TAC ;
54031 TYPE_THEN `(A'' = X) \/ (A'' = Y)` SUBAGOAL_TAC;
54032 FIRST_ASSUM IMATCH_MP_TAC ;
54033 FIRST_ASSUM DISJ_CASES_TAC THEN FIRST_ASSUM DISJ_CASES_TAC THEN ASM_MESON_TAC[];
54034 (* Sun Jan 2 11:55:31 EST 2005 *)
54039 let infinite_closed_interval = prove_by_refinement(
54040 `!a b. a < b ==> INFINITE {x | a <= x /\ x <= b}`,
54044 TYPE_THEN `?r s. a < r /\ r < s /\ s < b` SUBAGOAL_TAC;
54045 TYPE_THEN `(&2*a + b)/ &3` EXISTS_TAC;
54046 TYPE_THEN `(a + &2*b)/ &3` EXISTS_TAC;
54047 ASSUME_TAC (REAL_ARITH `&0 < &3 /\ ~(&3 = &0)`);
54048 ASM_SIMP_TAC[REAL_LT_RDIV_EQ;REAL_LT_LDIV_EQ;REAL_DIV_RMUL];
54049 UNDH 4394 THEN REAL_ARITH_TAC;
54050 IMATCH_MP_TAC infinite_subset;
54051 TYPE_THEN `{x | r < x /\ x < s}` EXISTS_TAC ;
54053 ASM_SIMP_TAC[infinite_interval];
54054 REWRITE_TAC[SUBSET];
54055 UNDH 2351 THEN UNDH 2116 THEN UNDH 5157 THEN UNDH 4011 THEN REAL_ARITH_TAC;
54056 (* Sun Jan 2 12:21:29 EST 2005 *)
54061 let infinite_image = prove_by_refinement(
54062 `!(f:A->B) X. INFINITE X /\ INJ f X UNIV ==> INFINITE (IMAGE f X)`,
54065 REWRITE_TAC[INJ;INFINITE];
54066 THM_INTRO_TAC[`f`;`IMAGE f X`;`X`] FINITE_IMAGE_INJ_GENERAL;
54068 UNDH 3229 THEN REWRITE_TAC[];
54069 TYPE_THEN `{x | x IN X /\ f x IN IMAGE f X} = X` SUBAGOAL_TAC;
54070 IMATCH_MP_TAC EQ_EXT;
54071 ASM_MESON_TAC[image_imp];
54076 let simple_arc_infinite = prove_by_refinement(
54077 `!C. simple_arc top2 C ==> INFINITE C`,
54080 REWRITE_TAC[simple_arc];
54081 IMATCH_MP_TAC infinite_image;
54083 IMATCH_MP_TAC infinite_closed_interval;
54084 FULL_REWRITE_TAC[INJ];
54085 FIRST_ASSUM IMATCH_MP_TAC ;
54089 let simple_closed_curve_cut_unique_inter = prove_by_refinement(
54090 `!A A' A'' C v w. simple_closed_curve top2 C /\
54091 simple_arc_end A v w /\
54092 simple_arc_end A' v w /\
54093 simple_arc_end A'' v w /\
54094 (A' INTER A'' = {v,w}) /\
54095 (A SUBSET C ) /\ (A' SUBSET C) /\ (A'' SUBSET C) ==>
54096 (A = A') \/ (A = A'')`,
54100 IMATCH_MP_TAC simple_closed_curve_cut_unique;
54101 TYPE_THEN `C` EXISTS_TAC;
54102 TYPE_THEN `v` EXISTS_TAC;
54103 TYPE_THEN `w` EXISTS_TAC;
54105 TYPE_THEN `A''` UNABBREV_TAC;
54106 FULL_REWRITE_TAC [INTER_ACI];
54107 TYPE_THEN `A'` UNABBREV_TAC;
54108 USEH 2648 (MATCH_MP simple_arc_end_simple);
54109 USEH 9214 (MATCH_MP simple_arc_infinite);
54110 FULL_REWRITE_TAC[INFINITE];
54111 UNDH 8436 THEN ASM_REWRITE_TAC[];
54112 REWRITE_TAC[FINITE_INSERT;FINITE_RULES];
54113 (* Sun Jan 2 12:47:35 EST 2005 *)
54117 let jordan_curve_access = prove_by_refinement(
54118 `!A C v w x p. simple_closed_curve top2 C /\
54119 simple_arc_end A v w /\
54121 A x /\ ~(x = v) /\ ~(x = w) /\
54124 (?q. ~( p = q) /\ ~(C q) /\ (euclid 2 q) /\
54125 (!B. simple_arc_end B p q ==> ~(B INTER C = EMPTY))) ==>
54127 simple_arc_end E p x /\
54128 E INTER C SUBSET A /\
54129 (!e. E e /\ ~C e /\ ~(p = e) ==> (cut_arc E p e INTER C = EMPTY)))`,
54133 TYPE_THEN `C v /\ C w /\ ~(v = w)` SUBAGOAL_TAC;
54135 IMATCH_MP_TAC subset_imp;
54136 TYPE_THEN `A` EXISTS_TAC;
54137 IMATCH_MP_TAC simple_arc_end_end;
54138 TYPE_THEN`w` EXISTS_TAC;
54140 IMATCH_MP_TAC subset_imp;
54141 TYPE_THEN `A` EXISTS_TAC;
54142 IMATCH_MP_TAC simple_arc_end_end2;
54143 TYPE_THEN `v` EXISTS_TAC;
54144 USEH 9236 (MATCH_MP simple_arc_end_distinct);
54145 UNDH 1472 THEN ASM_REWRITE_TAC[];
54147 THM_INTRO_TAC[`C`;`v`;`w`] simple_closed_cut;
54149 TYPE_THEN `?B. (A UNION B = C) /\ (A INTER B = {v,w}) /\ (simple_arc_end B v w)` SUBAGOAL_TAC;
54150 THM_INTRO_TAC[`A`;`C'`;`C''`;`C`;`v`;`w`] simple_closed_curve_cut_unique_inter;
54151 TYPE_THEN `C` UNABBREV_TAC;
54152 REWRITE_TAC[SUBSET;UNION];
54154 FIRST_ASSUM DISJ_CASES_TAC ;
54155 TYPE_THEN `C'` UNABBREV_TAC;
54156 TYPE_THEN `C''` EXISTS_TAC;
54157 TYPE_THEN `C''` UNABBREV_TAC;
54158 TYPE_THEN `C'` EXISTS_TAC;
54159 FULL_REWRITE_TAC[INTER_ACI;UNION_ACI];
54160 KILLH 6724 THEN KILLH 906 THEN KILLH 4244 THEN KILLH 3747;
54162 THM_INTRO_TAC[`B`;`p`;`q`] simple_arc_conn_complement;
54163 USEH 2164 (MATCH_MP simple_arc_end_simple);
54164 TYPE_THEN `B SUBSET C` SUBAGOAL_TAC;
54165 TYPE_THEN `C` UNABBREV_TAC;
54166 REWRITE_TAC[SUBSET;UNION];
54167 ASM_MESON_TAC[subset_imp];
54169 THM_INTRO_TAC[`A'`;`{p}`;`A`] simple_arc_end_restriction;
54171 USEH 384 (MATCH_MP simple_arc_end_simple);
54173 USEH 384 (MATCH_MP simple_arc_end_end_closed);
54175 USEH 9236 (MATCH_MP simple_arc_end_closed);
54177 REWRITE_TAC[EQ_EMPTY];
54178 FULL_REWRITE_TAC[INTER;INR IN_SING];
54179 TYPE_THEN `x'` UNABBREV_TAC;
54180 ASM_MESON_TAC[subset_imp];
54181 REWRITE_TAC[EMPTY_EXISTS;INTER];
54183 CONV_TAC (dropq_conv "u");
54184 USEH 384 (MATCH_MP simple_arc_end_end);
54186 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
54187 TYPE_THEN `u` EXISTS_TAC;
54188 TYPE_THEN `C` UNABBREV_TAC;
54189 FULL_REWRITE_TAC[UNION];
54190 FIRST_ASSUM DISJ_CASES_TAC;
54191 FULL_REWRITE_TAC[EQ_EMPTY];
54194 TYPE_THEN `v' = p` SUBAGOAL_TAC;
54195 USEH 6335 (REWRITE_RULE[INR eq_sing;INTER;INR IN_SING ]);
54196 TYPE_THEN `v'` UNABBREV_TAC;
54198 TYPE_THEN `x = v''` ASM_CASES_TAC ;
54199 TYPE_THEN `v''` UNABBREV_TAC;
54200 TYPE_THEN `C'` EXISTS_TAC;
54202 TYPE_THEN `C` UNABBREV_TAC;
54203 REWRITE_TAC[INTER;UNION;SUBSET];
54204 FIRST_ASSUM DISJ_CASES_TAC;
54205 FULL_REWRITE_TAC[INTER;EQ_EMPTY;SUBSET ];
54208 TYPE_THEN `~(e = x)` SUBAGOAL_TAC;
54209 TYPE_THEN `e` UNABBREV_TAC;
54210 UNDH 3668 THEN REWRITE_TAC[] ;
54211 IMATCH_MP_TAC subset_imp;
54212 TYPE_THEN `A` EXISTS_TAC;
54213 THM_INTRO_TAC[`C'`;`e`;`p`;`x`] cut_arc_inter;
54215 PROOF_BY_CONTR_TAC;
54216 THM_INTRO_TAC[`C'`;`p`;`e`] cut_arc_subset;
54218 USEH 8530 (MATCH_MP simple_arc_end_simple);
54219 USEH 8530 (MATCH_MP simple_arc_end_end);
54220 FULL_REWRITE_TAC[INTER;EMPTY_EXISTS];
54221 FULL_REWRITE_TAC[SUBSET;INR eq_sing ;INR IN_SING;];
54222 THM_INTRO_TAC[`C'`;`e`;`x`] cut_arc_simple;
54223 USEH 8530 (MATCH_MP simple_arc_end_simple);
54224 USEH 5502 (MATCH_MP simple_arc_end_end2);
54227 TYPE_THEN `cutvx = cut_arc A v'' x` ABBREV_TAC ;
54228 TYPE_THEN `E = C' UNION cutvx` ABBREV_TAC ;
54229 TYPE_THEN `E` EXISTS_TAC;
54231 TYPE_THEN `simple_arc top2 A` SUBAGOAL_TAC;
54232 IMATCH_MP_TAC simple_arc_end_simple;
54235 TYPE_THEN `A v'' ` SUBAGOAL_TAC;
54236 FULL_REWRITE_TAC[INTER;INR eq_sing; INR IN_SING];
54237 THM_INTRO_TAC[`A`;`v''`;`x`] cut_arc_simple;
54240 TYPE_THEN `E` UNABBREV_TAC ;
54241 IMATCH_MP_TAC simple_arc_end_trans;
54242 TYPE_THEN `v''` EXISTS_TAC;
54243 TYPE_THEN `cutvx` UNABBREV_TAC;
54244 IMATCH_MP_TAC SUBSET_ANTISYM;
54247 REWRITE_TAC[INTER;SUBSET];
54248 THM_INTRO_TAC[`A`;`v''`;`x`] cut_arc_subset;
54249 IMATCH_MP_TAC subset_imp;
54251 REWRITE_TAC[SUBSET;INTER;INR IN_SING];
54252 FULL_REWRITE_TAC[INTER;INR IN_SING;INR eq_sing];
54253 USEH 4778 (MATCH_MP simple_arc_end_end);
54256 TYPE_THEN `E` UNABBREV_TAC;
54257 TYPE_THEN `cutvx` UNABBREV_TAC;
54258 TYPE_THEN `C` UNABBREV_TAC;
54259 REWRITE_TAC[SUBSET;INTER;UNION];
54260 FIRST_ASSUM DISJ_CASES_TAC;
54262 FIRST_ASSUM DISJ_CASES_TAC;
54263 FULL_REWRITE_TAC[SUBSET;EQ_EMPTY;INTER;];
54265 THM_INTRO_TAC[`A`;`v''`;`x`] cut_arc_subset;
54266 IMATCH_MP_TAC subset_imp;
54269 TYPE_THEN `simple_arc top2 E` SUBAGOAL_TAC;
54270 USEH 9538 (MATCH_MP simple_arc_end_simple);
54271 TYPE_THEN `C' p /\ C' e` SUBAGOAL_TAC;
54273 FULL_REWRITE_TAC[INTER;INR eq_sing;INR IN_SING];
54274 TYPE_THEN `E` UNABBREV_TAC;
54275 USEH 3684 (REWRITE_RULE[UNION]);
54276 FIRST_ASSUM DISJ_CASES_TAC;
54277 TYPE_THEN `cutvx SUBSET C` SUBAGOAL_TAC;
54278 IMATCH_MP_TAC SUBSET_TRANS;
54279 TYPE_THEN `A` EXISTS_TAC;
54280 TYPE_THEN `cutvx` UNABBREV_TAC;
54281 IMATCH_MP_TAC cut_arc_subset;
54282 ASM_MESON_TAC[subset_imp];
54284 TYPE_THEN `cut_arc E p e = cut_arc C' p e` SUBAGOAL_TAC;
54285 IMATCH_MP_TAC cut_arc_unique;
54286 TYPE_THEN `E` UNABBREV_TAC;
54288 TYPE_THEN `cut_arc C' p e SUBSET C'` BACK_TAC;
54289 UNDH 7958 THEN REWRITE_TAC[SUBSET;UNION];
54290 IMATCH_MP_TAC cut_arc_subset;
54291 USEH 2528 (MATCH_MP simple_arc_end_simple);
54292 IMATCH_MP_TAC cut_arc_simple;
54293 USEH 2528 (MATCH_MP simple_arc_end_simple);
54295 TYPE_THEN `~(e = v'')` SUBAGOAL_TAC;
54296 UNDH 5697 THEN ASM_REWRITE_TAC[];
54297 TYPE_THEN `C` UNABBREV_TAC;
54298 REWRITE_TAC[UNION];
54299 THM_INTRO_TAC[`C'`;`e`;`p`;`v''`] cut_arc_inter;
54301 TYPE_THEN `C' INTER C = {v''}` SUBAGOAL_TAC;
54302 TYPE_THEN `C` UNABBREV_TAC;
54303 REWRITE_TAC[eq_sing;INR IN_SING ;INTER;UNION;];
54304 USEH 2528 (MATCH_MP simple_arc_end_end2);
54306 FIRST_ASSUM DISJ_CASES_TAC ;
54307 USEH 6508 (REWRITE_RULE[INTER;INR eq_sing;INR IN_SING]);
54308 FIRST_ASSUM IMATCH_MP_TAC ;
54309 USEH 7813 (REWRITE_RULE[SUBSET]);
54310 USEH 4523 (REWRITE_RULE[EQ_EMPTY;INTER;]);
54313 TYPE_THEN `C' v''` SUBAGOAL_TAC;
54314 USEH 2528 (MATCH_MP simple_arc_end_end2);
54315 TYPE_THEN `~cut_arc C' p e v''` SUBAGOAL_TAC;
54316 USEH 8060 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
54317 UNDH 2267 THEN DISCH_THEN (THM_INTRO_TAC[`v''`]);
54318 THM_INTRO_TAC[`C'`;`e`;`v''`] cut_arc_simple;
54319 USEH 2528 (MATCH_MP simple_arc_end_simple);
54320 USEH 1175 (MATCH_MP simple_arc_end_end2);
54321 UNDH 1069 THEN ASM_REWRITE_TAC[];
54322 PROOF_BY_CONTR_TAC;
54323 USEH 7182 (REWRITE_RULE [EMPTY_EXISTS;INTER]);
54324 USEH 3774 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
54325 TYPE_THEN `u = v''` SUBAGOAL_TAC;
54326 FIRST_ASSUM IMATCH_MP_TAC ;
54327 TYPE_THEN `cut_arc C' p e SUBSET C'` SUBAGOAL_TAC;
54328 IMATCH_MP_TAC cut_arc_subset;
54329 USEH 2528 (MATCH_MP simple_arc_end_simple);
54330 IMATCH_MP_TAC subset_imp;
54332 TYPE_THEN `u` UNABBREV_TAC;
54333 UNDH 9484 THEN ASM_REWRITE_TAC[];
54334 (* Sun Jan 2 14:55:11 EST 2005 *)
54339 (* ------------------------------------------------------------------ *)
54341 (* ------------------------------------------------------------------ *)
54344 (* show that a Jordan curve has no more than 2 components *)
54346 let jordan_curve_seg3 = prove_by_refinement(
54347 `!C. simple_closed_curve top2 C ==>
54348 (?s. (!(i:three_t). (s i SUBSET C) /\ (simple_arc top2 (s i))) /\
54349 (!i j. ~(s i INTER s j = EMPTY) ==> (i = j)))`,
54352 REWRITE_TAC[simple_closed_curve];
54353 TYPE_THEN `s = (\ i. IMAGE f {x | ((&2 * &(REP3 i) + &1)/ &8) <= x /\ x <= ((&2 * &(REP3 i) + &2)/ &8) } )` ABBREV_TAC ;
54354 TYPE_THEN `s` EXISTS_TAC;
54356 TYPE_THEN `&0 < &8 /\ ~(&8 = &0)` SUBAGOAL_TAC;
54358 TYPE_THEN `!i. &0 <= (&2 * &(REP3 i) + &1) / &8` SUBAGOAL_TAC;
54359 IMATCH_MP_TAC REAL_LE_DIV;
54361 TYPE_THEN `!i. (&2 * &(REP3 i) + &2) / &8 <= &1` SUBAGOAL_TAC;
54362 ASM_SIMP_TAC[REAL_LE_LDIV_EQ];
54364 THM_INTRO_TAC[`i`] rep3_lt;
54365 UNDH 1618 THEN ARITH_TAC;
54369 TYPE_THEN `s` UNABBREV_TAC;
54370 REWRITE_TAC[SUBSET;IMAGE];
54371 TYPE_THEN `x'` EXISTS_TAC;
54373 IMATCH_MP_TAC REAL_LE_TRANS;
54375 IMATCH_MP_TAC REAL_LE_TRANS;
54378 TYPE_THEN `s` UNABBREV_TAC ;
54379 THM_INTRO_TAC[`f`;`(&2 * &(REP3 i) + &1) / &8 `;`(&2 * &(REP3 i) + &2) / &8`] simple_arc_segment;
54380 FULL_REWRITE_TAC[top2_unions];
54382 ASM_SIMP_TAC[real_div_denom_lt];
54386 IMATCH_MP_TAC REAL_LT_DIV;
54389 USEH 6148 (MATCH_MP simple_arc_end_simple);
54391 TYPE_THEN `!i j. (REP3 i < REP3 j) ==> (s i INTER s j = EMPTY)` BACK_TAC ;
54392 TYPE_THEN `(REP3 i = REP3 j) \/ (REP3 j <| REP3 i) \/ (REP3 i < REP3 j)` SUBAGOAL_TAC;
54394 UNDH 2249 THEN REP_CASES_TAC;
54395 REWRITE_TAC[three_t_eq];
54396 UNDH 6857 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`]);
54397 FULL_REWRITE_TAC[INTER_COMM];
54401 PROOF_BY_CONTR_TAC;
54403 FULL_REWRITE_TAC[INTER;EMPTY_EXISTS];
54404 TYPE_THEN `s` UNABBREV_TAC;
54405 USEH 4729 (REWRITE_RULE[IMAGE]);
54406 USEH 9244 (REWRITE_RULE[IMAGE]);
54407 TYPE_THEN `u` UNABBREV_TAC;
54409 TYPE_THEN `x = x'` SUBAGOAL_TAC;
54410 FULL_REWRITE_TAC[INJ];
54411 FIRST_ASSUM IMATCH_MP_TAC ;
54412 TYPE_THEN `!i. (&2 * &(REP3 i) + &2) / (&8) < &1`SUBAGOAL_TAC;
54413 UNDH 7394 THEN SIMP_TAC[REAL_LT_LDIV_EQ];
54415 THM_INTRO_TAC[`i`] rep3_lt;
54416 UNDH 1618 THEN ARITH_TAC;
54417 TYPE_THEN `&0 <= x /\ &0 <= x'` SUBAGOAL_TAC;
54418 ASM_MESON_TAC[REAL_LE_TRANS];
54419 CONJ_TAC THEN IMATCH_MP_TAC REAL_LET_TRANS THEN UNIFY_EXISTS_TAC;
54421 TYPE_THEN `x'` UNABBREV_TAC;
54422 TYPE_THEN `(&2 * &(REP3 j') + &1) / &8 <= (&2 * &(REP3 i') + &2)/ &8` SUBAGOAL_TAC;
54423 IMATCH_MP_TAC REAL_LE_TRANS THEN UNIFY_EXISTS_TAC;
54425 USEH 8118 (MATCH_MP (REAL_ARITH `x <= y ==> ~(y < x)`));
54426 UNDH 4580 THEN REWRITE_TAC[];
54427 ASM_SIMP_TAC[REAL_LT_RDIV];
54429 UNDH 4372 THEN ARITH_TAC;
54430 (* Sun Jan 2 20:07:58 EST 2005 *)
54435 let abs3_distinct = prove_by_refinement(
54436 `~(ABS3 0 = ABS3 1) /\ ~(ABS3 0 = ABS3 2) /\ ~(ABS3 1 = ABS3 2)`,
54439 TYPE_THEN `!i j. ~(REP3 (ABS3 i) = REP3(ABS3 j))==> ~(ABS3 i = ABS3 j)` SUBAGOAL_TAC;
54440 TYPE_THEN `ABS3 i` UNABBREV_TAC;
54441 REPEAT CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN ASM_REWRITE_TAC[ABS3_012] THEN ARITH_TAC;
54445 let three_t_enum = prove_by_refinement(
54446 `!(a:A) b c. ?(f:three_t ->A). (f(ABS3 0) = a) /\
54447 (f(ABS3 1) = b) /\ (f(ABS3 2) = c)`,
54451 TYPE_THEN `f = (\ i. (if (i = ABS3 0) then a else (if (i = ABS3 1) then b else c)))` ABBREV_TAC ;
54452 TYPE_THEN `f` EXISTS_TAC;
54453 TYPE_THEN `f` UNABBREV_TAC;
54454 REWRITE_TAC[abs3_distinct];
54458 let three_t_univ = prove_by_refinement(
54459 `!P. P (ABS3 0) /\ P(ABS3 1) /\ P(ABS3 2) ==> (!i. P i)`,
54463 THM_INTRO_TAC[`i`] ABS3_onto;
54464 TYPE_THEN `(j = 0) \/ (j = 1) \/ (j = 2)` SUBAGOAL_TAC;
54465 UNDH 4616 THEN ARITH_TAC;
54466 UNDH 2783 THEN REP_CASES_TAC THEN (TYPE_THEN `j` UNABBREV_TAC);
54470 let simple_arc_sep_three_t = prove_by_refinement(
54472 (!(i:three_t). simple_arc_end (C i) x (p i)) /\
54473 (!i j. (C i) (p j) ==> (i = j)) ==>
54475 (!i. simple_arc_end (C' i) x (p i)) /\
54476 (!i j. ~(i = j) ==> (C' i INTER C' j = {x})) /\
54477 (!A. (!i. (C i) SUBSET A) ==> (!i. (C' i) SUBSET A))) `,
54481 TYPE_THEN `A = C(ABS3 0) UNION C(ABS3 1) UNION C(ABS3 2)` ABBREV_TAC ;
54482 THM_INTRO_TAC[`A`;`C(ABS3 0)`;`C(ABS3 1)`;`C(ABS3 2)`;`x`;`p(ABS3 0)`;`p(ABS3 1)`;`p(ABS3 2)`] simple_arc_sep;
54483 REWRITE_TAC[SUBSET_REFL];
54484 TYPE_THEN `!i j. ~(i = j) ==> ~(C i (p j))` SUBAGOAL_TAC;
54486 TYPE_THEN `!i j. ~(REP3 (ABS3 i) = REP3 (ABS3 j)) ==> ~(ABS3 i = ABS3 j)` SUBAGOAL_TAC;
54487 TYPE_THEN `ABS3 i` UNABBREV_TAC;
54488 REPEAT CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN REWRITE_TAC[ABS3_012] THEN ARITH_TAC ;
54489 THM_INTRO_TAC[`C1'`;`C2'`;`C3'`] three_t_enum;
54490 TYPE_THEN `f` EXISTS_TAC;
54491 TYPE_THEN `x'` EXISTS_TAC;
54492 TYPE_THEN `C1'` UNABBREV_TAC;
54493 TYPE_THEN `C2'` UNABBREV_TAC;
54494 TYPE_THEN `C3'` UNABBREV_TAC;
54496 CONJ_TAC THENL [IMATCH_MP_TAC three_t_univ;ALL_TAC];
54497 CONJ_TAC THENL [IMATCH_MP_TAC three_t_univ THEN (REPEAT CONJ_TAC) THEN IMATCH_MP_TAC three_t_univ THEN FULL_REWRITE_TAC[INTER_ACI];ALL_TAC];
54498 IMATCH_MP_TAC SUBSET_TRANS;
54499 TYPE_THEN `A` EXISTS_TAC;
54500 FULL_REWRITE_TAC[union_subset];
54501 TYPE_THEN `!i. (f i SUBSET A)` SUBAGOAL_TAC THENL [IMATCH_MP_TAC three_t_univ;ALL_TAC];
54503 UNDH 2066 THEN UNDH 915 THEN POP_ASSUM_LIST (fun t->ALL_TAC);
54504 TYPE_THEN `A` UNABBREV_TAC;
54505 REWRITE_TAC[union_subset];
54506 (* Sun Jan 2 21:17:07 EST 2005 *)
54511 let old_every_step_tac = !EVERY_STEP_TAC;;
54513 REP_BASIC_TAC THEN (DROP_ALL_ANT_TAC) THEN
54516 let transpose = jordan_def `transpose (Q:A->B->C) i j = Q j i`;;
54518 let transpose2 = prove_by_refinement(
54519 `!Q . (transpose (transpose Q)) = (Q:A->B->C) `,
54523 IMATCH_MP_TAC EQ_EXT;
54524 IMATCH_MP_TAC EQ_EXT;
54525 REWRITE_TAC[transpose];
54529 let k33_planar_graph_data_expand = prove_by_refinement(
54531 (!(i:three_t) (j:three_t) i' j'.
54532 (q i j = q i' j') ==> (i = i') /\ (j = j')) /\
54533 (!i j. simple_arc_end (CA i j) (A i) (q i j)) /\
54534 (!i j. simple_arc_end (CB i j) (B j) (q i j)) /\
54535 (!i j i' j' u. (CB i j u /\ CA i' j' u) ==>
54536 (i = i') /\ (j = j') /\ (u = q i j)) /\
54537 (!i j i' j'. ~(CA i j INTER CA i' j' = EMPTY) ==> (i = i')) /\
54538 (!i j i' j'. ~(CB i j INTER CB i' j' = EMPTY) ==> (j = j'))
54539 ==> (?A' CA' B' CB'.
54540 (!i j. simple_arc_end (CA' i j) (A' i) (q i j)) /\
54541 (!i j. simple_arc_end (CB' i j) (B' j) (q i j)) /\
54542 (!i j i' j' u. (CB' i j u /\ CA' i' j' u) ==>
54543 (i = i') /\ (j = j') /\ (u = q i j)) /\
54544 (!i j i' j'. ~(CA' i j INTER CA' i' j' = EMPTY) ==> (i = i')) /\
54545 (!i j i' j'. ~(CB' i j INTER CB' i' j' = EMPTY) ==> (j = j')) /\
54546 (!i j k. ~(j = k) ==> (CA' i j INTER CA' i k = {(A' i)})) /\
54547 (!i j k. ~(j = k) ==> (CB' j i INTER CB' k i = {(B' i)}))
54553 TYPE_THEN `!i. ?CA' A'. (!j. simple_arc_end (CA' j) (A') (q i j)) /\ (!j k. ~(j = k) ==> (CA' j INTER CA' k = {(A')})) /\ (!U. (!j. (CA i j SUBSET U)) ==> (!j. CA' j SUBSET U))` SUBAGOAL_TAC;
54554 IMATCH_MP_TAC simple_arc_sep_three_t;
54555 TYPE_THEN `A i` EXISTS_TAC;
54557 UNDH 8763 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j'`;`i`;`j`;`q i j'`]);
54559 UNDH 190 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j'`]);
54560 USEH 6066 (MATCH_MP simple_arc_end_end2);
54565 TYPE_THEN `A'` EXISTS_TAC;
54566 TYPE_THEN `CA'` EXISTS_TAC;
54567 TYPE_THEN `(!i j. simple_arc_end (CA' i j) (A' i) (q i j))` SUBAGOAL_TAC;
54571 TYPE_THEN `!i j u. CA' i j u ==> (?j'. CA i j' u)` SUBAGOAL_TAC;
54573 TSPECH `UNIONS (IMAGE (CA i) (UNIV))` 1295;
54574 UNDH 3086 THEN DISCH_THEN (THM_INTRO_TAC[]);
54575 REWRITE_TAC[SUBSET;UNIONS;IMAGE ];
54576 CONV_TAC (dropq_conv ("u"));
54580 USEH 4766 (REWRITE_RULE[SUBSET;UNIONS;IMAGE]);
54583 TYPE_THEN `u'` UNABBREV_TAC;
54587 TYPE_THEN `(!i j i' j'. ~(CA' i j INTER CA' i' j' = {}) ==> (i = i'))` SUBAGOAL_TAC;
54588 USEH 3155 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
54590 UNDH 6882 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j'`;`u`]);
54592 UNDH 6882 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`u`]);
54595 FIRST_ASSUM IMATCH_MP_TAC ;
54596 REWRITE_TAC[EMPTY_EXISTS;INTER];
54597 TYPE_THEN `j'''` EXISTS_TAC;
54598 TYPE_THEN `j''` EXISTS_TAC;
54603 TYPE_THEN `!i. ?CBt' B'. (!j. simple_arc_end (CBt' j) (B') (transpose q i j)) /\ (!j k. ~(j = k) ==> (CBt' j INTER CBt' k = {(B')})) /\ (!U. (!j. (transpose CB i j SUBSET U)) ==> (!j. CBt' j SUBSET U))` SUBAGOAL_TAC;
54604 IMATCH_MP_TAC simple_arc_sep_three_t;
54605 TYPE_THEN `B i` EXISTS_TAC;
54606 REWRITE_TAC[transpose];
54608 UNDH 8763 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`i`;`j'`;`i`;`q j' i`]);
54610 UNDH 8461 THEN DISCH_THEN (THM_INTRO_TAC[`j'`;`i`]);
54611 USEH 6944 (MATCH_MP simple_arc_end_end2);
54616 TYPE_THEN `B'` EXISTS_TAC;
54617 TYPE_THEN `CB' = transpose CBt'` ABBREV_TAC ;
54618 TYPE_THEN `CBt' = transpose CB'` SUBAGOAL_TAC;
54619 TYPE_THEN `CB'` UNABBREV_TAC;
54620 REWRITE_TAC[transpose2];
54621 TYPE_THEN `CBt'` UNABBREV_TAC;
54622 FULL_REWRITE_TAC[transpose];
54624 TYPE_THEN `CB'` EXISTS_TAC;
54627 TYPE_THEN `!i j u. CB' i j u ==> (?i'. CB i' j u)` SUBAGOAL_TAC;
54629 TSPECH `UNIONS (IMAGE (transpose CB j) (UNIV))` 6357;
54630 UNDH 3701 THEN DISCH_THEN (THM_INTRO_TAC[]);
54631 REWRITE_TAC[SUBSET;UNIONS;IMAGE;transpose ];
54632 CONV_TAC (dropq_conv ("u"));
54636 USEH 4864 (REWRITE_RULE[SUBSET;UNIONS;IMAGE]);
54638 FULL_REWRITE_TAC[transpose];
54639 TYPE_THEN `u'` UNABBREV_TAC;
54643 TYPE_THEN `(!i j i' j'. ~(CB' i j INTER CB' i' j' = {}) ==> (j = j'))` SUBAGOAL_TAC;
54644 USEH 541 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
54646 UNDH 5811 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j'`;`u`]);
54648 UNDH 5811 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`u`]);
54652 FIRST_ASSUM IMATCH_MP_TAC ;
54653 REWRITE_TAC[EMPTY_EXISTS;INTER];
54654 TYPE_THEN `i'''` EXISTS_TAC;
54655 TYPE_THEN `i''` EXISTS_TAC;
54660 UNDH 6882 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j'`;`u`]);
54662 UNDH 5811 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`u`]);
54664 UNDH 8763 THEN DISCH_THEN (THM_INTRO_TAC[`i''`;`j`;`i'`;`j''`;`u`]);
54666 TYPE_THEN `j''` UNABBREV_TAC;
54667 TYPE_THEN `i''` UNABBREV_TAC;
54668 TYPE_THEN `u` UNABBREV_TAC;
54671 TYPE_THEN `~(j = j')` ASM_CASES_TAC;
54672 UNDH 1784 THEN DISCH_THEN (THM_INTRO_TAC[`j`;`j'`]);
54673 UNDH 2577 THEN ASM_REWRITE_TAC[];
54674 USEH 6310 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
54675 TSPECH `q i' j` 3488;
54679 USEH 3976 (MATCH_MP simple_arc_end_distinct);
54680 UNDH 587 THEN ASM_REWRITE_TAC[];
54681 ONCE_REWRITE_TAC[EQ_SYM_EQ];
54682 FIRST_ASSUM IMATCH_MP_TAC ;
54683 USEH 3976 (MATCH_MP simple_arc_end_end2);
54685 FULL_REWRITE_TAC[];
54686 TYPE_THEN `j'` UNABBREV_TAC;
54688 TYPE_THEN `(i = i')` BACK_TAC;
54689 TYPE_THEN `i'` UNABBREV_TAC;
54690 PROOF_BY_CONTR_TAC;
54692 UNDH 5789 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`i'`]);
54693 UNDH 3113 THEN ASM_REWRITE_TAC[];
54694 USEH 3441 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
54695 TSPECH `q i' j` 7938;
54699 USEH 8730 (MATCH_MP simple_arc_end_distinct);
54700 UNDH 586 THEN ASM_REWRITE_TAC[];
54701 ONCE_REWRITE_TAC[EQ_SYM_EQ];
54702 FIRST_ASSUM IMATCH_MP_TAC ;
54703 USEH 8730 (MATCH_MP simple_arc_end_end2);
54705 (* Tue Jan 4 10:50:14 EST 2005 *)
54710 let three_t_size3 = prove_by_refinement(
54711 `(UNIV:three_t->bool) HAS_SIZE 3`,
54714 ASSUME_TAC (ARITH_RULE `3 = SUC 2`);
54716 REWRITE_TAC[HAS_SIZE_SUC];
54717 REWRITE_TAC[three_delete_size];
54721 let no_k33_planar_graph_data = prove_by_refinement(
54723 (!(i:three_t) (j:three_t) i' j'.
54724 (q i j = q i' j') ==> (i = i') /\ (j = j')) /\
54725 (!i j. simple_arc_end (CA i j) (A i) (q i j)) /\
54726 (!i j. simple_arc_end (CB i j) (B j) (q i j)) /\
54727 (!i j i' j' u. (CB i j u /\ CA i' j' u) ==>
54728 (i = i') /\ (j = j') /\ (u = q i j)) /\
54729 (!i j i' j'. ~(CA i j INTER CA i' j' = EMPTY) ==> (i = i')) /\
54730 (!i j i' j'. ~(CB i j INTER CB i' j' = EMPTY) ==> (j = j')) ==>
54735 THM_INTRO_TAC[`q`;`A`;`CA`;`B`;`CB`] k33_planar_graph_data_expand;
54737 KILLH 33 THEN KILLH 3657 THEN KILLH 8763 THEN KILLH 190 THEN KILLH 8461;
54738 TYPE_THEN `CE = ( \i j. CA' i j UNION CB' i j)` ABBREV_TAC ;
54739 TYPE_THEN `!i j. CE i j = CA' i j UNION CB' i j` SUBAGOAL_TAC;
54740 TYPE_THEN `CE` UNABBREV_TAC;
54741 TYPE_THEN `!i j. simple_arc_end (CE i j) (A' i) (B' j)` SUBAGOAL_TAC;
54742 TYPE_THEN `CE` UNABBREV_TAC;
54743 IMATCH_MP_TAC simple_arc_end_trans;
54744 TYPE_THEN `q i j` EXISTS_TAC;
54747 IMATCH_MP_TAC simple_arc_end_symm;
54749 IMATCH_MP_TAC SUBSET_ANTISYM;
54751 REWRITE_TAC[INTER;SUBSET;INR IN_SING];
54753 REWRITE_TAC[SUBSET;INR IN_SING;INTER];
54754 TYPE_THEN `x` UNABBREV_TAC;
54755 ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
54757 TYPE_THEN `A = IMAGE A' UNIV` ABBREV_TAC ;
54758 TYPE_THEN `B = IMAGE B' UNIV` ABBREV_TAC ;
54759 TYPE_THEN `E = IMAGE (\ (i,j). (CE i j)) (cartesian UNIV UNIV)` ABBREV_TAC ;
54761 TYPE_THEN `!i j. CA' i j (q i j)` SUBAGOAL_TAC;
54762 ASM_MESON_TAC[simple_arc_end_end2];
54763 TYPE_THEN `!i j. CB' i j (q i j)` SUBAGOAL_TAC;
54764 ASM_MESON_TAC[simple_arc_end_end2];
54765 TYPE_THEN `!i j. CA' i j (A' i)` SUBAGOAL_TAC;
54766 ASM_MESON_TAC[simple_arc_end_end];
54767 TYPE_THEN `!i j. CB' i j (B' j)` SUBAGOAL_TAC;
54768 ASM_MESON_TAC[simple_arc_end_end];
54770 TYPE_THEN `!i i' j. CA' i j (A' i') ==> (i = i')` SUBAGOAL_TAC;
54772 FIRST_ASSUM IMATCH_MP_TAC ;
54773 TYPE_THEN `j` EXISTS_TAC;
54774 REWRITE_TAC[INTER;EMPTY_EXISTS];
54775 TYPE_THEN `j` EXISTS_TAC;
54776 TYPE_THEN `(A' i')` EXISTS_TAC;
54779 TYPE_THEN `!i j j'. CB' i j (B' j') ==> (j = j')` SUBAGOAL_TAC;
54782 FIRST_ASSUM IMATCH_MP_TAC ;
54783 TYPE_THEN `i` EXISTS_TAC;
54784 REWRITE_TAC[INTER;EMPTY_EXISTS];
54785 TYPE_THEN `i` EXISTS_TAC;
54786 TYPE_THEN `(B' j')` EXISTS_TAC;
54789 TYPE_THEN `!i i' j. ~CB' i j (A' i') ` SUBAGOAL_TAC;
54790 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i'`;`j`;`A' i'`]);
54792 USEH 6409 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
54793 UNDH 6711 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i'`;`j`]);
54794 TYPE_THEN `A' i'` EXISTS_TAC;
54796 TYPE_THEN `i'` UNABBREV_TAC;
54797 ASM_MESON_TAC[simple_arc_end_distinct];
54799 TYPE_THEN `!i j j'. ~CA' i j (B' j') ` SUBAGOAL_TAC;
54800 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j'`;`i`;`j`;`B' j'`]);
54802 TYPE_THEN `j'` UNABBREV_TAC;
54803 ASM_MESON_TAC[simple_arc_end_distinct];
54805 TYPE_THEN `!i j. CE i j INTER A = {(A' i)}` SUBAGOAL_TAC;
54806 REWRITE_TAC[eq_sing;INR IN_SING;INTER];
54807 TYPE_THEN `A` UNABBREV_TAC;
54808 REWRITE_TAC[IMAGE];
54809 TYPE_THEN `CE` UNABBREV_TAC;
54810 REWRITE_TAC[UNION];
54815 TYPE_THEN `u'` UNABBREV_TAC ;
54816 TYPE_THEN `x' = i` SUBAGOAL_TAC;
54820 TYPE_THEN `!i j. CE i j INTER B = {(B' j)}` SUBAGOAL_TAC;
54821 REWRITE_TAC[eq_sing;INR IN_SING;INTER];
54822 TYPE_THEN `B` UNABBREV_TAC;
54823 REWRITE_TAC[IMAGE];
54824 TYPE_THEN `CE` UNABBREV_TAC;
54825 REWRITE_TAC[UNION];
54830 TYPE_THEN `u'` UNABBREV_TAC ;
54831 TYPE_THEN `x' = j` SUBAGOAL_TAC;
54835 TYPE_THEN `!i i'. (A' i = A' i') ==> (i = i')` SUBAGOAL_TAC;
54836 UNDH 1344 THEN DISCH_THEN IMATCH_MP_TAC ;
54839 TYPE_THEN `!j j'. (B' j = B' j') ==> (j = j')` SUBAGOAL_TAC;
54840 UNDH 6780 THEN DISCH_THEN IMATCH_MP_TAC ;
54843 TYPE_THEN `!i j i' j'. ~(CE i j INTER CE i' j' = EMPTY) ==> (i = i') \/ (j = j')` SUBAGOAL_TAC;
54844 PROOF_BY_CONTR_TAC;
54845 FULL_REWRITE_TAC[DE_MORGAN_THM];
54846 TYPE_THEN `CE` UNABBREV_TAC;
54847 USEH 672 (REWRITE_RULE[EMPTY_EXISTS;INTER;UNION]);
54848 USEH 5790 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
54849 USEH 6409 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
54850 FIRST_ASSUM DISJ_CASES_TAC THEN KILLH 7160 THEN (FIRST_ASSUM DISJ_CASES_TAC) ;
54851 UNDH 3113 THEN REWRITE_TAC[] THEN UNDH 6711 THEN DISCH_THEN IMATCH_MP_TAC ;
54854 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i'`;`j'`;`u`]);
54857 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j'`;`i`;`j`;`u`]);
54860 UNDH 2577 THEN REWRITE_TAC[] THEN UNDH 6981 THEN DISCH_THEN IMATCH_MP_TAC ;
54864 TYPE_THEN `!i j. ~(A' i = B' j)` SUBAGOAL_TAC;
54867 TYPE_THEN `!i j j'. ~(j = j') ==> (CE i j INTER CE i j' = {(A' i)})` SUBAGOAL_TAC;
54868 IMATCH_MP_TAC SUBSET_ANTISYM;
54870 TYPE_THEN `CE` UNABBREV_TAC;
54871 REWRITE_TAC[INTER;UNION;SUBSET;INR IN_SING];
54872 FIRST_ASSUM DISJ_CASES_TAC THEN (KILLH 2709) THEN (FIRST_ASSUM DISJ_CASES_TAC );
54873 USEH 6932 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]) THEN ASM_MESON_TAC[];
54874 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i`;`j'`;`x`]);
54877 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j'`;`i`;`j`;`x`]);
54880 USEH 5790 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
54882 REWRITE_TAC[INR IN_SING;SUBSET;INTER];
54883 TYPE_THEN `x` UNABBREV_TAC;
54884 USEH 9014 (REWRITE_RULE[eq_sing;INR IN_SING;INTER]);
54887 TYPE_THEN `!i i' j. ~(i = i') ==> (CE i j INTER CE i' j = {(B' j)})` SUBAGOAL_TAC;
54888 IMATCH_MP_TAC SUBSET_ANTISYM;
54890 TYPE_THEN `CE` UNABBREV_TAC;
54891 REWRITE_TAC[INTER;UNION;SUBSET;INR IN_SING];
54892 FIRST_ASSUM DISJ_CASES_TAC THEN (KILLH 3625) THEN (FIRST_ASSUM DISJ_CASES_TAC );
54893 USEH 6409 (REWRITE_RULE[EMPTY_EXISTS;INTER;eq_sing;INR IN_SING]) THEN ASM_MESON_TAC[];
54894 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i'`;`j`;`x`]);
54897 UNDH 5249 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j`;`i`;`j`;`x`]);
54900 USEH 3599 (REWRITE_RULE[INTER;eq_sing;INR IN_SING;]);
54902 REWRITE_TAC[INR IN_SING;SUBSET;INTER];
54903 TYPE_THEN `x` UNABBREV_TAC;
54904 USEH 4144 (REWRITE_RULE[eq_sing;INR IN_SING;INTER]);
54907 TYPE_THEN `g = (\ (i,j). CE i j)` ABBREV_TAC ;
54908 TYPE_THEN `BIJ g (cartesian UNIV UNIV) E` SUBAGOAL_TAC;
54909 TYPE_THEN `E` UNABBREV_TAC;
54910 IMATCH_MP_TAC inj_bij;
54912 TYPE_THEN `g` UNABBREV_TAC;
54913 TYPE_THEN `?i j. x = (i,j)` SUBAGOAL_TAC;
54914 REWRITE_TAC[PAIR_SPLIT];
54916 TYPE_THEN `x` UNABBREV_TAC;
54917 TYPE_THEN `?i j. y = (i,j)` SUBAGOAL_TAC;
54918 REWRITE_TAC[PAIR_SPLIT];
54920 TYPE_THEN `y` UNABBREV_TAC;
54921 (*** Removed by JRH; this happens automatically now
54922 USEH 8053 (GBETA_RULE);
54924 REWRITE_TAC[PAIR_SPLIT];
54926 TYPE_THEN `!i j. INFINITE (CE i j)` SUBAGOAL_TAC;
54927 IMATCH_MP_TAC simple_arc_infinite;
54928 IMATCH_MP_TAC simple_arc_end_simple;
54931 TYPE_THEN `(i = i') \/ (j = j')` SUBAGOAL_TAC;
54932 FIRST_ASSUM IMATCH_MP_TAC ;
54933 TYPE_THEN `CE i' j'` UNABBREV_TAC;
54934 FULL_REWRITE_TAC[INTER_IDEMPOT];
54937 FULL_REWRITE_TAC[INFINITE];
54938 TYPE_THEN `CE i j` UNABBREV_TAC;
54939 FULL_REWRITE_TAC[FINITE_RULES];
54941 FIRST_ASSUM DISJ_CASES_TAC;
54943 PROOF_BY_CONTR_TAC;
54944 UNDH 2315 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`j'`]);
54946 TYPE_THEN `i'` UNABBREV_TAC;
54947 TYPE_THEN `CE i j'` UNABBREV_TAC;
54948 FULL_REWRITE_TAC[INTER_IDEMPOT];
54949 FULL_REWRITE_TAC[INFINITE];
54950 UNDH 773 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]) THEN ASM_REWRITE_TAC[];
54951 TYPE_THEN `CE i j` UNABBREV_TAC;
54952 FULL_REWRITE_TAC[FINITE_SING];
54954 TYPE_THEN `j'` UNABBREV_TAC;
54955 PROOF_BY_CONTR_TAC;
54956 UNDH 3532 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`i'`;`j`]);
54958 TYPE_THEN `CE i' j` UNABBREV_TAC;
54959 FULL_REWRITE_TAC[INTER_IDEMPOT];
54960 FULL_REWRITE_TAC[INFINITE];
54961 UNDH 773 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]) THEN ASM_REWRITE_TAC[];
54962 TYPE_THEN `CE i j` UNABBREV_TAC;
54963 FULL_REWRITE_TAC[FINITE_SING];
54967 USEH 1061 (MATCH_MP INVERSE_BIJ);
54968 TYPE_THEN `h = INV g (cartesian UNIV UNIV) E` ABBREV_TAC ;
54969 TYPE_THEN `hh = (\ x. (A' (FST (h x)), B' (SND (h x))))` ABBREV_TAC ;
54970 TYPE_THEN `BIJ hh E (cartesian A B)` SUBAGOAL_TAC;
54971 TYPE_THEN `hh` UNABBREV_TAC;
54976 REWRITE_TAC[cartesian];
54977 TYPE_THEN `A` UNABBREV_TAC;
54978 TYPE_THEN `B` UNABBREV_TAC;
54979 REWRITE_TAC[IMAGE;PAIR_SPLIT ];
54981 FULL_REWRITE_TAC[PAIR_SPLIT];
54982 TYPE_THEN `h x = h y` SUBAGOAL_TAC;
54983 REWRITE_TAC[PAIR_SPLIT];
54985 FULL_REWRITE_TAC[BIJ;INJ];
54986 FIRST_ASSUM IMATCH_MP_TAC ;
54990 FULL_REWRITE_TAC[INJ];
54991 FIRST_ASSUM IMATCH_MP_TAC ;
54993 USEH 807 (REWRITE_RULE[cartesian;PAIR_SPLIT]);
54994 REWRITE_TAC[PAIR_SPLIT];
54995 TYPE_THEN `FST x` UNABBREV_TAC;
54996 TYPE_THEN `SND x` UNABBREV_TAC;
54997 TYPE_THEN `A` UNABBREV_TAC;
54998 TYPE_THEN `B` UNABBREV_TAC;
54999 USEH 6050 (REWRITE_RULE[IMAGE]);
55000 USEH 2264 (REWRITE_RULE[IMAGE]);
55001 TYPE_THEN `x'` UNABBREV_TAC;
55002 TYPE_THEN `y` UNABBREV_TAC;
55003 TYPE_THEN `g (x'',x)` EXISTS_TAC;
55005 TYPE_THEN `h (g (x'',x)) = (x'',x)` SUBAGOAL_TAC;
55006 TYPE_THEN `h` UNABBREV_TAC;
55007 IMATCH_MP_TAC inv_comp_left;
55009 REWRITE_TAC[cartesian_univ];
55011 TYPE_THEN `E` UNABBREV_TAC;
55012 IMATCH_MP_TAC image_imp;
55013 REWRITE_TAC[cartesian_univ];
55015 TYPE_THEN `G = mk_graph_t (A UNION B,E,(\ e . {(FST (hh e)), (SND (hh e)) }))` ABBREV_TAC ;
55016 TYPE_THEN `graph_isomorphic k33_graph G` SUBAGOAL_TAC;
55017 TYPE_THEN `G` UNABBREV_TAC;
55018 IMATCH_MP_TAC k33_iso;
55020 TYPE_THEN `A` UNABBREV_TAC;
55021 TYPE_THEN `B` UNABBREV_TAC;
55023 REWRITE_TAC[HAS_SIZE] ;
55024 TYPE_THEN `FINITE (IMAGE A' UNIV) /\ FINITE (IMAGE B' UNIV)` SUBAGOAL_TAC;
55025 ASSUME_TAC three_t_size3;
55026 FULL_REWRITE_TAC[HAS_SIZE];
55027 CONJ_TAC THEN IMATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[];
55029 ASSUME_TAC three_t_size3;
55030 FULL_REWRITE_TAC[HAS_SIZE];
55031 TYPE_THEN `(CARD (IMAGE A' UNIV) = 3) /\ (CARD (IMAGE B' UNIV) = 3)` SUBAGOAL_TAC;
55034 CONJ_TAC THEN IMATCH_MP_TAC (INR CARD_IMAGE_INJ) THEN ASM_MESON_TAC[];
55036 PROOF_BY_CONTR_TAC;
55037 USEH 9575 (REWRITE_RULE[IMAGE;INTER;EMPTY_EXISTS]);
55038 TYPE_THEN `u` UNABBREV_TAC;
55041 THM_INTRO_TAC[`k33_graph`;`G`] graph_isomorphic_graph;
55042 ASM_REWRITE_TAC[k33_isgraph];
55043 THM_INTRO_TAC[] k33_nonplanar;
55044 FULL_REWRITE_TAC[planar_graph];
55045 UNDH 3419 THEN ASM_REWRITE_TAC[];
55046 TYPE_THEN `G` EXISTS_TAC;
55047 THM_INTRO_TAC[`k33_graph`;`G`] graph_isomorphic_symm;
55048 ASM_REWRITE_TAC[k33_isgraph];
55050 REWRITE_TAC[plane_graph];
55054 TYPE_THEN `G` UNABBREV_TAC;
55055 REWRITE_TAC[graph_vertex_mk_graph];
55056 REWRITE_TAC[UNION;SUBSET];
55057 TYPE_THEN `A` UNABBREV_TAC;
55058 TYPE_THEN `B` UNABBREV_TAC;
55059 USEH 986 (REWRITE_RULE[IMAGE]);
55060 FIRST_ASSUM DISJ_CASES_TAC;
55061 TYPE_THEN `x` UNABBREV_TAC;
55062 UNDH 2402 THEN (ASM_MESON_TAC[simple_arc_end_simple;simple_arc_euclid;subset_imp]);
55063 TYPE_THEN `x` UNABBREV_TAC;
55064 UNDH 7678 THEN (ASM_MESON_TAC[simple_arc_end_simple;simple_arc_euclid;subset_imp]);
55067 TYPE_THEN `G` UNABBREV_TAC;
55068 REWRITE_TAC[graph_edge_mk_graph];
55069 TYPE_THEN `E` UNABBREV_TAC;
55070 REWRITE_TAC[IMAGE;SUBSET];
55071 TYPE_THEN `x` UNABBREV_TAC;
55072 TYPE_THEN `g` UNABBREV_TAC;
55073 TYPE_THEN `?i j. (x' = (i,j))` SUBAGOAL_TAC;
55074 REWRITE_TAC[PAIR_SPLIT];
55076 TYPE_THEN `x' ` UNABBREV_TAC;
55078 IMATCH_MP_TAC simple_arc_end_simple;
55079 TYPE_THEN `(A' i)` EXISTS_TAC;
55080 TYPE_THEN `(B' j)` EXISTS_TAC;
55084 TYPE_THEN `G` UNABBREV_TAC;
55085 REWRITE_TAC[graph_edge_mk_graph;graph_inc_mk_graph;graph_vertex_mk_graph];
55086 KILLH 6876 THEN KILLH 5591 THEN KILLH 6365;
55087 FULL_REWRITE_TAC[graph_edge_mk_graph];
55088 TYPE_THEN `E` UNABBREV_TAC;
55089 USEH 1953 (REWRITE_RULE[IMAGE;cartesian_univ]);
55090 TYPE_THEN `e` UNABBREV_TAC;
55091 TYPE_THEN `hh` UNABBREV_TAC;
55093 TYPE_THEN `h (g (x)) = x` SUBAGOAL_TAC;
55094 TYPE_THEN `h` UNABBREV_TAC;
55095 IMATCH_MP_TAC inv_comp_left;
55096 ASM_REWRITE_TAC[cartesian_univ];
55098 TYPE_THEN `?i j. (x = (i,j))` SUBAGOAL_TAC;
55099 REWRITE_TAC[PAIR_SPLIT] THEN MESON_TAC[];
55100 TYPE_THEN `x` UNABBREV_TAC;
55101 TYPE_THEN `g` UNABBREV_TAC;
55103 IMATCH_MP_TAC EQ_EXT;
55104 REWRITE_TAC[INTER;UNION;INR in_pair];
55105 TYPE_THEN `A` UNABBREV_TAC;
55106 TYPE_THEN `B` UNABBREV_TAC;
55107 REWRITE_TAC[IMAGE];
55108 FULL_REWRITE_TAC[eq_sing; INTER; INR IN_SING];
55109 TYPE_THEN `x` UNABBREV_TAC;
55113 KILLH 7987 THEN KILLH 6305 THEN KILLH 5812 THEN KILLH 3738 THEN KILLH 8499;
55114 TYPE_THEN `!e. E e ==> (?i j. (e = CE i j))` SUBAGOAL_TAC;
55115 TYPE_THEN `E` UNABBREV_TAC;
55116 TYPE_THEN `g` UNABBREV_TAC;
55117 USEH 7673 (REWRITE_RULE[cartesian_univ;IMAGE]);
55118 TYPE_THEN `(? i j. x = (i,j))` SUBAGOAL_TAC;
55119 REWRITE_TAC[PAIR_SPLIT] THEN MESON_TAC[];
55120 TYPE_THEN `x` UNABBREV_TAC;
55121 TYPE_THEN `e''` UNABBREV_TAC;
55125 TYPE_THEN `G` UNABBREV_TAC;
55126 FULL_REWRITE_TAC[graph_vertex_mk_graph;graph_edge_mk_graph];
55127 KILLH 4886 THEN KILLH 6107 THEN KILLH 6780 THEN KILLH 1344;
55131 TYPE_THEN `e` UNABBREV_TAC;
55132 TYPE_THEN `e'` UNABBREV_TAC;
55133 KILLH 5790 THEN KILLH 6409 THEN KILLH 5249 THEN KILLH 5804;
55134 REWRITE_TAC[INTER;SUBSET;UNION];
55135 TYPE_THEN `(i' = i)` ASM_CASES_TAC;
55137 FULL_REWRITE_TAC[eq_sing;INTER;INR IN_SING];
55138 TYPE_THEN `A` UNABBREV_TAC;
55139 REWRITE_TAC[IMAGE];
55141 TYPE_THEN `i'` UNABBREV_TAC;
55142 TYPE_THEN `i` EXISTS_TAC;
55143 TYPE_THEN `~(j' = j)` SUBAGOAL_TAC;
55144 TYPE_THEN `j'` UNABBREV_TAC;
55146 UNDH 221 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`j'`]);
55147 UNDH 7790 THEN ASM_REWRITE_TAC[];
55148 FIRST_ASSUM IMATCH_MP_TAC ;
55151 TYPE_THEN `(i' = i) \/ (j' = j)` SUBAGOAL_TAC;
55152 FIRST_ASSUM IMATCH_MP_TAC ;
55153 USEH 5273 (REWRITE_RULE[INTER;EQ_EMPTY]);
55156 TYPE_THEN `j'` UNABBREV_TAC;
55159 TYPE_THEN `x = B' j` BACK_TAC;
55161 TYPE_THEN `B` UNABBREV_TAC;
55162 IMATCH_MP_TAC image_imp;
55164 USEH 3532 (REWRITE_RULE[eq_sing;INR IN_SING;INTER]);
55165 UNDH 9432 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`i'`;`j`]);
55166 UNDH 7528 THEN ASM_REWRITE_TAC[];
55167 FIRST_ASSUM IMATCH_MP_TAC ;
55169 (* Tue Jan 4 15:3282:39 EST 2005 *)
55173 let simple_arc_midpoint = prove_by_refinement(
55174 `!C v w. simple_arc_end C v w ==>
55175 (?u. (C u /\ ~(u = v) /\ ~(u = w)))`,
55179 THM_INTRO_TAC[`C`] simple_arc_infinite;
55180 IMATCH_MP_TAC simple_arc_end_simple;
55183 THM_INTRO_TAC[`C`;`{v,w}`;] INFINITE_DIFF_FINITE;
55185 THM_INTRO_TAC[`v`;`w`] pair_size_2;
55186 ASM_MESON_TAC[simple_arc_end_distinct];
55187 FULL_REWRITE_TAC[HAS_SIZE];
55189 USEH 3168 (MATCH_MP INFINITE_NONEMPTY);
55190 FULL_REWRITE_TAC[DIFF;EMPTY_EXISTS;INR in_pair];
55191 TYPE_THEN `u` EXISTS_TAC;
55196 let simple_arc_choose_end = prove_by_refinement(
55197 `!C. simple_arc top2 C ==> (?v w. simple_arc_end C v w)`,
55200 REWRITE_TAC[simple_arc;simple_arc_end];
55201 FULL_REWRITE_TAC[top2_unions];
55204 TYPE_THEN `f` EXISTS_TAC;
55205 TYPE_THEN `f(&0)` EXISTS_TAC;
55206 TYPE_THEN `f(&1)` EXISTS_TAC;
55211 let cut_arc_replace = prove_by_refinement(
55212 `!A B u v. A SUBSET B /\ simple_arc top2 A /\ simple_arc top2 B /\
55213 A u /\ A v /\ ~(u = v) ==> (cut_arc B u v = cut_arc A u v)`,
55217 IMATCH_MP_TAC cut_arc_unique;
55220 IMATCH_MP_TAC SUBSET_TRANS;
55221 TYPE_THEN `A` EXISTS_TAC;
55223 IMATCH_MP_TAC cut_arc_subset;
55225 IMATCH_MP_TAC cut_arc_simple;
55230 let cut_arc_order = prove_by_refinement(
55231 `!C u v w. simple_arc_end C v w /\ C u /\ ~(u = v) /\ ~(u = w) ==>
55232 ~(cut_arc C v u w)`,
55236 THM_INTRO_TAC[`C`;`u`;`v`;`w`] cut_arc_inter;
55238 USEH 1187 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
55241 UNDH 1985 THEN REWRITE_TAC [];
55242 IMATCH_MP_TAC EQ_SYM;
55243 FIRST_ASSUM IMATCH_MP_TAC ;
55245 IMATCH_MP_TAC simple_arc_end_end2;
55246 TYPE_THEN `u` EXISTS_TAC;
55247 IMATCH_MP_TAC cut_arc_simple;
55250 IMATCH_MP_TAC simple_arc_end_simple;
55252 IMATCH_MP_TAC simple_arc_end_end2;
55258 (* First direction of Jordan curve theorem. *)
55260 let jordan_curve_no_inj3 = prove_by_refinement(
55262 simple_closed_curve top2 C /\
55263 INJ p (UNIV:three_t ->bool) (euclid 2) /\
55265 (!i j A. simple_arc_end A (p i) (p j) ==> ~(A INTER C = EMPTY))
55270 THM_INTRO_TAC[`C`] jordan_curve_seg3;
55273 TYPE_THEN `!i. ?v w. simple_arc_end (s i) v w` SUBAGOAL_TAC;
55274 THM_INTRO_TAC[`s i`] simple_arc_choose_end;
55281 TYPE_THEN `!i. ?B. s i B /\ ~(B = v i) /\ ~(B = w i)` SUBAGOAL_TAC;
55282 THM_INTRO_TAC[`s i`;`v i`;`w i`] simple_arc_midpoint;
55284 TYPE_THEN `u` EXISTS_TAC;
55288 TYPE_THEN `!i. euclid 2 (p i)` SUBAGOAL_TAC;
55289 FULL_REWRITE_TAC[INJ];
55292 TYPE_THEN `!i j. ?E. simple_arc_end E (p i) (B j) /\ (E INTER C SUBSET (s j)) /\ (!e. E e /\ ~C e /\ ~(p i = e) ==> (cut_arc E (p i) e INTER C = EMPTY))` SUBAGOAL_TAC;
55293 IMATCH_MP_TAC jordan_curve_access;
55294 TYPE_THEN `v j` EXISTS_TAC;
55295 TYPE_THEN `w j` EXISTS_TAC;
55298 THM_INTRO_TAC[`i`] three_t_not_sing;
55299 TYPE_THEN `p j` EXISTS_TAC;
55301 UNDH 7630 THEN FULL_REWRITE_TAC[INJ];
55302 FIRST_ASSUM IMATCH_MP_TAC ;
55307 TYPE_THEN `!i j i' j' u. E i j u /\ E i' j' u /\ C u ==> (j = j') /\ s j u` SUBAGOAL_TAC;
55309 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
55310 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j'`]);
55311 USEH 6239 (REWRITE_RULE[INTER;SUBSET]);
55312 USEH 4225 (REWRITE_RULE[INTER;SUBSET]);
55314 FIRST_ASSUM IMATCH_MP_TAC ;
55315 USEH 9012 (REWRITE_RULE[EQ_EMPTY;INTER]);
55319 TYPE_THEN `!i j. (p i = p j) ==> (i = j)` SUBAGOAL_TAC;
55320 FULL_REWRITE_TAC[INJ];
55321 FIRST_ASSUM IMATCH_MP_TAC ;
55324 TYPE_THEN `!i j. E i j (p i)` SUBAGOAL_TAC;
55325 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
55326 USEH 3415 (MATCH_MP simple_arc_end_end);
55329 TYPE_THEN `!i j i' j' u. E i j u /\ E i' j' u /\ ~C u ==> (i = i')` SUBAGOAL_TAC;
55330 PROOF_BY_CONTR_TAC;
55332 TYPE_THEN `u = p i` ASM_CASES_TAC;
55333 TYPE_THEN `u` UNABBREV_TAC;
55334 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j'`]);
55335 UNDH 8557 THEN DISCH_THEN (THM_INTRO_TAC[`p i`]);
55338 UNDH 382 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`i`;`cut_arc (E i' j') (p i') (p i)`]);
55339 IMATCH_MP_TAC cut_arc_simple;
55342 IMATCH_MP_TAC simple_arc_end_simple;
55346 UNDH 1303 THEN ASM_REWRITE_TAC[];
55348 TYPE_THEN `u = p i'` ASM_CASES_TAC;
55349 TYPE_THEN `u` UNABBREV_TAC;
55350 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
55351 UNDH 3041 THEN DISCH_THEN (THM_INTRO_TAC[`p i'`]);
55353 UNDH 382 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`i'`;`cut_arc (E i j) (p i) (p i')`]);
55354 IMATCH_MP_TAC cut_arc_simple;
55356 IMATCH_MP_TAC simple_arc_end_simple;
55359 UNDH 9380 THEN ASM_REWRITE_TAC[];
55362 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
55363 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j'`]);
55364 TYPE_THEN `cut_arc (E i j) (p i) u INTER C = EMPTY` SUBAGOAL_TAC;
55365 FIRST_ASSUM IMATCH_MP_TAC ;
55367 TYPE_THEN `cut_arc (E i' j') (p i') u INTER C = EMPTY` SUBAGOAL_TAC;
55368 FIRST_ASSUM IMATCH_MP_TAC ;
55370 THM_INTRO_TAC[`E i j`;`p i`;`u`] cut_arc_simple;
55372 IMATCH_MP_TAC simple_arc_end_simple;
55375 THM_INTRO_TAC[`E i' j'`;`p i'`;`u`] cut_arc_simple;
55377 IMATCH_MP_TAC simple_arc_end_simple;
55381 THM_INTRO_TAC[`cut_arc (E i j) (p i) u`;`cut_arc (E i' j') (p i') u`;`p i`;`u`;`p i'`] simple_arc_end_subset_trans;
55384 IMATCH_MP_TAC simple_arc_end_symm;
55386 UNDH 3113 THEN ASM_REWRITE_TAC[];
55387 FIRST_ASSUM IMATCH_MP_TAC ;
55390 UNDH 382 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`i'`;`U`]);
55392 UNDH 3232 THEN UNDH 5860 THEN UNDH 4934 THEN UNDH 7573 THEN REWRITE_TAC[EMPTY_EXISTS;INTER;SUBSET] THEN REWRITE_TAC[EQ_EMPTY;UNION] THEN MESON_TAC[];
55394 TYPE_THEN `!i j. ?E'' u u''. E'' SUBSET E i j /\ simple_arc_end E'' u u'' /\ (E'' INTER (UNIONS (IMAGE (E i) {k | ~(k = j)})) = {u}) /\ (E'' INTER {(B j)} = {u''})` SUBAGOAL_TAC;
55395 IMATCH_MP_TAC simple_arc_end_restriction;
55397 IMATCH_MP_TAC simple_arc_end_simple THEN ASM_MESON_TAC[];
55400 IMATCH_MP_TAC top_closed_unions;
55401 REWRITE_TAC[top2_top];
55403 IMATCH_MP_TAC FINITE_IMAGE;
55404 IMATCH_MP_TAC FINITE_SUBSET;
55405 TYPE_THEN `UNIV:three_t -> bool` EXISTS_TAC ;
55406 REWRITE_TAC[three_t_finite];
55407 REWRITE_TAC[SUBSET;IMAGE];
55408 TYPE_THEN `x` UNABBREV_TAC;
55409 ASM_MESON_TAC[simple_arc_end_closed];
55412 ASM_MESON_TAC[simple_arc_end_end_closed2];
55415 REWRITE_TAC[EQ_EMPTY;INTER;UNIONS;IMAGE;INR IN_SING ];
55416 TYPE_THEN `u` UNABBREV_TAC;
55417 TYPE_THEN `x` UNABBREV_TAC;
55418 UNDH 2306 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i`;`x'`;`B j`]);
55420 IMATCH_MP_TAC subset_imp;
55421 TYPE_THEN `s j` EXISTS_TAC;
55423 UNDH 7917 THEN ASM_REWRITE_TAC[];
55425 REWRITE_TAC[EMPTY_EXISTS];
55427 TYPE_THEN `p i` EXISTS_TAC;
55428 REWRITE_TAC[INTER;UNIONS;IMAGE];
55430 CONV_TAC (dropq_conv "u");
55431 THM_INTRO_TAC[`j`] three_t_not_sing;
55432 TYPE_THEN `j'` EXISTS_TAC;
55434 REWRITE_TAC[INTER];
55435 TYPE_THEN `B j` EXISTS_TAC;
55436 ASM_REWRITE_TAC[INR IN_SING ];
55437 IMATCH_MP_TAC simple_arc_end_end2;
55445 TYPE_THEN `u'' = (\ i j. B j)` SUBAGOAL_TAC;
55446 IMATCH_MP_TAC EQ_EXT;
55447 IMATCH_MP_TAC EQ_EXT;
55450 USEH 2213 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
55451 IMATCH_MP_TAC EQ_SYM;
55452 FIRST_ASSUM IMATCH_MP_TAC ;
55455 TYPE_THEN `u''` UNABBREV_TAC;
55459 TYPE_THEN `!i j. (?E' ua u'. E' SUBSET (E'' i j) /\ simple_arc_end E' ua u' /\ (E' INTER {(u i j)} = {ua}) /\ (E' INTER (s j) = {u'}))` SUBAGOAL_TAC;
55460 IMATCH_MP_TAC simple_arc_end_restriction;
55462 IMATCH_MP_TAC simple_arc_end_simple;
55466 ASM_MESON_TAC[simple_arc_end_end_closed];
55468 ASM_MESON_TAC[simple_arc_end_closed];
55471 PROOF_BY_CONTR_TAC;
55472 USEH 4139 (REWRITE_RULE[INTER;EMPTY_EXISTS;INR IN_SING]);
55473 TYPE_THEN `u'` UNABBREV_TAC;
55476 USEH 9848 (REWRITE_RULE[eq_sing;INR IN_SING;INTER;UNIONS;IMAGE]);
55477 TYPE_THEN `u''` UNABBREV_TAC;
55478 UNDH 9165 THEN REWRITE_TAC[];
55479 UNDH 3778 THEN DISCH_THEN IMATCH_MP_TAC ;
55480 UNDH 1277 THEN REWRITE_TAC[EMPTY_EXISTS;INTER];
55481 TYPE_THEN `u i j` EXISTS_TAC;
55483 TYPE_THEN `C (u i j)` SUBAGOAL_TAC;
55484 IMATCH_MP_TAC subset_imp;
55485 TYPE_THEN `s j` EXISTS_TAC;
55487 UNDH 2306 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i`;`x`;`u i j`]);
55489 IMATCH_MP_TAC subset_imp;
55490 TYPE_THEN `E'' i j` EXISTS_TAC;
55492 TYPE_THEN `j` UNABBREV_TAC;
55495 REWRITE_TAC[EMPTY_EXISTS;INTER;INR IN_SING ];
55497 TYPE_THEN `u i j` EXISTS_TAC;
55498 IMATCH_MP_TAC simple_arc_end_end;
55501 TYPE_THEN `B j` EXISTS_TAC;
55503 IMATCH_MP_TAC simple_arc_end_end2;
55508 TYPE_THEN `!i j k q x. E i k x /\ E'' i j q /\ ~(q = u i j) /\ ~(q = B j) /\ cut_arc (E i j) (q) (B j) x ==> (j = k)` SUBAGOAL_TAC;
55509 PROOF_BY_CONTR_TAC;
55511 TYPE_THEN `cut_arc (E i j) q (B j) = cut_arc (E'' i j) q (B j)` SUBAGOAL_TAC;
55512 IMATCH_MP_TAC cut_arc_replace;
55515 IMATCH_MP_TAC simple_arc_end_simple;
55518 IMATCH_MP_TAC simple_arc_end_simple;
55520 IMATCH_MP_TAC simple_arc_end_end2;
55524 TYPE_THEN `E'' i j x` SUBAGOAL_TAC;
55525 IMATCH_MP_TAC subset_imp;
55526 TYPE_THEN `cut_arc (E'' i j) q (B j)` EXISTS_TAC;
55528 IMATCH_MP_TAC cut_arc_subset;
55531 IMATCH_MP_TAC simple_arc_end_simple;
55533 IMATCH_MP_TAC simple_arc_end_end2;
55536 UNDH 2275 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
55537 USEH 9848 (REWRITE_RULE[INTER;UNIONS;IMAGE;eq_sing;INR IN_SING]);
55538 TYPE_THEN `x = u i j` SUBAGOAL_TAC;
55539 FIRST_ASSUM IMATCH_MP_TAC ;
55541 CONV_TAC (dropq_conv "u");
55542 TYPE_THEN `k` EXISTS_TAC;
55544 TYPE_THEN `x` UNABBREV_TAC;
55546 THM_INTRO_TAC[`E'' i j`;`q`;`B j`;`u i j`] cut_arc_order;
55548 IMATCH_MP_TAC simple_arc_end_symm;
55550 UNDH 1152 THEN ASM_REWRITE_TAC[];
55551 ONCE_REWRITE_TAC[cut_arc_symm];
55554 TYPE_THEN `?u'. !i j. E' i j SUBSET E'' i j /\ simple_arc_end (E' i j) (u i j) (u' i j) /\ (E' i j INTER s j = {(u' i j)})` SUBAGOAL_TAC;
55559 TYPE_THEN `u'` EXISTS_TAC;
55563 USEH 7215 (REWRITE_RULE[INTER;INR IN_SING;eq_sing;]);
55564 TYPE_THEN `ua i j` UNABBREV_TAC;
55568 TYPE_THEN `!i j. E' i j SUBSET E i j` SUBAGOAL_TAC;
55569 IMATCH_MP_TAC SUBSET_TRANS;
55570 TYPE_THEN `E'' i j` EXISTS_TAC;
55573 TYPE_THEN `!i j. ?q. (E' i j q) /\ (E'' i j q) /\ (E i j q) /\ ~(q = u i j) /\ ~(q = u' i j) /\ ~(s j q) /\ (!k. E i k q ==> (j = k))` SUBAGOAL_TAC;
55576 THM_INTRO_TAC[`E' i j`;`u i j`;`u' i j`] simple_arc_midpoint;
55578 TYPE_THEN `q = u''` ABBREV_TAC ;
55579 TYPE_THEN `u''` UNABBREV_TAC;
55580 TYPE_THEN `q` EXISTS_TAC;
55583 IMATCH_MP_TAC subset_imp;
55584 TYPE_THEN `E' i j` EXISTS_TAC;
55588 IMATCH_MP_TAC subset_imp;
55589 TYPE_THEN `E' i j` EXISTS_TAC;
55593 USEH 3228 (REWRITE_RULE[INR IN_SING;eq_sing;INTER]);
55597 FIRST_ASSUM IMATCH_MP_TAC ;
55598 TYPE_THEN `q` EXISTS_TAC;
55599 TYPE_THEN `q` EXISTS_TAC;
55602 UNDH 9552 THEN REWRITE_TAC[];
55603 TYPE_THEN `q` UNABBREV_TAC;
55605 THM_INTRO_TAC[`E i j`;`q`;`B j`] cut_arc_simple;
55608 IMATCH_MP_TAC simple_arc_end_simple;
55610 IMATCH_MP_TAC simple_arc_end_end2;
55612 IMATCH_MP_TAC simple_arc_end_end;
55618 TYPE_THEN `CA = (\ i j. cut_arc (E i j) (p i) (q i j))` ABBREV_TAC ;
55619 TYPE_THEN `CB = (\ i j. cut_arc (E i j) (q i j) (B j))` ABBREV_TAC ;
55620 TYPE_THEN `!i j. ~(q i j = p i)` SUBAGOAL_TAC;
55623 THM_INTRO_TAC[`j`] three_t_not_sing;
55624 UNDH 2577 THEN REWRITE_TAC[];
55625 FIRST_ASSUM IMATCH_MP_TAC ;
55628 TYPE_THEN `!i j. ~(q i j = B j)` SUBAGOAL_TAC;
55631 TYPE_THEN `!i j. simple_arc_end (CA i j) (p i) (q i j)` SUBAGOAL_TAC;
55632 TYPE_THEN `CA` UNABBREV_TAC;
55633 IMATCH_MP_TAC cut_arc_simple;
55635 IMATCH_MP_TAC simple_arc_end_simple;
55638 TYPE_THEN `!i j. simple_arc_end (CB i j) (q i j) (B j)` SUBAGOAL_TAC;
55639 TYPE_THEN `CB` UNABBREV_TAC;
55640 IMATCH_MP_TAC cut_arc_simple;
55643 IMATCH_MP_TAC simple_arc_end_simple;
55645 IMATCH_MP_TAC simple_arc_end_end2;
55648 THM_INTRO_TAC[`q`;`p`;`CA`;`B`;`CB`] no_k33_planar_graph_data THENL [ALL_TAC;ASM_REWRITE_TAC[]];
55650 TYPE_THEN `(!i j. simple_arc_end (CB i j) (B j) (q i j)) ` SUBAGOAL_TAC;
55651 IMATCH_MP_TAC simple_arc_end_symm;
55655 TYPE_THEN `!i j. CA i j INTER C = EMPTY` SUBAGOAL_TAC;
55656 UNDH 807 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]);
55657 TYPE_THEN `CA` UNABBREV_TAC;
55658 FIRST_ASSUM IMATCH_MP_TAC ;
55660 USEH 6239 (REWRITE_RULE[INTER;SUBSET]);
55663 TYPE_THEN `!i j j' u. CB i j u /\ E i j' u ==> (j = j')` SUBAGOAL_TAC;
55664 FIRST_ASSUM IMATCH_MP_TAC ;
55665 TYPE_THEN `i` EXISTS_TAC;
55666 TYPE_THEN `q i j` EXISTS_TAC;
55667 TYPE_THEN `u''` EXISTS_TAC;
55669 TYPE_THEN `CB` UNABBREV_TAC;
55672 TYPE_THEN `!i j. CB i j = cut_arc (E'' i j) (q i j) (B j)` SUBAGOAL_TAC;
55673 TYPE_THEN `CB` UNABBREV_TAC;
55674 IMATCH_MP_TAC cut_arc_replace;
55676 TYPE_THEN `simple_arc top2 (E i j)` SUBAGOAL_TAC;
55677 IMATCH_MP_TAC simple_arc_end_simple;
55680 ASM_MESON_TAC[simple_arc_end_end2;simple_arc_end_simple];
55682 TYPE_THEN `!i i' j j' u. ~(i = i') /\ CB i j u /\ E i' j' u ==> (j = j') /\ s j u` SUBAGOAL_TAC;
55683 FIRST_ASSUM IMATCH_MP_TAC ;
55684 TYPE_THEN `i` EXISTS_TAC;
55685 TYPE_THEN `i'` EXISTS_TAC;
55687 TYPE_THEN `CB` UNABBREV_TAC;
55689 IMATCH_MP_TAC subset_imp;
55690 TYPE_THEN `cut_arc (E i j) (q i j) (B j)` EXISTS_TAC;
55692 IMATCH_MP_TAC SUBSET_TRANS;
55693 TYPE_THEN `E'' i j` EXISTS_TAC;
55695 IMATCH_MP_TAC cut_arc_subset;
55697 ASM_MESON_TAC[simple_arc_end_end2;simple_arc_end_simple];
55698 PROOF_BY_CONTR_TAC;
55699 UNDH 3113 THEN REWRITE_TAC[];
55700 UNDH 6138 THEN DISCH_THEN (IMATCH_MP_TAC );
55701 TYPE_THEN `j` EXISTS_TAC;
55702 TYPE_THEN `j'` EXISTS_TAC;
55703 TYPE_THEN `u''` EXISTS_TAC;
55707 TYPE_THEN `!i j. CB i j SUBSET E i j` SUBAGOAL_TAC;
55708 TYPE_THEN `CB` UNABBREV_TAC;
55709 IMATCH_MP_TAC cut_arc_subset;
55711 ASM_MESON_TAC[simple_arc_end_end2;simple_arc_end_simple];
55713 TYPE_THEN `(!i j i' j'. ~(CB i j INTER CB i' j' = {}) ==> (j = j'))` SUBAGOAL_TAC;
55714 USEH 2001 (REWRITE_RULE [INTER;EMPTY_EXISTS]);
55715 TYPE_THEN `i = i'` ASM_CASES_TAC;
55716 UNDH 758 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`j'`;`u''`]);
55718 IMATCH_MP_TAC subset_imp;
55719 TYPE_THEN `CB i' j'` EXISTS_TAC;
55723 UNDH 3773 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`i'`;`j`;`j'`;`u''`]);
55725 IMATCH_MP_TAC subset_imp;
55726 TYPE_THEN `CB i' j'` EXISTS_TAC;
55728 TYPE_THEN `j'` UNABBREV_TAC;
55731 TYPE_THEN `!i j. CA i j SUBSET E i j` SUBAGOAL_TAC;
55732 TYPE_THEN `CA` UNABBREV_TAC;
55733 IMATCH_MP_TAC cut_arc_subset;
55735 ASM_MESON_TAC[simple_arc_end_simple];
55737 TYPE_THEN `(!i j i' j' u. CB i j u /\ CA i' j' u ==> (i = i') /\ (j = j') /\ (u = q i j))` SUBAGOAL_TAC;
55738 TYPE_THEN `i = i'` ASM_CASES_TAC;
55740 TYPE_THEN `i'` UNABBREV_TAC;
55741 UNDH 758 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`j'`;`u''`]);
55743 IMATCH_MP_TAC subset_imp;
55744 TYPE_THEN `CA i j'` EXISTS_TAC;
55746 TYPE_THEN `j'` UNABBREV_TAC;
55747 THM_INTRO_TAC[`E i j`;`q i j`;`p i`;`B j`] cut_arc_inter;
55749 USEH 699 (REWRITE_RULE[INTER;INR IN_SING;eq_sing]);
55750 FIRST_ASSUM IMATCH_MP_TAC ;
55751 TYPE_THEN `CA` UNABBREV_TAC;
55752 TYPE_THEN `CB` UNABBREV_TAC;
55754 PROOF_BY_CONTR_TAC;
55755 UNDH 3773 THEN DISCH_THEN ( THM_INTRO_TAC[`i`;`i'`;`j`;`j'`;`u''`]);
55757 IMATCH_MP_TAC subset_imp;
55758 TYPE_THEN `CA i' j'` EXISTS_TAC;
55760 TYPE_THEN `j'` UNABBREV_TAC;
55762 USEH 682 (REWRITE_RULE[INTER;EQ_EMPTY]);
55763 UNDH 218 THEN DISCH_THEN (THM_INTRO_TAC[`i'`;`j`;`u''`]);
55764 UNDH 2186 THEN ASM_REWRITE_TAC[];
55765 IMATCH_MP_TAC subset_imp;
55766 TYPE_THEN `s j` EXISTS_TAC;
55771 UNDH 8763 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`;`i'`;`j'`;`q i j`]);
55773 TYPE_THEN `CB` UNABBREV_TAC;
55774 ASM_MESON_TAC[simple_arc_end_end];
55776 ASM_MESON_TAC[simple_arc_end_end2];
55777 TYPE_THEN `i'` UNABBREV_TAC;
55778 TYPE_THEN `j'` UNABBREV_TAC;
55780 USEH 6538 (REWRITE_RULE[EMPTY_EXISTS;INTER]);
55781 UNDH 6138 THEN DISCH_THEN IMATCH_MP_TAC ;
55782 TYPE_THEN `j` EXISTS_TAC;
55783 TYPE_THEN `j'` EXISTS_TAC;
55784 TYPE_THEN `u''` EXISTS_TAC;
55786 IMATCH_MP_TAC subset_imp;
55787 TYPE_THEN `CA i j` EXISTS_TAC;
55790 IMATCH_MP_TAC subset_imp;
55791 TYPE_THEN `CA i' j'` EXISTS_TAC;
55793 UNDH 682 THEN DISCH_THEN (THM_INTRO_TAC[`i`;`j`]) THEN ASM_REWRITE_TAC[EMPTY_EXISTS;INTER ];
55794 UNDH 7281 THEN REWRITE_TAC[EMPTY_EXISTS;INTER];
55797 (* Sun Jan 16 08:48:56 EST 2005 *)
55802 (* ------------------------------------------------------------------ *)
55804 (* ------------------------------------------------------------------ *)
55806 (* finish off Jordan curve *)
55808 let simple_closed_curve_compact = prove_by_refinement(
55809 `!C. simple_closed_curve top2 C ==> compact top2 C`,
55813 REWRITE_TAC[simple_closed_curve];
55814 TYPE_THEN `C` UNABBREV_TAC;
55815 IMATCH_MP_TAC image_compact;
55818 FULL_REWRITE_TAC[top2_unions];
55820 REWRITE_TAC[interval_compact];
55821 REWRITE_TAC[IMAGE;SUBSET];
55822 FULL_REWRITE_TAC[INJ];
55823 TYPE_THEN `x` UNABBREV_TAC;
55824 TYPE_THEN `x' = &1` ASM_CASES_TAC;
55825 TYPE_THEN `x'` UNABBREV_TAC;
55828 FIRST_ASSUM IMATCH_MP_TAC ;
55830 FIRST_ASSUM IMATCH_MP_TAC ;
55831 UNDH 6268 THEN UNDH 3324 THEN UNDH 9329 THEN REAL_ARITH_TAC;
55832 (* Sun Jan 16 09:13:09 EST 2005 *)
55838 let ymaxQexists_lemma = prove_by_refinement(
55839 `!C. simple_closed_curve top2 C ==>
55840 (?p. C p /\ (!q. C q ==> (q 1 <=. p 1)))`,
55844 THM_INTRO_TAC[`1`;`2`] continuous_euclid1;
55845 FULL_REWRITE_TAC[GSYM top2];
55846 THM_INTRO_TAC[`coord 1`;`top2`;`C`] compact_max_real;
55849 IMATCH_MP_TAC simple_closed_curve_compact;
55851 FULL_REWRITE_TAC[simple_closed_curve];
55852 TYPE_THEN `C` UNABBREV_TAC;
55854 USEH 6041 (REWRITE_RULE[IMAGE;EQ_EMPTY]);
55855 TSPECH `f (&0)` 9716;
55856 UNDH 5422 THEN ASM_REWRITE_TAC[];
55857 TYPE_THEN `&0` EXISTS_TAC;
55860 TYPE_THEN `x` EXISTS_TAC;
55861 FULL_REWRITE_TAC[coord];
55863 (* Sun Jan 16 09:16:3282 EST 2005 *)
55868 let yminQexists_lemma = prove_by_refinement(
55869 `!C. simple_closed_curve top2 C ==>
55870 (?p. C p /\ (!q. C q ==> (p 1 <=. q 1)))`,
55874 THM_INTRO_TAC[`1`;`2`] continuous_euclid1;
55875 FULL_REWRITE_TAC[GSYM top2];
55876 THM_INTRO_TAC[`coord 1`;`top2`;`C`] compact_min_real;
55879 IMATCH_MP_TAC simple_closed_curve_compact;
55881 FULL_REWRITE_TAC[simple_closed_curve];
55882 TYPE_THEN `C` UNABBREV_TAC;
55884 USEH 6041 (REWRITE_RULE[IMAGE;EQ_EMPTY]);
55885 TSPECH `f (&0)` 9716;
55886 UNDH 5422 THEN ASM_REWRITE_TAC[];
55887 TYPE_THEN `&0` EXISTS_TAC;
55890 TYPE_THEN `x` EXISTS_TAC;
55891 FULL_REWRITE_TAC[coord];
55896 let xmaxQexists_lemma = prove_by_refinement(
55897 `!C. simple_closed_curve top2 C ==>
55898 (?p. C p /\ (!q. C q ==> (q 0 <=. p 0)))`,
55902 THM_INTRO_TAC[`0`;`2`] continuous_euclid1;
55903 FULL_REWRITE_TAC[GSYM top2];
55904 THM_INTRO_TAC[`coord 0`;`top2`;`C`] compact_max_real;
55907 IMATCH_MP_TAC simple_closed_curve_compact;
55909 FULL_REWRITE_TAC[simple_closed_curve];
55910 TYPE_THEN `C` UNABBREV_TAC;
55912 USEH 6041 (REWRITE_RULE[IMAGE;EQ_EMPTY]);
55913 TSPECH `f (&0)` 9716;
55914 UNDH 5422 THEN ASM_REWRITE_TAC[];
55915 TYPE_THEN `&0` EXISTS_TAC;
55918 TYPE_THEN `x` EXISTS_TAC;
55919 FULL_REWRITE_TAC[coord];
55924 let xminQexists_lemma = prove_by_refinement(
55925 `!C. simple_closed_curve top2 C ==>
55926 (?p. C p /\ (!q. C q ==> (p 0 <=. q 0)))`,
55930 THM_INTRO_TAC[`0`;`2`] continuous_euclid1;
55931 FULL_REWRITE_TAC[GSYM top2];
55932 THM_INTRO_TAC[`coord 0`;`top2`;`C`] compact_min_real;
55935 IMATCH_MP_TAC simple_closed_curve_compact;
55937 FULL_REWRITE_TAC[simple_closed_curve];
55938 TYPE_THEN `C` UNABBREV_TAC;
55940 USEH 6041 (REWRITE_RULE[IMAGE;EQ_EMPTY]);
55941 TSPECH `f (&0)` 9716;
55942 UNDH 5422 THEN ASM_REWRITE_TAC[];
55943 TYPE_THEN `&0` EXISTS_TAC;
55946 TYPE_THEN `x` EXISTS_TAC;
55947 FULL_REWRITE_TAC[coord];
55953 let ymaxQ = jordan_def `ymaxQ C = supm { y | ?x. (C (point(x,y))) }`;;
55954 let yminQ = jordan_def `yminQ C = inf { y | ?x. (C (point(x,y))) }`;;
55955 let xmaxQ = jordan_def `xmaxQ C = supm { x | ?y. (C (point(x,y))) }`;;
55956 let xminQ = jordan_def `xminQ C = inf { x | ?y. (C (point(x,y))) }`;;
55958 let inf_unique = prove_by_refinement(
55959 `!X s. X s /\ (!t. X t ==> (s <= t)) ==> (s = inf X)`,
55963 THM_INTRO_TAC[`X`] inf_LB;
55964 REWRITE_TAC[EMPTY_EXISTS];
55968 TYPE_THEN `s` EXISTS_TAC;
55969 FIRST_ASSUM IMATCH_MP_TAC ;
55971 TYPE_THEN `(s <= inf X) /\ (inf X <= s)` BACK_TAC;
55972 UNDH 9491 THEN UNDH 1818 THEN REAL_ARITH_TAC;
55973 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
55974 FIRST_ASSUM IMATCH_MP_TAC ;
55980 let supm_unique = prove_by_refinement(
55981 `!X s. X s /\ (!t. X t ==> (t <= s)) ==> (s = supm X)`,
55985 THM_INTRO_TAC[`X`] supm_UB;
55986 REWRITE_TAC[EMPTY_EXISTS];
55990 TYPE_THEN `s` EXISTS_TAC;
55991 FIRST_ASSUM IMATCH_MP_TAC ;
55993 TYPE_THEN `(s <= supm X) /\ (supm X <= s)` BACK_TAC;
55994 UNDH 4025 THEN UNDH 5913 THEN REAL_ARITH_TAC;
55995 CONJ_TAC THEN (FIRST_ASSUM IMATCH_MP_TAC );
55997 FIRST_ASSUM IMATCH_MP_TAC ;
55999 (* Sun Jan 16 09:42:06 EST 2005 *)
56004 let euclid2_point = prove_by_refinement(
56005 `!p. euclid 2 p ==> (point (p 0, p 1) = p)`,
56009 USEH 7802 (MATCH_MP point_onto);
56010 TYPE_THEN `p` UNABBREV_TAC;
56011 REWRITE_TAC[point_inj];
56012 REWRITE_TAC[coord01];
56016 let ymaxQ_exists = prove_by_refinement(
56017 `!C. simple_closed_curve top2 C ==> (?p. C p /\ (p 1 = ymaxQ C))`,
56021 THM_INTRO_TAC[`C`] ymaxQexists_lemma;
56023 TYPE_THEN `p` EXISTS_TAC;
56025 REWRITE_TAC[ymaxQ];
56026 IMATCH_MP_TAC supm_unique;
56028 TYPE_THEN `p 0` EXISTS_TAC;
56029 TYPE_THEN `euclid 2 p` SUBAGOAL_TAC;
56030 IMATCH_MP_TAC subset_imp;
56031 TYPE_THEN `C` EXISTS_TAC;
56032 ASM_SIMP_TAC[simple_closed_curve_euclid];
56033 ASM_SIMP_TAC[euclid2_point];
56034 TYPE_THEN `t = point(x,t) 1` SUBAGOAL_TAC;
56035 REWRITE_TAC[coord01];
56036 UNDH 9068 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
56037 FIRST_ASSUM IMATCH_MP_TAC ;
56038 TYPE_THEN `A = point(x,t)` ABBREV_TAC ;
56039 REWRITE_TAC[ETA_AX];
56044 let yminQ_exists = prove_by_refinement(
56045 `!C. simple_closed_curve top2 C ==> (?p. C p /\ (p 1 = yminQ C))`,
56049 THM_INTRO_TAC[`C`] yminQexists_lemma;
56051 TYPE_THEN `p` EXISTS_TAC;
56053 REWRITE_TAC[yminQ];
56054 IMATCH_MP_TAC inf_unique;
56056 TYPE_THEN `p 0` EXISTS_TAC;
56057 TYPE_THEN `euclid 2 p` SUBAGOAL_TAC;
56058 IMATCH_MP_TAC subset_imp;
56059 TYPE_THEN `C` EXISTS_TAC;
56060 ASM_SIMP_TAC[simple_closed_curve_euclid];
56061 ASM_SIMP_TAC[euclid2_point];
56062 TYPE_THEN `t = point(x,t) 1` SUBAGOAL_TAC;
56063 REWRITE_TAC[coord01];
56064 UNDH 9068 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
56065 FIRST_ASSUM IMATCH_MP_TAC ;
56066 TYPE_THEN `A = point(x,t)` ABBREV_TAC ;
56067 REWRITE_TAC[ETA_AX];
56072 let xmaxQ_exists = prove_by_refinement(
56073 `!C. simple_closed_curve top2 C ==> (?p. C p /\ (p 0 = xmaxQ C))`,
56077 THM_INTRO_TAC[`C`] xmaxQexists_lemma;
56079 TYPE_THEN `p` EXISTS_TAC;
56081 REWRITE_TAC[xmaxQ];
56082 IMATCH_MP_TAC supm_unique;
56084 TYPE_THEN `p 1` EXISTS_TAC;
56085 TYPE_THEN `euclid 2 p` SUBAGOAL_TAC;
56086 IMATCH_MP_TAC subset_imp;
56087 TYPE_THEN `C` EXISTS_TAC;
56088 ASM_SIMP_TAC[simple_closed_curve_euclid];
56089 ASM_SIMP_TAC[euclid2_point];
56090 TYPE_THEN `t = point(t,y) 0` SUBAGOAL_TAC;
56091 REWRITE_TAC[coord01];
56092 UNDH 5575 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
56093 FIRST_ASSUM IMATCH_MP_TAC ;
56094 TYPE_THEN `A = point(t,y)` ABBREV_TAC ;
56095 REWRITE_TAC[ETA_AX];
56100 let xminQ_exists = prove_by_refinement(
56101 `!C. simple_closed_curve top2 C ==> (?p. C p /\ (p 0 = xminQ C))`,
56105 THM_INTRO_TAC[`C`] xminQexists_lemma;
56107 TYPE_THEN `p` EXISTS_TAC;
56109 REWRITE_TAC[xminQ];
56110 IMATCH_MP_TAC inf_unique;
56112 TYPE_THEN `p 1` EXISTS_TAC;
56113 TYPE_THEN `euclid 2 p` SUBAGOAL_TAC;
56114 IMATCH_MP_TAC subset_imp;
56115 TYPE_THEN `C` EXISTS_TAC;
56116 ASM_SIMP_TAC[simple_closed_curve_euclid];
56117 ASM_SIMP_TAC[euclid2_point];
56118 TYPE_THEN `t = point(t,y) 0` SUBAGOAL_TAC;
56119 REWRITE_TAC[coord01];
56120 UNDH 5575 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC[t]);
56121 FIRST_ASSUM IMATCH_MP_TAC ;
56122 TYPE_THEN `A = point(t,y)` ABBREV_TAC ;
56123 REWRITE_TAC[ETA_AX];
56128 let ymaxQ_max = prove_by_refinement(
56129 `!C p. simple_closed_curve top2 C /\ C p ==> (p 1 <= ymaxQ C)`,
56133 REWRITE_TAC[ymaxQ];
56134 THM_INTRO_TAC[`C`] ymaxQexists_lemma;
56136 TYPE_THEN `!p. C p ==> euclid 2 p` SUBAGOAL_TAC;
56137 IMATCH_MP_TAC subset_imp;
56138 TYPE_THEN `C` EXISTS_TAC;
56140 IMATCH_MP_TAC simple_closed_curve_euclid;
56143 THM_INTRO_TAC[`{y | ?x. C (point(x,y))}` ] supm_UB;
56144 REWRITE_TAC[EMPTY_EXISTS];
56147 TYPE_THEN `p 1` EXISTS_TAC;
56148 TYPE_THEN `p 0` EXISTS_TAC;
56149 ASM_SIMP_TAC[euclid2_point];
56150 TYPE_THEN `p' 1` EXISTS_TAC;
56151 TSPECH `point(x',x)` 1647;
56152 FULL_REWRITE_TAC[coord01];
56155 FIRST_ASSUM IMATCH_MP_TAC ;
56156 TYPE_THEN `p 0` EXISTS_TAC;
56157 ASM_SIMP_TAC[euclid2_point];
56161 let yminQ_min = prove_by_refinement(
56162 `!C p. simple_closed_curve top2 C /\ C p ==> (yminQ C <= p 1)`,
56166 REWRITE_TAC[yminQ];
56167 THM_INTRO_TAC[`C`] yminQexists_lemma;
56169 TYPE_THEN `!p. C p ==> euclid 2 p` SUBAGOAL_TAC;
56170 IMATCH_MP_TAC subset_imp;
56171 TYPE_THEN `C` EXISTS_TAC;
56173 IMATCH_MP_TAC simple_closed_curve_euclid;
56176 THM_INTRO_TAC[`{y | ?x. C (point(x,y))}` ] inf_LB;
56177 REWRITE_TAC[EMPTY_EXISTS];
56180 TYPE_THEN `p 1` EXISTS_TAC;
56181 TYPE_THEN `p 0` EXISTS_TAC;
56182 ASM_SIMP_TAC[euclid2_point];
56183 TYPE_THEN `p' 1` EXISTS_TAC;
56184 TSPECH `point(x',x)` 2887;
56185 FULL_REWRITE_TAC[coord01];
56188 FIRST_ASSUM IMATCH_MP_TAC ;
56189 TYPE_THEN `p 0` EXISTS_TAC;
56190 ASM_SIMP_TAC[euclid2_point];
56194 let xmaxQ_max = prove_by_refinement(
56195 `!C p. simple_closed_curve top2 C /\ C p ==> (p 0 <= xmaxQ C)`,
56199 REWRITE_TAC[xmaxQ];
56200 THM_INTRO_TAC[`C`] xmaxQexists_lemma;
56202 TYPE_THEN `!p. C p ==> euclid 2 p` SUBAGOAL_TAC;
56203 IMATCH_MP_TAC subset_imp;
56204 TYPE_THEN `C` EXISTS_TAC;
56206 IMATCH_MP_TAC simple_closed_curve_euclid;
56209 THM_INTRO_TAC[`{x | ?y. C (point(x,y))}` ] supm_UB;
56210 REWRITE_TAC[EMPTY_EXISTS];
56213 TYPE_THEN `p 0` EXISTS_TAC;
56214 TYPE_THEN `p 1` EXISTS_TAC;
56215 ASM_SIMP_TAC[euclid2_point];
56216 TYPE_THEN `p' 0` EXISTS_TAC;
56217 TSPECH `point(x,y)` 3013;
56218 FULL_REWRITE_TAC[coord01];
56221 FIRST_ASSUM IMATCH_MP_TAC ;
56222 TYPE_THEN `p 1` EXISTS_TAC;
56223 ASM_SIMP_TAC[euclid2_point];
56227 let xminQ_min = prove_by_refinement(
56228 `!C p. simple_closed_curve top2 C /\ C p ==> (xminQ C <= p 0)`,
56232 REWRITE_TAC[xminQ];
56233 THM_INTRO_TAC[`C`] xminQexists_lemma;
56235 TYPE_THEN `!p. C p ==> euclid 2 p` SUBAGOAL_TAC;
56236 IMATCH_MP_TAC subset_imp;
56237 TYPE_THEN `C` EXISTS_TAC;
56239 IMATCH_MP_TAC simple_closed_curve_euclid;
56242 THM_INTRO_TAC[`{x | ?y. C (point(x,y))}` ] inf_LB;
56243 REWRITE_TAC[EMPTY_EXISTS];
56246 TYPE_THEN `p 0` EXISTS_TAC;
56247 TYPE_THEN `p 1` EXISTS_TAC;
56248 ASM_SIMP_TAC[euclid2_point];
56249 TYPE_THEN `p' 0` EXISTS_TAC;
56250 TSPECH `point(x,y)` 4062;
56251 FULL_REWRITE_TAC[coord01];
56254 FIRST_ASSUM IMATCH_MP_TAC ;
56255 TYPE_THEN `p 1` EXISTS_TAC;
56256 ASM_SIMP_TAC[euclid2_point];
56257 (* Sun Jan 16 13:15:02 EST 2005 *)
56261 extend_simp_rewrites[prove_by_refinement(
56270 let real012 = prove_by_refinement(
56271 `&0 < &1 /\ &0 <= &1 /\ &0 <= &1 / &2 /\ &0 < &1 / &2 /\ &1/ &2 < &1 /\ &1 / &2 <= &1 `,
56279 IMATCH_MP_TAC REAL_LE_RDIV;
56282 IMATCH_MP_TAC REAL_LT_DIV;
56285 IMATCH_MP_TAC REAL_LT_1;
56287 IMATCH_MP_TAC REAL_LE_LDIV;
56292 extend_simp_rewrites[real012];;
56294 let simple_closed_curve_nonempty = prove_by_refinement(
56295 `!C. simple_closed_curve top2 C ==> (?p. C p)`,
56298 REWRITE_TAC[simple_closed_curve];
56300 TYPE_THEN `f (&0)` EXISTS_TAC;
56301 TYPE_THEN `C` UNABBREV_TAC;
56302 IMATCH_MP_TAC image_imp;
56307 let simple_closed_curve_2pt = prove_by_refinement(
56308 `!C p. simple_closed_curve top2 C /\ C p ==> (?q. C q /\ ~(q = p))`,
56311 REWRITE_TAC[simple_closed_curve];
56313 TYPE_THEN `~(f (&0) = f( &1 / &2))` SUBAGOAL_TAC;
56314 FULL_REWRITE_TAC[INJ];
56315 TYPE_THEN `&0 = &1 / &2` SUBAGOAL_TAC;
56316 FIRST_ASSUM IMATCH_MP_TAC ;
56320 TYPE_THEN `&0 < &2` SUBAGOAL_TAC;
56322 TYPE_THEN `&0 < &1 / &2` SUBAGOAL_TAC;
56324 UNDH 4792 THEN UNDH 3735 THEN REAL_ARITH_TAC;
56326 TYPE_THEN `C (f (&1 / &2))` SUBAGOAL_TAC;
56327 TYPE_THEN `C` UNABBREV_TAC;
56328 IMATCH_MP_TAC image_imp;
56331 TYPE_THEN `p = f (&0)` ASM_CASES_TAC;
56332 TYPE_THEN `p` UNABBREV_TAC;
56333 TYPE_THEN `f (&1 / &2)` EXISTS_TAC;
56335 TYPE_THEN `f (&0)` EXISTS_TAC;
56337 IMATCH_MP_TAC image_imp;
56342 let xmin_le_xmax = prove_by_refinement(
56343 `!C. simple_closed_curve top2 C ==> (xminQ C <= xmaxQ C)`,
56347 THM_INTRO_TAC[`C`] xminQ_exists;
56349 THM_INTRO_TAC[`C`;`p`] xmaxQ_max;
56356 let ymin_le_ymax = prove_by_refinement(
56357 `!C. simple_closed_curve top2 C ==> (yminQ C <= ymaxQ C)`,
56361 THM_INTRO_TAC[`C`] yminQ_exists;
56363 THM_INTRO_TAC[`C`;`p`] ymaxQ_max;
56370 let simple_closed_curve_nsubset_arc = prove_by_refinement(
56371 `!C E. simple_closed_curve top2 C /\ simple_arc top2 E ==>
56376 THM_INTRO_TAC[`C`] simple_closed_curve_nonempty;
56378 THM_INTRO_TAC[`C`;`p`] simple_closed_curve_2pt;
56380 THM_INTRO_TAC[`C`;`p`;`q`] simple_closed_cut;
56382 TYPE_THEN `C' SUBSET E /\ C'' SUBSET E` SUBAGOAL_TAC;
56383 TYPE_THEN `C` UNABBREV_TAC;
56384 UNDH 6378 THEN REWRITE_TAC[SUBSET;UNION] THEN MESON_TAC[];
56385 THM_INTRO_TAC[`E`;`p`;`q`;`C'`] cut_arc_unique;
56387 THM_INTRO_TAC[`E`;`p`;`q`;`C''`] cut_arc_unique;
56389 TYPE_THEN `cut_arc E p q` UNABBREV_TAC;
56390 TYPE_THEN `C''` UNABBREV_TAC;
56391 FULL_REWRITE_TAC[INTER_IDEMPOT];
56392 TYPE_THEN `C'` UNABBREV_TAC;
56393 THM_INTRO_TAC[`{p,q}`] simple_arc_infinite;
56394 IMATCH_MP_TAC simple_arc_end_simple;
56397 FULL_REWRITE_TAC[INFINITE];
56398 FULL_REWRITE_TAC[FINITE_INSERT;FINITE_RULES];
56400 (* Sun Jan 16 15:22:30 EST 2005 *)
56404 let xmin_lt_xmax = prove_by_refinement(
56405 `!C. simple_closed_curve top2 C ==> (xminQ C < xmaxQ C)`,
56409 REWRITE_TAC[REAL_ARITH `x < y <=> (x <= y) /\ ~(x = y)`];
56410 ASM_SIMP_TAC [xmin_le_xmax];
56411 THM_INTRO_TAC[`C`] ymin_le_ymax;
56413 TYPE_THEN `yminQ C < ymaxQ C` SUBAGOAL_TAC;
56414 REWRITE_TAC[REAL_ARITH `x < y <=> (x <= y) /\ ~(x = y)`];
56415 ASM_SIMP_TAC[ymin_le_ymax];
56416 TYPE_THEN `!p. C p ==> (p = point(xminQ C,yminQ C))` SUBAGOAL_TAC;
56417 TYPE_THEN `euclid 2 p` SUBAGOAL_TAC;
56418 IMATCH_MP_TAC subset_imp;
56419 TYPE_THEN `C` EXISTS_TAC;
56421 IMATCH_MP_TAC simple_closed_curve_euclid;
56423 USEH 7802 (MATCH_MP point_onto);
56424 (*** Modified by JRH for proper right associativity of "="
56425 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT;REAL_ARITH `x = y = (x <= y) /\ (y <= x)`];
56427 ASM_REWRITE_TAC[point_inj;PAIR_SPLIT;GSYM REAL_LE_ANTISYM];
56428 TYPE_THEN `(FST p' = p 0) /\ (SND p' = p 1)` SUBAGOAL_TAC;
56429 ASM_REWRITE_TAC[coord01];
56434 IMATCH_MP_TAC xmaxQ_max;
56438 IMATCH_MP_TAC xminQ_min;
56442 IMATCH_MP_TAC ymaxQ_max;
56444 TYPE_THEN `ymaxQ C` UNABBREV_TAC;
56445 IMATCH_MP_TAC yminQ_min;
56448 THM_INTRO_TAC[`C`] simple_closed_curve_nonempty;
56452 TYPE_THEN `point(xminQ C,yminQ C)` UNABBREV_TAC;
56453 THM_INTRO_TAC[`C`;`p`] simple_closed_curve_2pt;
56457 TYPE_THEN `!p. C p ==> (euclid 2 p)` SUBAGOAL_TAC;
56458 IMATCH_MP_TAC subset_imp;
56459 TYPE_THEN `C` EXISTS_TAC;
56461 IMATCH_MP_TAC simple_closed_curve_euclid;
56464 TYPE_THEN `!p. C p ==> (p 0 = xmaxQ C)` SUBAGOAL_TAC;
56465 REWRITE_TAC[REAL_ARITH `(x = y) <=> (x <= y) /\ (y <= x)`];
56467 IMATCH_MP_TAC xmaxQ_max;
56469 TYPE_THEN `xmaxQ C` UNABBREV_TAC;
56470 IMATCH_MP_TAC xminQ_min;
56473 TYPE_THEN `!p. C p ==> (yminQ C <= p 1 /\ p 1 <= ymaxQ C)` SUBAGOAL_TAC;
56475 IMATCH_MP_TAC yminQ_min;
56477 IMATCH_MP_TAC ymaxQ_max;
56480 TYPE_THEN `C (point(xminQ C,yminQ C))` SUBAGOAL_TAC;
56481 THM_INTRO_TAC[`C`] yminQ_exists;
56483 TYPE_THEN `p = point(xminQ C, yminQ C)` BACK_TAC ;
56484 TYPE_THEN `p` UNABBREV_TAC;
56487 USEH 7802 (MATCH_MP point_onto);
56488 TYPE_THEN `p` UNABBREV_TAC;
56489 REWRITE_TAC[point_inj];
56490 REWRITE_TAC[PAIR_SPLIT];
56491 TYPE_THEN `yminQ C` UNABBREV_TAC;
56492 REWRITE_TAC[coord01];
56493 TSPECH `point p'` 111;
56494 TYPE_THEN `xmaxQ C` UNABBREV_TAC;
56495 TYPE_THEN `xminQ C` UNABBREV_TAC;
56496 REWRITE_TAC[coord01];
56498 TYPE_THEN `C (point(xminQ C,ymaxQ C))` SUBAGOAL_TAC;
56499 THM_INTRO_TAC[`C`] ymaxQ_exists;
56501 TYPE_THEN `p = point(xminQ C, ymaxQ C)` BACK_TAC ;
56502 TYPE_THEN `p` UNABBREV_TAC;
56505 USEH 7802 (MATCH_MP point_onto);
56506 TYPE_THEN `p` UNABBREV_TAC;
56507 REWRITE_TAC[point_inj];
56508 REWRITE_TAC[PAIR_SPLIT];
56509 TYPE_THEN `ymaxQ C` UNABBREV_TAC;
56510 REWRITE_TAC[coord01];
56511 TSPECH `point p'` 111;
56512 TYPE_THEN `xmaxQ C` UNABBREV_TAC;
56513 TYPE_THEN `xminQ C` UNABBREV_TAC;
56514 REWRITE_TAC[coord01];
56516 TYPE_THEN `C SUBSET mk_segment (point (xminQ C,yminQ C)) (point(xminQ C,ymaxQ C))` SUBAGOAL_TAC;
56517 ASM_SIMP_TAC [SUBSET;mk_segment_v];
56518 TYPE_THEN `x 1` EXISTS_TAC;
56519 TYPE_THEN `yminQ C <= x 1 /\ x 1 <= ymaxQ C ` SUBAGOAL_TAC;
56520 FIRST_ASSUM IMATCH_MP_TAC ;
56524 USEH 1837 (MATCH_MP point_onto);
56525 TYPE_THEN `x` UNABBREV_TAC;
56526 REWRITE_TAC[point_inj];
56527 REWRITE_TAC[PAIR_SPLIT;coord01];
56528 TYPE_THEN `FST p = point p 0` SUBAGOAL_TAC;
56529 REWRITE_TAC[coord01];
56531 TYPE_THEN `q = point p` ABBREV_TAC ;
56532 FIRST_ASSUM IMATCH_MP_TAC ;
56535 THM_INTRO_TAC[`C`;`mk_segment (point (xminQ C,yminQ C)) (point (xminQ C,ymaxQ C))`] simple_closed_curve_nsubset_arc;
56537 IMATCH_MP_TAC simple_arc_end_simple;
56538 TYPE_THEN `point(xmaxQ C,yminQ C)` EXISTS_TAC;
56539 TYPE_THEN `point(xmaxQ C,ymaxQ C)` EXISTS_TAC;
56540 IMATCH_MP_TAC mk_segment_simple_arc_end;
56541 REWRITE_TAC[PAIR_SPLIT;point_inj ;euclid_point ];
56542 UNDH 1234 THEN UNDH 5378 THEN REAL_ARITH_TAC;
56544 (* Sun Jan 16 15:26:36 EST 2005 *)
56549 let ymin_lt_ymax = prove_by_refinement(
56550 `!C. simple_closed_curve top2 C ==> (yminQ C < ymaxQ C)`,
56554 REWRITE_TAC[REAL_ARITH `x < y <=> (x <= y) /\ ~(x = y)`];
56555 ASM_SIMP_TAC [ymin_le_ymax];
56556 THM_INTRO_TAC[`C`] xmin_lt_xmax;
56559 TYPE_THEN `!p. C p ==> (euclid 2 p)` SUBAGOAL_TAC;
56560 IMATCH_MP_TAC subset_imp;
56561 TYPE_THEN `C` EXISTS_TAC;
56563 IMATCH_MP_TAC simple_closed_curve_euclid;
56566 TYPE_THEN `!p. C p ==> (p 1 = ymaxQ C)` SUBAGOAL_TAC;
56567 REWRITE_TAC[REAL_ARITH `(x = y) <=> (x <= y) /\ (y <= x)`];
56569 IMATCH_MP_TAC ymaxQ_max;
56571 TYPE_THEN `ymaxQ C` UNABBREV_TAC;
56572 IMATCH_MP_TAC yminQ_min;
56575 TYPE_THEN `!p. C p ==> (xminQ C <= p 0 /\ p 0 <= xmaxQ C)` SUBAGOAL_TAC;
56577 IMATCH_MP_TAC xminQ_min;
56579 IMATCH_MP_TAC xmaxQ_max;
56582 TYPE_THEN `C (point(xminQ C,yminQ C))` SUBAGOAL_TAC;
56583 THM_INTRO_TAC[`C`] xminQ_exists;
56585 TYPE_THEN `p = point(xminQ C, yminQ C)` BACK_TAC ;
56586 TYPE_THEN `p` UNABBREV_TAC;
56589 USEH 7802 (MATCH_MP point_onto);
56590 TYPE_THEN `p` UNABBREV_TAC;
56591 REWRITE_TAC[point_inj];
56592 REWRITE_TAC[PAIR_SPLIT];
56593 TYPE_THEN `xminQ C` UNABBREV_TAC;
56594 REWRITE_TAC[coord01];
56595 TSPECH `point p'` 4874;
56596 TYPE_THEN `ymaxQ C` UNABBREV_TAC;
56597 TYPE_THEN `yminQ C` UNABBREV_TAC;
56598 REWRITE_TAC[coord01];
56600 TYPE_THEN `C (point(xmaxQ C,yminQ C))` SUBAGOAL_TAC;
56601 THM_INTRO_TAC[`C`] xmaxQ_exists;
56603 TYPE_THEN `p = point(xmaxQ C, yminQ C)` BACK_TAC ;
56604 TYPE_THEN `p` UNABBREV_TAC;
56607 USEH 7802 (MATCH_MP point_onto);
56608 TYPE_THEN `p` UNABBREV_TAC;
56609 REWRITE_TAC[point_inj];
56610 REWRITE_TAC[PAIR_SPLIT];
56611 TYPE_THEN `xmaxQ C` UNABBREV_TAC;
56612 REWRITE_TAC[coord01];
56613 TSPECH `point p'` 4874;
56614 TYPE_THEN `ymaxQ C` UNABBREV_TAC;
56615 TYPE_THEN `yminQ C` UNABBREV_TAC;
56616 REWRITE_TAC[coord01];
56618 TYPE_THEN `C SUBSET mk_segment (point (xminQ C,yminQ C)) (point(xmaxQ C,yminQ C))` SUBAGOAL_TAC;
56619 TYPE_THEN `xminQ C <= xmaxQ C` SUBAGOAL_TAC;
56620 UNDH 5679 THEN REAL_ARITH_TAC;
56621 ASM_SIMP_TAC [SUBSET;mk_segment_h];
56622 TYPE_THEN `x 0` EXISTS_TAC;
56623 TYPE_THEN `xminQ C <= x 0 /\ x 0 <= xmaxQ C ` SUBAGOAL_TAC;
56624 FIRST_ASSUM IMATCH_MP_TAC ;
56628 USEH 1837 (MATCH_MP point_onto);
56629 TYPE_THEN `x` UNABBREV_TAC;
56630 REWRITE_TAC[point_inj];
56631 REWRITE_TAC[PAIR_SPLIT;coord01];
56632 TYPE_THEN `SND p = point p 1` SUBAGOAL_TAC;
56633 REWRITE_TAC[coord01];
56635 TYPE_THEN `q = point p` ABBREV_TAC ;
56636 FIRST_ASSUM IMATCH_MP_TAC ;
56639 THM_INTRO_TAC[`C`;`mk_segment (point (xminQ C,yminQ C)) (point (xmaxQ C,yminQ C))`] simple_closed_curve_nsubset_arc;
56641 IMATCH_MP_TAC simple_arc_end_simple;
56642 TYPE_THEN `point(xminQ C,ymaxQ C)` EXISTS_TAC;
56643 TYPE_THEN `point(xmaxQ C,ymaxQ C)` EXISTS_TAC;
56644 IMATCH_MP_TAC mk_segment_simple_arc_end;
56645 REWRITE_TAC[PAIR_SPLIT;point_inj ;euclid_point ];
56646 UNDH 5418 THEN UNDH 5679 THEN REAL_ARITH_TAC;
56648 (* Sun Jan 16 15:39:56 EST 2005 *)
56653 let simple_closed_curve_closed = prove_by_refinement(
56654 `!C. simple_closed_curve top2 C ==> (closed_ top2 C)`,
56658 THM_INTRO_TAC[`C`] simple_closed_curve_nonempty;
56660 THM_INTRO_TAC[`C`;`p`] simple_closed_curve_2pt;
56662 THM_INTRO_TAC[`C`;`p`;`q`] simple_closed_cut;
56664 TYPE_THEN `C` UNABBREV_TAC;
56665 IMATCH_MP_TAC closed_union;
56666 REWRITE_TAC[top2_top];
56667 CONJ_TAC THEN IMATCH_MP_TAC simple_arc_end_closed THEN UNIFY_EXISTS_TAC THEN ASM_REWRITE_TAC[];
56668 (* Sun Jan 16 16:43:23 EST 2005 *)
56673 let simple_closed_curve_mk_C = prove_by_refinement(
56674 `!Q. simple_closed_curve top2 Q ==>
56675 ?C v1 v2. simple_arc_end C v1 v2 /\
56676 (C INTER Q = {v1,v2}) /\
56677 (v2 1 = yminQ Q) /\
56678 (v1 1 = ymaxQ Q) /\
56680 (x 1 = yminQ Q) \/ (x 1 = ymaxQ Q) \/ (xmaxQ Q < x 0))`,
56684 TYPE_THEN `Ca = mk_segment (point(xminQ Q,yminQ Q)) (point(xmaxQ Q + &1,yminQ Q))` ABBREV_TAC ;
56686 TYPE_THEN `xminQ Q <= xmaxQ Q + &1` SUBAGOAL_TAC;
56687 IMATCH_MP_TAC REAL_LE_TRANS;
56688 TYPE_THEN `xmaxQ Q` EXISTS_TAC;
56690 IMATCH_MP_TAC xmin_le_xmax;
56694 THM_INTRO_TAC[`Ca`;`Ca INTER Q`;`{(point(xmaxQ Q + &1,yminQ Q))}`] simple_arc_end_restriction;
56696 TYPE_THEN `Ca` UNABBREV_TAC;
56697 IMATCH_MP_TAC simple_arc_end_simple;
56698 THM_INTRO_TAC[`point(xminQ Q,yminQ Q)`;`point(xmaxQ Q + &1,yminQ Q)`] mk_segment_simple_arc_end;
56699 REWRITE_TAC[euclid_point;point_inj;PAIR_SPLIT];
56700 THM_INTRO_TAC[`Q`] xmin_lt_xmax;
56702 UNDH 2298 THEN UNDH 9105 THEN REAL_ARITH_TAC;
56706 IMATCH_MP_TAC closed_inter2;
56707 REWRITE_TAC[top2_top];
56709 IMATCH_MP_TAC simple_arc_end_closed;
56710 ASM_MESON_TAC[simple_arc_choose_end];
56711 IMATCH_MP_TAC simple_closed_curve_closed;
56714 REWRITE_TAC[EMPTY_EXISTS;INTER;];
56715 REWRITE_TAC[INR IN_SING;EQ_EMPTY];
56717 IMATCH_MP_TAC closed_point;
56718 REWRITE_TAC[euclid_point];
56721 TYPE_THEN `x` UNABBREV_TAC;
56722 THM_INTRO_TAC[`Q`] xmaxQ_max;
56723 TSPECH `(point (xmaxQ Q + &1, yminQ Q))` 9371;
56725 FULL_REWRITE_TAC[coord01];
56726 UNDH 3234 THEN REAL_ARITH_TAC;
56729 THM_INTRO_TAC[`Q`] yminQ_exists;
56731 TYPE_THEN `p` EXISTS_TAC;
56733 TYPE_THEN `Ca` UNABBREV_TAC;
56734 ASM_SIMP_TAC[mk_segment_h];
56735 TYPE_THEN `p 0` EXISTS_TAC;
56736 TYPE_THEN `yminQ Q` UNABBREV_TAC;
56739 IMATCH_MP_TAC xminQ_min;
56742 IMATCH_MP_TAC REAL_LE_TRANS;
56743 TYPE_THEN `xmaxQ Q` EXISTS_TAC;
56745 IMATCH_MP_TAC xmaxQ_max;
56748 IMATCH_MP_TAC (GSYM euclid2_point);
56749 IMATCH_MP_TAC subset_imp;
56750 TYPE_THEN `Q` EXISTS_TAC;
56752 IMATCH_MP_TAC simple_closed_curve_euclid;
56755 CONV_TAC (dropq_conv "u");
56756 TYPE_THEN `Ca` UNABBREV_TAC;
56757 ASM_SIMP_TAC[mk_segment_h];
56758 REWRITE_TAC[point_inj; PAIR_SPLIT;];
56759 CONV_TAC (dropq_conv "t");
56763 TYPE_THEN `Cb = mk_segment(point(xminQ Q,ymaxQ Q)) (point(xmaxQ Q + &1,ymaxQ Q))` ABBREV_TAC ;
56764 THM_INTRO_TAC[`Cb`;`Cb INTER Q`;`{(point(xmaxQ Q + &1,ymaxQ Q))}`] simple_arc_end_restriction;
56766 TYPE_THEN `Cb` UNABBREV_TAC;
56767 IMATCH_MP_TAC simple_arc_end_simple;
56768 THM_INTRO_TAC[`point(xminQ Q,ymaxQ Q)`;`point(xmaxQ Q + &1,ymaxQ Q)`] mk_segment_simple_arc_end;
56769 REWRITE_TAC[euclid_point;point_inj;PAIR_SPLIT];
56770 THM_INTRO_TAC[`Q`] xmin_lt_xmax;
56772 UNDH 2298 THEN UNDH 9105 THEN REAL_ARITH_TAC;
56776 IMATCH_MP_TAC closed_inter2;
56777 REWRITE_TAC[top2_top];
56779 IMATCH_MP_TAC simple_arc_end_closed;
56780 ASM_MESON_TAC[simple_arc_choose_end];
56781 IMATCH_MP_TAC simple_closed_curve_closed;
56784 REWRITE_TAC[EMPTY_EXISTS;INTER;];
56785 REWRITE_TAC[INR IN_SING;EQ_EMPTY];
56787 IMATCH_MP_TAC closed_point;
56788 REWRITE_TAC[euclid_point];
56791 TYPE_THEN `x` UNABBREV_TAC;
56792 THM_INTRO_TAC[`Q`] xmaxQ_max;
56793 TSPECH `(point (xmaxQ Q + &1, ymaxQ Q))` 9371;
56795 FULL_REWRITE_TAC[coord01];
56796 UNDH 3234 THEN REAL_ARITH_TAC;
56799 THM_INTRO_TAC[`Q`] ymaxQ_exists;
56801 TYPE_THEN `p` EXISTS_TAC;
56803 TYPE_THEN `Cb` UNABBREV_TAC;
56804 ASM_SIMP_TAC[mk_segment_h];
56805 TYPE_THEN `p 0` EXISTS_TAC;
56806 TYPE_THEN `ymaxQ Q` UNABBREV_TAC;
56809 IMATCH_MP_TAC xminQ_min;
56812 IMATCH_MP_TAC REAL_LE_TRANS;
56813 TYPE_THEN `xmaxQ Q` EXISTS_TAC;
56815 IMATCH_MP_TAC xmaxQ_max;
56818 IMATCH_MP_TAC (GSYM euclid2_point);
56819 IMATCH_MP_TAC subset_imp;
56820 TYPE_THEN `Q` EXISTS_TAC;
56822 IMATCH_MP_TAC simple_closed_curve_euclid;
56825 CONV_TAC (dropq_conv "u");
56826 TYPE_THEN `Cb` UNABBREV_TAC;
56827 ASM_SIMP_TAC[mk_segment_h];
56828 REWRITE_TAC[point_inj; PAIR_SPLIT;];
56829 CONV_TAC (dropq_conv "t");
56833 TYPE_THEN `Cu = mk_segment (point(xmaxQ Q + &1,yminQ Q)) (point(xmaxQ Q + &1, ymaxQ Q))` ABBREV_TAC ;
56834 TYPE_THEN `simple_arc_end Cu (point(xmaxQ Q + &1,yminQ Q)) (point(xmaxQ Q + &1, ymaxQ Q))` SUBAGOAL_TAC;
56835 TYPE_THEN `Cu` UNABBREV_TAC;
56836 IMATCH_MP_TAC mk_segment_simple_arc_end;
56837 REWRITE_TAC[euclid_point];
56838 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56839 THM_INTRO_TAC[`Q`] ymin_lt_ymax;
56841 UNDH 6486 THEN UNDH 6716 THEN REAL_ARITH_TAC;
56843 TYPE_THEN `yminQ Q <= ymaxQ Q` SUBAGOAL_TAC;
56844 IMATCH_MP_TAC ymin_le_ymax;
56847 TYPE_THEN `v' = point (xmaxQ Q + &1,yminQ Q)` SUBAGOAL_TAC;
56848 USEH 1212 (REWRITE_RULE[INTER;INR IN_SING;eq_sing]);
56850 TYPE_THEN `v'` UNABBREV_TAC;
56852 TYPE_THEN `v''' = point (xmaxQ Q + &1,ymaxQ Q)` SUBAGOAL_TAC;
56853 USEH 7634 (REWRITE_RULE[INTER;INR IN_SING;eq_sing]);
56855 TYPE_THEN `v'''` UNABBREV_TAC;
56857 THM_INTRO_TAC[`C'`;`Cu`;`v`;`point(xmaxQ Q + &1,yminQ Q)`;`point(xmaxQ Q + &1,ymaxQ Q)`] simple_arc_end_trans;
56859 REWRITE_TAC[eq_sing;INR IN_SING;INTER;];
56862 IMATCH_MP_TAC simple_arc_end_end2;
56865 TYPE_THEN `Cu` UNABBREV_TAC;
56866 REWRITE_TAC[mk_segment_end];
56867 TYPE_THEN `euclid 2 u` SUBAGOAL_TAC;
56868 IMATCH_MP_TAC subset_imp;
56869 TYPE_THEN `C'` EXISTS_TAC;
56871 IMATCH_MP_TAC simple_arc_euclid;
56872 IMATCH_MP_TAC simple_arc_end_simple;
56874 USEH 2838 (MATCH_MP point_onto);
56875 TYPE_THEN `u` UNABBREV_TAC;
56876 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56878 TYPE_THEN `Cu` UNABBREV_TAC;
56879 UNDH 5078 THEN (ASM_SIMP_TAC[mk_segment_v]);
56880 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56882 TYPE_THEN `Ca (point p)` SUBAGOAL_TAC;
56883 ASM_MESON_TAC[subset_imp];
56884 TYPE_THEN `Ca` UNABBREV_TAC;
56885 UNDH 3719 THEN (ASM_SIMP_TAC[mk_segment_h]);
56886 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56889 TYPE_THEN `((C' UNION Cu) INTER Q = {v}) /\ ((C' UNION Cu) INTER C'' = {(point(xmaxQ Q + &1,ymaxQ Q))}) /\ (v 1 = yminQ Q) /\ (!x. (C' UNION Cu) x ==> (x 1 = yminQ Q) \/ (xmaxQ Q < x 0))` SUBAGOAL_TAC;
56891 REWRITE_TAC[INTER;eq_sing;INR IN_SING];
56894 IMATCH_MP_TAC simple_arc_end_end;
56896 USEH 2123 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
56898 USEH 579 (REWRITE_RULE[UNION]);
56899 FIRST_ASSUM DISJ_CASES_TAC;
56900 USEH 2123 (REWRITE_RULE[eq_sing;INTER;INR IN_SING]);
56901 FIRST_ASSUM IMATCH_MP_TAC ;
56903 IMATCH_MP_TAC subset_imp;
56904 TYPE_THEN `C'` EXISTS_TAC;
56906 PROOF_BY_CONTR_TAC;
56907 TYPE_THEN `Cu` UNABBREV_TAC;
56908 TYPE_THEN `euclid 2 u` SUBAGOAL_TAC;
56909 IMATCH_MP_TAC subset_imp;
56910 TYPE_THEN `Q` EXISTS_TAC;
56912 IMATCH_MP_TAC simple_closed_curve_euclid;
56914 USEH 2838 (MATCH_MP point_onto);
56915 TYPE_THEN `u` UNABBREV_TAC;
56916 UNDH 5078 THEN (ASM_SIMP_TAC[mk_segment_v]);
56917 FULL_REWRITE_TAC[PAIR_SPLIT;point_inj];
56918 THM_INTRO_TAC[`Q`] xmaxQ_max;
56919 TSPECH `(point p)` 9371;
56921 TYPE_THEN `FST p = point p 0` SUBAGOAL_TAC;
56922 REWRITE_TAC[coord01];
56923 TYPE_THEN `FST p` UNABBREV_TAC;
56924 TYPE_THEN `point p 0` UNABBREV_TAC;
56925 UNDH 3234 THEN REAL_ARITH_TAC;
56928 REWRITE_TAC[eq_sing;INR IN_SING;INTER];
56931 REWRITE_TAC[UNION];
56933 IMATCH_MP_TAC simple_arc_end_end2;
56935 IMATCH_MP_TAC simple_arc_end_end2;
56937 TYPE_THEN `euclid 2 u` SUBAGOAL_TAC;
56938 IMATCH_MP_TAC subset_imp;
56939 TYPE_THEN `C''` EXISTS_TAC;
56941 IMATCH_MP_TAC simple_arc_euclid;
56942 IMATCH_MP_TAC simple_arc_end_simple;
56944 USEH 2838 (MATCH_MP point_onto);
56945 TYPE_THEN `u` UNABBREV_TAC;
56946 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56948 USEH 311 (REWRITE_RULE[UNION]);
56949 FIRST_ASSUM DISJ_CASES_TAC;
56950 PROOF_BY_CONTR_TAC;
56951 TYPE_THEN `Ca (point p) /\ Cb (point p)` SUBAGOAL_TAC;
56952 CONJ_TAC THEN IMATCH_MP_TAC subset_imp THEN ASM_MESON_TAC[];
56953 TYPE_THEN `Ca` UNABBREV_TAC;
56954 TYPE_THEN `Cb` UNABBREV_TAC;
56955 UNDH 4559 THEN UNDH 3719 THEN ASM_SIMP_TAC[mk_segment_h];
56956 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56957 TYPE_THEN `SND p` UNABBREV_TAC;
56958 THM_INTRO_TAC[`Q`] ymin_lt_ymax;
56960 UNDH 6486 THEN UNDH 6716 THEN REAL_ARITH_TAC;
56961 THM_INTRO_TAC[`p`] (GSYM coord01);
56964 TYPE_THEN `Cu` UNABBREV_TAC;
56965 UNDH 5078 THEN ASM_SIMP_TAC[mk_segment_v];
56966 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56968 TYPE_THEN `Cb (point p)` SUBAGOAL_TAC;
56969 IMATCH_MP_TAC subset_imp;
56970 TYPE_THEN `C''` EXISTS_TAC;
56972 TYPE_THEN `Cb` UNABBREV_TAC;
56973 UNDH 4559 THEN (ASM_SIMP_TAC[mk_segment_h]);
56974 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56977 TYPE_THEN `!x. C' x ==> (x 1 = yminQ Q)` SUBAGOAL_TAC;
56978 TYPE_THEN `euclid 2 x` SUBAGOAL_TAC;
56979 IMATCH_MP_TAC subset_imp;
56980 TYPE_THEN `C'` EXISTS_TAC;
56982 IMATCH_MP_TAC simple_arc_euclid;
56983 IMATCH_MP_TAC simple_arc_end_simple;
56985 USEH 1837 (MATCH_MP point_onto);
56986 TYPE_THEN `x` UNABBREV_TAC;
56987 TYPE_THEN `Ca (point p)` SUBAGOAL_TAC;
56988 ASM_MESON_TAC[subset_imp];
56989 TYPE_THEN `Ca` UNABBREV_TAC;
56990 UNDH 3719 THEN (ASM_SIMP_TAC[mk_segment_h]);
56991 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
56992 ASM_REWRITE_TAC[coord01];
56994 FIRST_ASSUM IMATCH_MP_TAC ;
56995 IMATCH_MP_TAC simple_arc_end_end;
56998 USEH 9465 (REWRITE_RULE[UNION]);
56999 FIRST_ASSUM DISJ_CASES_TAC;
57001 FIRST_ASSUM IMATCH_MP_TAC ;
57004 IMATCH_MP_TAC (REAL_ARITH `(u + &1 = v) ==> (u < v)`);
57005 TYPE_THEN `euclid 2 x` SUBAGOAL_TAC;
57006 IMATCH_MP_TAC subset_imp;
57007 TYPE_THEN `Cu` EXISTS_TAC;
57009 IMATCH_MP_TAC simple_arc_euclid;
57010 IMATCH_MP_TAC simple_arc_end_simple;
57012 USEH 1837 (MATCH_MP point_onto);
57013 TYPE_THEN `x` UNABBREV_TAC;
57014 TYPE_THEN `Cu` UNABBREV_TAC;
57015 UNDH 5078 THEN (ASM_SIMP_TAC[mk_segment_v]);
57016 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
57017 ASM_SIMP_TAC[coord01];
57019 TYPE_THEN `Cf = C' UNION Cu` ABBREV_TAC ;
57020 KILLH 7427 THEN KILLH 6091 THEN KILLH 7407 THEN KILLH 1428 THEN KILLH 2123 THEN KILLH 7904 THEN KILLH 700 THEN KILLH 3022;
57022 TYPE_THEN `!x. C'' x ==> (x 1 = ymaxQ Q)` SUBAGOAL_TAC;
57023 TYPE_THEN `euclid 2 x` SUBAGOAL_TAC;
57024 IMATCH_MP_TAC subset_imp;
57025 TYPE_THEN `C''` EXISTS_TAC;
57027 IMATCH_MP_TAC simple_arc_euclid;
57028 IMATCH_MP_TAC simple_arc_end_simple;
57030 USEH 1837 (MATCH_MP point_onto);
57031 TYPE_THEN `x` UNABBREV_TAC;
57032 TYPE_THEN `Cb (point p)` SUBAGOAL_TAC;
57033 ASM_MESON_TAC[subset_imp];
57034 TYPE_THEN `Cb` UNABBREV_TAC;
57035 UNDH 4559 THEN (ASM_SIMP_TAC[mk_segment_h]);
57036 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
57037 ASM_REWRITE_TAC[coord01];
57039 TYPE_THEN `C'' INTER Q = {v''}` SUBAGOAL_TAC;
57040 REWRITE_TAC[eq_sing;INR IN_SING;INTER;];
57041 USEH 6873 (REWRITE_RULE[SUBSET]);
57042 USEH 6548 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57045 THM_INTRO_TAC[`Cf`;`C''`;`v`;`point(xmaxQ Q + &1,ymaxQ Q)`;`v''`] simple_arc_end_trans;
57047 IMATCH_MP_TAC simple_arc_end_symm;
57049 TYPE_THEN `Cf UNION C''` EXISTS_TAC;
57050 TYPE_THEN `v''` EXISTS_TAC;
57051 TYPE_THEN `v` EXISTS_TAC;
57055 IMATCH_MP_TAC simple_arc_end_symm;
57059 IMATCH_MP_TAC SUBSET_ANTISYM;
57060 REWRITE_TAC[SUBSET;INTER ;INR in_pair;];
57062 USEH 3594 (REWRITE_RULE[UNION]);
57063 FIRST_ASSUM DISJ_CASES_TAC;
57065 USEH 5392 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57066 FIRST_ASSUM IMATCH_MP_TAC ;
57069 USEH 264 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57070 FIRST_ASSUM IMATCH_MP_TAC ;
57072 REWRITE_TAC[UNION];
57073 FIRST_ASSUM DISJ_CASES_TAC;
57074 TYPE_THEN `x` UNABBREV_TAC;
57075 USEH 5392 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57077 TYPE_THEN `x` UNABBREV_TAC;
57078 USEH 264 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57082 FIRST_ASSUM IMATCH_MP_TAC ;
57083 USEH 264 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57085 USEH 3594 (REWRITE_RULE[UNION]);
57086 FIRST_ASSUM DISJ_CASES_TAC;
57089 (* Sun Jan 16 18:43:03 EST 2005 *)
57093 let simple_arc_end_IVT = prove_by_refinement(
57094 `!C v w i y. simple_arc_end C v w /\ v i <= y /\ y <= w i ==>
57095 (?u. C u /\ (u i = y)) `,
57099 THM_INTRO_TAC[`C`] simple_arc_connected;
57100 IMATCH_MP_TAC simple_arc_end_simple;
57104 THM_INTRO_TAC[`i`;`2`] continuous_euclid1;
57105 FULL_REWRITE_TAC[GSYM top2];
57107 THM_INTRO_TAC[`coord i`;`top2`;`top_of_metric(UNIV,d_real)`;`C`] connect_image;
57109 ASM_SIMP_TAC[metric_real;GSYM top_of_metric_unions];
57111 TYPE_THEN `!u. C u ==> (IMAGE (coord i) C) (u i)` SUBAGOAL_TAC;
57112 TYPE_THEN `u i = coord i u` SUBAGOAL_TAC;
57113 REWRITE_TAC[coord];
57115 IMATCH_MP_TAC image_imp;
57118 THM_INTRO_TAC[`IMAGE (coord i) C`;`v i`;`w i`] connected_nogap;
57120 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC ;
57121 IMATCH_MP_TAC simple_arc_end_end;
57123 IMATCH_MP_TAC simple_arc_end_end2;
57126 USEH 9674 (REWRITE_RULE[SUBSET;IMAGE;coord]);
57128 FIRST_ASSUM IMATCH_MP_TAC ;
57130 (* Mon Jan 17 07:07:14 EST 2005 *)
57135 let simple_closed_curve_mk_ABD = prove_by_refinement(
57136 `!Q v1 v2. simple_closed_curve top2 Q /\
57137 Q v1 /\ Q v2 /\ (v2 1 = yminQ Q) /\ (v1 1 = ymaxQ Q) ==>
57139 simple_arc_end A v1 v2 /\
57140 simple_arc_end B v1 v2 /\
57142 (A INTER B = {v1,v2}) /\
57148 simple_arc_end D w1 w2 /\
57149 (D INTER Q = {w1,w2}) /\
57151 (yminQ Q < x 1) /\ (x 1 < ymaxQ Q) /\ (x 0 <= xmaxQ Q))
57156 TYPE_THEN `ymid = (yminQ Q + ymaxQ Q)/(&2)` ABBREV_TAC ;
57157 TYPE_THEN `yminQ Q < ymaxQ Q` SUBAGOAL_TAC;
57158 IMATCH_MP_TAC ymin_lt_ymax;
57160 TYPE_THEN `yminQ Q < ymid /\ ymid < ymaxQ Q` SUBAGOAL_TAC;
57161 TYPE_THEN `ymid` UNABBREV_TAC;
57162 CONJ_TAC THENL[IMATCH_MP_TAC real_middle1_lt;IMATCH_MP_TAC real_middle2_lt] THEN ASM_REWRITE_TAC[];
57164 TYPE_THEN `~(v1 = v2)` SUBAGOAL_TAC;
57165 TYPE_THEN `v2` UNABBREV_TAC;
57166 TYPE_THEN `v1 1` UNABBREV_TAC;
57167 UNDH 6716 THEN UNDH 6486 THEN REAL_ARITH_TAC;
57169 THM_INTRO_TAC[`Q`;`v1`;`v2`] simple_closed_cut;
57171 TYPE_THEN `A = C'` ABBREV_TAC ;
57172 TYPE_THEN `C'` UNABBREV_TAC;
57173 TYPE_THEN `B = C''` ABBREV_TAC ;
57174 TYPE_THEN `C''` UNABBREV_TAC;
57175 TYPE_THEN `A` EXISTS_TAC;
57176 TYPE_THEN `B` EXISTS_TAC;
57179 TYPE_THEN `C = mk_segment (point(xminQ Q,ymid)) (point(xmaxQ Q,ymid))` ABBREV_TAC ;
57180 TYPE_THEN `xminQ Q <= xmaxQ Q` SUBAGOAL_TAC;
57181 IMATCH_MP_TAC xmin_le_xmax;
57183 THM_INTRO_TAC[`(point(xminQ Q,ymid))`;`point(xmaxQ Q,ymid)`] mk_segment_simple_arc_end;
57184 REWRITE_TAC[point_inj;PAIR_SPLIT;euclid_point];
57185 TYPE_THEN `xminQ Q < xmaxQ Q` SUBAGOAL_TAC;
57186 IMATCH_MP_TAC xmin_lt_xmax;
57188 UNDH 3331 THEN UNDH 9105 THEN REAL_ARITH_TAC;
57190 TYPE_THEN `simple_arc top2 C` SUBAGOAL_TAC;
57191 IMATCH_MP_TAC simple_arc_end_simple;
57192 TYPE_THEN `C` UNABBREV_TAC;
57195 TYPE_THEN `!x. C x ==> euclid 2 x` SUBAGOAL_TAC;
57196 IMATCH_MP_TAC subset_imp;
57197 TYPE_THEN `C` EXISTS_TAC;
57199 IMATCH_MP_TAC simple_arc_euclid;
57202 TYPE_THEN `!x. C x ==> (x 1 = ymid)` SUBAGOAL_TAC;
57204 USEH 1837 (MATCH_MP point_onto);
57205 TYPE_THEN `x` UNABBREV_TAC;
57206 TYPE_THEN `C` UNABBREV_TAC;
57207 UNDH 3980 THEN (ASM_SIMP_TAC[mk_segment_h]);
57208 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
57209 ASM_REWRITE_TAC[coord01];
57211 TYPE_THEN `!x. C x ==> yminQ Q < x 1 /\ x 1 < ymaxQ Q /\ x 0 <= xmaxQ Q` SUBAGOAL_TAC;
57213 USEH 1837 (MATCH_MP point_onto);
57214 TYPE_THEN `x` UNABBREV_TAC;
57215 TYPE_THEN `C` UNABBREV_TAC;
57216 UNDH 3980 THEN UNDH 8406 THEN (SIMP_TAC[mk_segment_h]);
57217 FULL_REWRITE_TAC[point_inj;PAIR_SPLIT];
57218 ASM_REWRITE_TAC[coord01];
57220 THM_INTRO_TAC[`C`;`A INTER C`;`B INTER C`] simple_arc_end_restriction;
57223 THM_INTRO_TAC[] top2_top;
57224 TYPE_THEN `!E v v'. simple_arc_end E v v' ==> closed_ top2 E` SUBAGOAL_TAC;
57225 IMATCH_MP_TAC simple_arc_end_closed;
57228 IMATCH_MP_TAC closed_inter2;
57231 IMATCH_MP_TAC closed_inter2;
57233 REWRITE_TAC[INTER;EMPTY_EXISTS];
57234 REWRITE_TAC[EQ_EMPTY];
57236 TYPE_THEN `(x 1 = ymid)` SUBAGOAL_TAC;
57237 FIRST_ASSUM IMATCH_MP_TAC ;
57239 USEH 2195 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57241 USEH 3537 (REWRITE_RULE[INTER;INR in_pair]);
57243 FIRST_ASSUM DISJ_CASES_TAC;
57244 TYPE_THEN `x` UNABBREV_TAC;
57245 TYPE_THEN `v2 1` UNABBREV_TAC;
57246 UNDH 3402 THEN UNDH 3172 THEN REAL_ARITH_TAC;
57247 TYPE_THEN `x` UNABBREV_TAC;
57248 TYPE_THEN `v1 1` UNABBREV_TAC;
57249 UNDH 9315 THEN UNDH 8976 THEN REAL_ARITH_TAC;
57251 TYPE_THEN `!E. simple_arc_end E v1 v2 /\ (E SUBSET Q) ==> (?u. C u /\ E u)` BACK_TAC;
57253 UNDH 7189 THEN DISCH_THEN (THM_INTRO_TAC[`A`]);
57255 TYPE_THEN `Q` UNABBREV_TAC;
57256 REWRITE_TAC[SUBSET;UNION] THEN MESON_TAC[];
57258 UNDH 7189 THEN DISCH_THEN (THM_INTRO_TAC[`B`]);
57260 TYPE_THEN `Q` UNABBREV_TAC;
57261 REWRITE_TAC[SUBSET;UNION] THEN MESON_TAC[];
57263 (* --B intermediate value theorem needed *)
57264 THM_INTRO_TAC[`E`;`v2`;`v1`;`1`;`ymid`] simple_arc_end_IVT;
57267 IMATCH_MP_TAC simple_arc_end_symm;
57269 UNDH 3172 THEN UNDH 8976 THEN REAL_ARITH_TAC;
57270 TYPE_THEN `u` EXISTS_TAC;
57272 TYPE_THEN `C` UNABBREV_TAC;
57273 TYPE_THEN `euclid 2 u` SUBAGOAL_TAC;
57274 IMATCH_MP_TAC subset_imp;
57275 TYPE_THEN `E` EXISTS_TAC;
57277 IMATCH_MP_TAC simple_arc_euclid;
57278 IMATCH_MP_TAC simple_arc_end_simple;
57280 USEH 2838 (MATCH_MP point_onto);
57281 TYPE_THEN `u` UNABBREV_TAC;
57282 UNDH 8406 THEN SIMP_TAC[mk_segment_h];
57283 REWRITE_TAC[point_inj;PAIR_SPLIT];
57284 TYPE_THEN `FST p` EXISTS_TAC;
57286 ASM_REWRITE_TAC[coord01];
57288 TYPE_THEN `Q (point p)` SUBAGOAL_TAC;
57289 ASM_MESON_TAC[subset_imp];
57290 THM_INTRO_TAC[`Q`;`point p`] xminQ_min;
57292 THM_INTRO_TAC[`Q`;`point p`] xmaxQ_max;
57294 ASM_REWRITE_TAC[GSYM coord01];
57296 TYPE_THEN `D = C'''` ABBREV_TAC ;
57297 TYPE_THEN `C'''` UNABBREV_TAC;
57298 TYPE_THEN `w1 = v` ABBREV_TAC ;
57299 TYPE_THEN `v` UNABBREV_TAC;
57300 TYPE_THEN `w2 = v'` ABBREV_TAC ;
57301 TYPE_THEN `v'` UNABBREV_TAC;
57302 TYPE_THEN `D` EXISTS_TAC;
57303 TYPE_THEN `w1` EXISTS_TAC;
57304 TYPE_THEN `w2` EXISTS_TAC;
57307 TYPE_THEN `A w1 /\ B w2` SUBAGOAL_TAC;
57308 USEH 5104 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57309 USEH 7194 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57313 TYPE_THEN `D INTER Q = {w1,w2}` SUBAGOAL_TAC;
57314 TYPE_THEN `Q` UNABBREV_TAC;
57315 IMATCH_MP_TAC EQ_EXT;
57316 REWRITE_TAC[INTER;UNION;INR in_pair];
57317 UNDH 5104 THEN UNDH 7194 THEN UNDH 2332 THEN (REWRITE_TAC [eq_sing;INR IN_SING;INTER;SUBSET]) THEN MESON_TAC[];
57320 TYPE_THEN `(!x. D x ==> yminQ Q < x 1 /\ x 1 < ymaxQ Q /\ x 0 <= xmaxQ Q)` SUBAGOAL_TAC;
57321 TYPE_THEN `C x` SUBAGOAL_TAC;
57322 ASM_MESON_TAC[subset_imp];
57323 FIRST_ASSUM IMATCH_MP_TAC ;
57327 TYPE_THEN `~(v1 1 = ymid)` SUBAGOAL_TAC;
57328 TYPE_THEN `v1 1` UNABBREV_TAC;
57329 UNDH 9315 THEN UNDH 8976 THEN REAL_ARITH_TAC;
57330 TYPE_THEN `~(v2 1 = ymid)` SUBAGOAL_TAC;
57331 TYPE_THEN `v2 1` UNABBREV_TAC;
57332 UNDH 3402 THEN UNDH 3172 THEN REAL_ARITH_TAC;
57334 TYPE_THEN `!w. D w ==> (w 1 = ymid)` SUBAGOAL_TAC;
57335 FIRST_ASSUM IMATCH_MP_TAC ;
57336 ASM_MESON_TAC[subset_imp];
57338 TYPE_THEN `D w1 /\ D w2` SUBAGOAL_TAC;
57339 USEH 2450 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57340 USEH 5003 (REWRITE_RULE[INTER;INR in_pair]);
57341 UNDH 6817 THEN MESON_TAC[];
57342 TYPE_THEN `!w v. (D w) /\ ~(v 1 = ymid) ==> ~(w = v)` SUBAGOAL_TAC;
57343 TYPE_THEN `v''` UNABBREV_TAC;
57344 UNDH 5813 THEN ASM_REWRITE_TAC[];
57345 FIRST_ASSUM IMATCH_MP_TAC ;
57348 REPEAT CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN ASM_REWRITE_TAC[];
57349 (* Mon Jan 17 07:35:06 EST 2005 *)
57353 let one_sided_jordan_curve = jordan_def `one_sided_jordan_curve Q <=>
57354 (!v w. euclid 2 v /\ euclid 2 w /\ ~Q v /\ ~Q w /\ ~(v = w) ==>
57355 (?C. simple_arc_end C v w /\ (C INTER Q = EMPTY)))`;;
57357 let simple_closed_curve_mk_E = prove_by_refinement(
57358 `!Q C D . simple_closed_curve top2 Q /\ one_sided_jordan_curve Q /\
57359 ~(C SUBSET Q) /\ ~(D SUBSET Q) /\
57360 simple_arc top2 C /\ simple_arc top2 D /\ (C INTER D = EMPTY) ==>
57361 (?E x1 x2. simple_arc_end E x1 x2 /\
57362 (E INTER C = {x2}) /\ (E INTER D = {x1}) /\ (E INTER Q = EMPTY))`,
57367 TYPE_THEN `?c. C c /\ ~Q c` SUBAGOAL_TAC;
57368 FULL_REWRITE_TAC[SUBSET];
57370 TYPE_THEN `?d. D d /\ ~Q d` SUBAGOAL_TAC;
57371 FULL_REWRITE_TAC[SUBSET];
57374 FULL_REWRITE_TAC[one_sided_jordan_curve];
57376 TYPE_THEN `!R x. simple_arc top2 R /\ R x ==> euclid 2 x` SUBAGOAL_TAC;
57377 IMATCH_MP_TAC subset_imp;
57378 TYPE_THEN `R` EXISTS_TAC;
57380 IMATCH_MP_TAC simple_arc_euclid;
57383 UNDH 8763 THEN DISCH_THEN (THM_INTRO_TAC[`c`;`d`]);
57385 USEH 6641 (REWRITE_RULE[INTER;EQ_EMPTY]);
57388 THM_INTRO_TAC[`C'`;`C`;`D`] simple_arc_end_restriction;
57389 ASM_REWRITE_TAC[EMPTY_EXISTS; INTER_EMPTY; ];
57391 IMATCH_MP_TAC simple_arc_end_simple;
57394 IMATCH_MP_TAC simple_arc_end_closed;
57395 IMATCH_MP_TAC simple_arc_choose_end;
57398 IMATCH_MP_TAC simple_arc_end_closed;
57399 IMATCH_MP_TAC simple_arc_choose_end;
57401 REWRITE_TAC[INTER];
57405 IMATCH_MP_TAC simple_arc_end_end;
57410 IMATCH_MP_TAC simple_arc_end_end2;
57414 TYPE_THEN `E = C''` ABBREV_TAC ;
57415 TYPE_THEN `C''` UNABBREV_TAC;
57416 TYPE_THEN `E` EXISTS_TAC;
57417 TYPE_THEN `v'` EXISTS_TAC;
57418 TYPE_THEN `v` EXISTS_TAC;
57421 IMATCH_MP_TAC simple_arc_end_symm;
57424 UNDH 3420 THEN UNDH 5123 THEN (REWRITE_TAC[EQ_EMPTY;INTER;SUBSET]) THEN MESON_TAC[];
57425 (* Mon Jan 17 08:50:35 EST 2005 *)
57430 let jordan_curve_k33_data = jordan_def
57431 `jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 <=>
57432 simple_closed_curve top2 Q /\
57433 simple_arc_end A v1 v2 /\
57434 simple_arc_end B v1 v2 /\
57435 simple_arc_end C v1 v2 /\
57436 simple_arc_end D w1 w2 /\
57437 simple_arc_end E x1 x2 /\
57444 (A INTER B = {v1,v2}) /\
57445 (D INTER Q = {w1,w2}) /\
57446 (C INTER D = EMPTY) /\
57447 (C INTER Q = {v1,v2}) /\
57448 (E INTER C = {x2}) /\
57449 (E INTER D = {x1}) /\
57450 (E INTER Q = EMPTY)`;;
57453 let jordan_curve_k33_data_exist = prove_by_refinement(
57454 `!Q. simple_closed_curve top2 Q /\ one_sided_jordan_curve Q ==>
57455 (?A B C D E v1 v2 w1 w2 x1 x2.
57456 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2)`,
57459 REWRITE_TAC[jordan_curve_k33_data];
57460 THM_INTRO_TAC[`Q`] simple_closed_curve_mk_C;
57462 THM_INTRO_TAC[`Q`;`v1`;`v2`] simple_closed_curve_mk_ABD;
57464 USEH 7697 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57465 USEH 7606 (REWRITE_RULE[INTER;INR in_pair]);
57468 TYPE_THEN `A` EXISTS_TAC;
57469 TYPE_THEN `B` EXISTS_TAC;
57470 TYPE_THEN `C` EXISTS_TAC;
57471 TYPE_THEN `D` EXISTS_TAC;
57473 TYPE_THEN `C INTER D = EMPTY` SUBAGOAL_TAC;
57474 PROOF_BY_CONTR_TAC;
57475 USEH 7282 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
57478 UNDH 1134 THEN UNDH 2424 THEN UNDH 920 THEN UNDH 4468 THEN REAL_ARITH_TAC;
57480 THM_INTRO_TAC[`Q`;`C`;`D`] simple_closed_curve_mk_E;
57483 TYPE_THEN `simple_arc top2 C` SUBAGOAL_TAC;
57484 IMATCH_MP_TAC simple_arc_end_simple;
57486 TYPE_THEN `simple_arc top2 D` SUBAGOAL_TAC;
57487 IMATCH_MP_TAC simple_arc_end_simple;
57491 TYPE_THEN `!R y1 y2. (R INTER Q = {y1,y2}) /\ simple_arc_end R y1 y2 ==> ~(R SUBSET Q)` SUBAGOAL_TAC;
57492 TYPE_THEN `R SUBSET {y1,y2}` SUBAGOAL_TAC;
57493 USEH 842 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57494 UNDH 4643 THEN UNDH 5847 THEN (REWRITE_TAC [SUBSET;INR in_pair;INTER]) THEN MESON_TAC[];
57495 TYPE_THEN `FINITE R` SUBAGOAL_TAC;
57496 IMATCH_MP_TAC FINITE_SUBSET;
57497 TYPE_THEN `{y1,y2}` EXISTS_TAC;
57499 REWRITE_TAC[FINITE_RULES;FINITE_INSERT];
57500 THM_INTRO_TAC[`R`] simple_arc_infinite;
57501 IMATCH_MP_TAC simple_arc_end_simple;
57503 FULL_REWRITE_TAC[INFINITE];
57505 CONJ_TAC THEN FIRST_ASSUM IMATCH_MP_TAC THEN ASM_REWRITE_TAC[];
57511 TYPE_THEN `E` EXISTS_TAC;
57512 TYPE_THEN `v1` EXISTS_TAC;
57513 TYPE_THEN `v2` EXISTS_TAC;
57514 TYPE_THEN `w1` EXISTS_TAC;
57515 TYPE_THEN `w2` EXISTS_TAC;
57516 TYPE_THEN `x1` EXISTS_TAC;
57517 TYPE_THEN `x2` EXISTS_TAC;
57519 (* Mon Jan 17 09:26:35 EST 2005 *)
57524 let has_size_insert = prove_by_refinement(
57525 `!X (x:A) n. ~(X x) /\ X HAS_SIZE n ==>
57526 (x INSERT X HAS_SIZE SUC n)`,
57529 REWRITE_TAC[HAS_SIZE];
57530 ASM_SIMP_TAC [FINITE_RULES];
57531 TYPE_THEN `n` UNABBREV_TAC;
57532 IMATCH_MP_TAC (GSYM card_suc_insert);
57534 (* Mon Jan 17 09:33:11 EST 2005 *)
57539 let jordan_curve_x = prove_by_refinement(
57540 `!Q A B C D E v1 v2 w1 w2 x1 x2.
57541 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
57542 ~(Q x1) /\ ~(Q x2) /\ ~(A x1) /\ ~(A x2) /\ ~(B x1) /\ ~(B x2) /\
57543 ~C x1 /\ C x2 /\ D x1 /\ ~D x2 /\ E x1 /\ E x2`,
57546 REWRITE_TAC[jordan_curve_k33_data];
57547 TYPE_THEN `E x1 /\ E x2` SUBAGOAL_TAC;
57548 ASM_MESON_TAC[simple_arc_end_end2;simple_arc_end_end];
57551 TYPE_THEN `~Q x1 /\ ~Q x2` SUBAGOAL_TAC;
57552 USEH 885 (REWRITE_RULE[EQ_EMPTY;INTER]);
57556 TYPE_THEN `~A x1 /\ ~A x2 /\ ~B x1 /\ ~B x2` SUBAGOAL_TAC;
57557 TYPE_THEN `Q` UNABBREV_TAC;
57558 FULL_REWRITE_TAC[UNION;DE_MORGAN_THM;];
57562 TYPE_THEN `D x1` SUBAGOAL_TAC;
57563 USEH 4975 (REWRITE_RULE[eq_sing;INR IN_SING;INTER]);
57565 TYPE_THEN `C x2` SUBAGOAL_TAC;
57566 USEH 1536 (REWRITE_RULE[eq_sing;INR IN_SING;INTER]);
57570 THM_INTRO_TAC[`E`;`x1`;`x2`] simple_arc_end_distinct;
57573 USEH 1536 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57575 USEH 4975 (REWRITE_RULE[INTER;eq_sing;INR IN_SING]);
57577 (* Mon Jan 17 09:56:00 EST 2005 *)
57582 let jordan_curve_v = prove_by_refinement(
57583 `!Q A B C D E v1 v2 w1 w2 x1 x2.
57584 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
57585 Q v1 /\ Q v2 /\ A v1 /\ A v2 /\ B v1 /\ B v2 /\ C v1 /\ C v2 /\
57586 ~D v1 /\ ~D v2 /\ ~E v1 /\ ~E v2`,
57589 REWRITE_TAC[jordan_curve_k33_data];
57590 TYPE_THEN `A v1 /\ A v2 /\ B v1 /\ B v2 /\ C v1 /\ C v2` SUBAGOAL_TAC;
57591 ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
57593 TYPE_THEN `Q v1 /\ Q v2` SUBAGOAL_TAC;
57594 TYPE_THEN `Q` UNABBREV_TAC;
57595 REWRITE_TAC[UNION];
57599 TYPE_THEN `~E v1 /\ ~E v2` SUBAGOAL_TAC;
57600 USEH 885 (REWRITE_RULE[EQ_EMPTY;INTER]);
57604 USEH 2450 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57605 USEH 5003 (REWRITE_RULE[INTER;INR in_pair]);
57607 (* Mon Jan 17 10:06:12 EST 2005 *)
57612 let jordan_curve_w = prove_by_refinement(
57613 `!Q A B C D E v1 v2 w1 w2 x1 x2.
57614 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
57615 Q w1 /\ Q w2 /\ A w1 /\ ~A w2 /\ ~B w1 /\ B w2 /\ ~C w1 /\ ~C w2 /\
57616 D w1 /\ D w2 /\ ~E w1 /\ ~E w2`,
57619 REWRITE_TAC[jordan_curve_k33_data];
57621 TYPE_THEN `Q w1 /\ Q w2` SUBAGOAL_TAC;
57622 TYPE_THEN `Q` UNABBREV_TAC;
57623 REWRITE_TAC[UNION];
57627 TYPE_THEN `~E w1 /\ ~E w2` SUBAGOAL_TAC;
57628 USEH 885 (REWRITE_RULE[EQ_EMPTY;INTER;]);
57632 TYPE_THEN `D w1 /\ D w2` SUBAGOAL_TAC;
57633 ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
57636 TYPE_THEN `~C w1 /\ ~C w2` SUBAGOAL_TAC;
57637 USEH 7697 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57638 USEH 7606 (REWRITE_RULE[INTER;INR in_pair]);
57642 USEH 2195 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57643 USEH 6622 (REWRITE_RULE[INTER;INR in_pair]);
57645 (* Mon Jan 17 10:14:46 EST 2005 *)
57650 let jordan_curve_AP_size3 = prove_by_refinement(
57651 `!Q A B C D E v1 v2 w1 w2 x1 x2.
57652 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
57653 ({w1,w2,x2} HAS_SIZE 3)`,
57658 USEH 2122 (REWRITE_RULE[jordan_curve_k33_data]);
57660 TYPE_THEN `{w1,w2,x2} = x2 INSERT {w1,w2}` SUBAGOAL_TAC;
57661 IMATCH_MP_TAC EQ_EXT;
57662 REWRITE_TAC[INR IN_INSERT];
57664 TYPE_THEN `3 = SUC 2` SUBAGOAL_TAC;
57667 IMATCH_MP_TAC has_size_insert;
57668 REWRITE_TAC[INR in_pair];
57669 REWRITE_TAC[DE_MORGAN_THM];
57672 ASM_MESON_TAC[jordan_curve_w;jordan_curve_x];
57674 IMATCH_MP_TAC pair_size_2;
57675 ASM_MESON_TAC[jordan_curve_w];
57676 (* Mon Jan 17 10:18:45 EST 2005 *)
57680 let jordan_curve_BP_size3 = prove_by_refinement(
57681 `!Q A B C D E v1 v2 w1 w2 x1 x2.
57682 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
57683 ({v1,v2,x1} HAS_SIZE 3)`,
57688 USEH 2122 (REWRITE_RULE[jordan_curve_k33_data]);
57690 TYPE_THEN `{v1,v2,x1} = x1 INSERT {v1,v2}` SUBAGOAL_TAC;
57691 IMATCH_MP_TAC EQ_EXT;
57692 REWRITE_TAC[INR IN_INSERT];
57694 TYPE_THEN `3 = SUC 2` SUBAGOAL_TAC;
57697 IMATCH_MP_TAC has_size_insert;
57698 REWRITE_TAC[INR in_pair];
57699 REWRITE_TAC[DE_MORGAN_THM];
57703 USEH 2122 (MATCH_MP jordan_curve_v);
57704 USEH 2122 (MATCH_MP jordan_curve_x);
57705 UNDH 2724 THEN UNDH 3425 THEN UNDH 7579 THEN MESON_TAC[];
57707 IMATCH_MP_TAC pair_size_2;
57708 USEH 2191 (MATCH_MP simple_arc_end_distinct);
57710 (* Mon Jan 17 10:26:14 EST 2005 *)
57714 let jordan_curve_AP_BP_empty = prove_by_refinement(
57715 `!Q A B C D E v1 v2 w1 w2 x1 x2.
57716 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
57717 ({w1,w2,x2} INTER {v1,v2,x1} = EMPTY)`,
57722 USEH 2122 (REWRITE_RULE[jordan_curve_k33_data]);
57723 PROOF_BY_CONTR_TAC;
57724 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
57725 TYPE_THEN `(u = x2) \/ (u = x1) \/ ({w1,w2} u /\ {v1,v2} u)` SUBAGOAL_TAC;
57726 PROOF_BY_CONTR_TAC;
57727 FULL_REWRITE_TAC[DE_MORGAN_THM];
57728 FULL_REWRITE_TAC[INR IN_INSERT];
57729 UNDH 911 THEN UNDH 96 THEN UNDH 5829 THEN UNDH 4124 THEN UNDH 8311 THEN MESON_TAC[];
57731 UNDH 7992 THEN REP_CASES_TAC;
57732 TYPE_THEN `u` UNABBREV_TAC;
57733 FULL_REWRITE_TAC[INR IN_INSERT];
57735 USEH 2122 (MATCH_MP jordan_curve_v);
57736 USEH 2122 (MATCH_MP jordan_curve_x);
57739 TYPE_THEN `u` UNABBREV_TAC;
57740 FULL_REWRITE_TAC[INR IN_INSERT];
57742 USEH 2122 (MATCH_MP jordan_curve_w);
57743 USEH 2122 (MATCH_MP jordan_curve_x);
57746 FULL_REWRITE_TAC[INR IN_INSERT];
57748 USEH 2122 (MATCH_MP jordan_curve_w);
57749 USEH 2122 (MATCH_MP jordan_curve_v);
57751 (* Mon Jan 17 10:36:27 EST 2005 *)
57756 let has_size_drop_le = prove_by_refinement(
57757 `!n X (x:A) . FINITE X /\ CARD X <=| n ==>
57758 FINITE (x INSERT X) /\ CARD (x INSERT X) <=| SUC n`,
57762 ASM_SIMP_TAC[CARD_CLAUSES];
57764 ASM_MESON_TAC[FINITE_RULES];
57766 UNDH 2770 THEN ARITH_TAC;
57767 UNDH 2770 THEN ARITH_TAC;
57768 (* Mon Jan 17 10:45:48 EST 2005 *)
57772 let has_size_le9 = prove_by_refinement(
57773 `!(x1:A) x2 x3 x4 x5 x6 x7 x8 x9.
57774 CARD {x1,x2,x3,x4,x5,x6,x7,x8,x9} <=| 9 /\
57775 FINITE {x1,x2,x3,x4,x5,x6,x7,x8,x9}`,
57779 THM_INTRO_TAC[`0`;`EMPTY:A->bool`;`x9`] has_size_drop_le;
57780 REWRITE_TAC[FINITE_RULES;CARD_CLAUSES];
57783 THM_INTRO_TAC[`SUC 0`;`{x9}`;`x8`] has_size_drop_le;
57786 THM_INTRO_TAC[`SUC(SUC 0)`;`{x8,x9}`;`x7`] has_size_drop_le;
57788 THM_INTRO_TAC[`SUC(SUC(SUC 0))`;`{x7,x8,x9}`;`x6`] has_size_drop_le;
57790 THM_INTRO_TAC[`SUC(SUC(SUC(SUC 0)))`;`{x6,x7,x8,x9}`;`x5`] has_size_drop_le;
57792 THM_INTRO_TAC[`SUC(SUC(SUC(SUC(SUC 0))))`;`{x5,x6,x7,x8,x9}`;`x4`] has_size_drop_le;
57794 THM_INTRO_TAC[`SUC(SUC(SUC(SUC(SUC(SUC 0)))))`;`{x4,x5,x6,x7,x8,x9}`;`x3`] has_size_drop_le;
57796 THM_INTRO_TAC[`SUC(SUC(SUC(SUC(SUC(SUC(SUC 0))))))`;`{x3,x4,x5,x6,x7,x8,x9}`;`x2`] has_size_drop_le;
57798 THM_INTRO_TAC[`SUC(SUC(SUC(SUC(SUC(SUC(SUC(SUC 0)))))))`;`{x2,x3,x4,x5,x6,x7,x8,x9}`;`x1`] has_size_drop_le;
57801 UNDH 457 THEN ARITH_TAC;
57802 (* Mon Jan 17 10:58:38 EST 2005 *)
57807 let card_surj_bij = prove_by_refinement(
57808 `!(f:A->B) X Y . FINITE X /\ CARD X <=| CARD Y /\
57809 (!y. Y y ==> ?x. X x /\ (f x = y)) ==>
57814 THM_INTRO_TAC[`f`;`X`] CARD_IMAGE_LE;
57816 THM_INTRO_TAC[`f`;`X`] FINITE_IMAGE;
57818 TYPE_THEN `Y SUBSET IMAGE f X` SUBAGOAL_TAC;
57819 REWRITE_TAC[SUBSET;IMAGE];
57821 TYPE_THEN `FINITE Y` SUBAGOAL_TAC;
57822 IMATCH_MP_TAC FINITE_SUBSET;
57825 TYPE_THEN `CARD Y <=| CARD (IMAGE f X)` SUBAGOAL_TAC;
57826 IMATCH_MP_TAC CARD_SUBSET;
57828 TYPE_THEN `(CARD Y = CARD (IMAGE f X)) /\ (CARD (IMAGE f X) = CARD X)` SUBAGOAL_TAC;
57829 UNDH 5809 THEN UNDH 8940 THEN UNDH 3182 THEN ARITH_TAC;
57831 TYPE_THEN `Y = IMAGE f X` SUBAGOAL_TAC;
57832 IMATCH_MP_TAC CARD_SUBSET_EQ;
57836 TYPE_THEN `SURJ f X Y` SUBAGOAL_TAC;
57838 TYPE_THEN `Y` UNABBREV_TAC;
57840 IMATCH_MP_TAC image_imp;
57846 IMATCH_MP_TAC image_imp;
57848 PROOF_BY_CONTR_TAC;
57849 TYPE_THEN `Z = X DELETE x` ABBREV_TAC ;
57851 TYPE_THEN `IMAGE f Z = Y` SUBAGOAL_TAC;
57852 TYPE_THEN `Y` UNABBREV_TAC;
57853 IMATCH_MP_TAC SUBSET_ANTISYM;
57855 IMATCH_MP_TAC IMAGE_SUBSET;
57856 TYPE_THEN `Z` UNABBREV_TAC;
57857 REWRITE_TAC[DELETE;SUBSET];
57860 REWRITE_TAC[SUBSET;IMAGE];
57861 TYPE_THEN `x'` UNABBREV_TAC;
57862 TYPE_THEN `x'' = x` ASM_CASES_TAC;
57863 TYPE_THEN `x''` UNABBREV_TAC;
57864 TYPE_THEN `y` EXISTS_TAC;
57866 TYPE_THEN `Z` UNABBREV_TAC;
57867 REWRITE_TAC[DELETE];
57870 TYPE_THEN `x''` EXISTS_TAC;
57871 TYPE_THEN `Z` UNABBREV_TAC;
57872 REWRITE_TAC[DELETE];
57875 TYPE_THEN `FINITE Z` SUBAGOAL_TAC;
57876 TYPE_THEN `Z` UNABBREV_TAC;
57877 REWRITE_TAC[FINITE_DELETE];
57879 TYPE_THEN `CARD Z <| CARD X` SUBAGOAL_TAC;
57880 THM_INTRO_TAC[`x`;`X`] CARD_SUC_DELETE;
57882 TYPE_THEN `Z` UNABBREV_TAC;
57883 UNDH 481 THEN ARITH_TAC;
57885 TYPE_THEN `CARD Y <= CARD Z` SUBAGOAL_TAC;
57886 TYPE_THEN `Y` UNABBREV_TAC;
57887 IMATCH_MP_TAC CARD_IMAGE_LE;
57889 UNDH 9361 THEN UNDH 6773 THEN UNDH 7923 THEN UNDH 193 THEN ARITH_TAC;
57890 (* Mon Jan 17 15:04:48 EST 2005 *)
57895 let select_inter = jordan_def
57896 `select_inter A C = @x. A (x:A) /\ C x` ;;
57898 let k33f = jordan_def
57899 `k33f (A:A->bool) B E = (select_inter A E, select_inter B E)`;;
57901 let incf = jordan_def
57902 `incf (f:A-> (B#B)) E = { (FST (f E)) , (SND(f E)) }`;;
57904 let k33f_value = prove_by_refinement(
57905 `!(A:A->bool) B E a b. (A INTER E = {a}) /\ (B INTER E = {b}) ==>
57906 (k33f A B E = (a,b))`,
57910 REWRITE_TAC[k33f;PAIR_SPLIT];
57912 REWRITE_TAC[select_inter];
57913 USEH 5597 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57914 USEH 9224 (REWRITE_RULE[INTER;INR IN_SING]);
57916 REWRITE_TAC[select_inter];
57917 USEH 6985 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57918 USEH 5555 (REWRITE_RULE[INTER;INR IN_SING]);
57920 (* Mon Jan 17 15:18:50 EST 2005 *)
57924 let incf_value = prove_by_refinement(
57925 `!(A:A->bool) B E a b. (A INTER E = {a}) /\ (B INTER E = {b}) ==>
57926 (incf (k33f A B) E = {a,b})`,
57930 THM_INTRO_TAC[`A`;`B`;`E`;`a`;`b`] k33f_value;
57933 (* Mon Jan 17 15:22:22 EST 2005 *)
57937 let incf_V = prove_by_refinement(
57938 `!(A:A->bool) B E . SING(A INTER E) /\ SING(B INTER E) ==>
57939 (incf (k33f A B) E = E INTER (A UNION B))`,
57943 THM_INTRO_TAC[`A`;`B`;`E`;`x`;`x'`] incf_value;
57946 REWRITE_TAC[UNION_OVER_INTER];
57947 ONCE_REWRITE_TAC[INTER_COMM];
57949 IMATCH_MP_TAC EQ_EXT;
57950 REWRITE_TAC[UNION;INR IN_SING;INR in_pair];
57952 (* Mon Jan 17 15:31:21 EST 2005 *)
57956 let k33f_E = prove_by_refinement(
57957 `!Q A B C D E v1 v2 w1 w2 x1 x2.
57958 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
57959 ({w1,w2,x2} INTER E = {x2}) /\
57960 ({v1,v2,x1} INTER E = {x1}) `,
57965 USEH 2122(MATCH_MP jordan_curve_w);
57967 USEH 2122(MATCH_MP jordan_curve_x);
57968 USEH 2122(MATCH_MP jordan_curve_v);
57970 REWRITE_TAC[INTER;INR IN_INSERT;eq_sing];
57973 REWRITE_TAC[INTER;INR IN_INSERT;eq_sing];
57976 (* Mon Jan 17 15:40:01 EST 2005 *)
57980 let k33f_cut_lemma = prove_by_refinement(
57981 `!C v1 v2 w A B. simple_arc_end C v1 v2 /\
57982 C w /\ ~(w = v1) /\ ~(w = v2) /\
57983 (A INTER C = {v1,v2}) /\
57984 (B INTER C = {w}) ==>
57985 (A INTER (cut_arc C v1 w) = {v1}) /\
57986 (B INTER (cut_arc C v1 w) = {w})
57991 USEH 8436 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
57992 THM_INTRO_TAC[`C`;`w`;`v1`;`v2`] cut_arc_inter;
57994 FULL_REWRITE_TAC[eq_sing;INR IN_INSERT;INTER;];
57996 TYPE_THEN `simple_arc top2 C` SUBAGOAL_TAC;
57997 IMATCH_MP_TAC simple_arc_end_simple;
58000 TYPE_THEN `C v1 /\ C v2 ` SUBAGOAL_TAC;
58001 ASM_MESON_TAC[simple_arc_end_end;simple_arc_end_end2];
58003 TYPE_THEN `simple_arc_end (cut_arc C v1 w) v1 w` SUBAGOAL_TAC;
58004 IMATCH_MP_TAC cut_arc_simple;
58007 TYPE_THEN `simple_arc_end (cut_arc C v2 w) v2 w` SUBAGOAL_TAC;
58008 IMATCH_MP_TAC cut_arc_simple;
58012 TYPE_THEN `cut_arc C v1 w SUBSET C ` SUBAGOAL_TAC;
58013 IMATCH_MP_TAC cut_arc_subset;
58015 TYPE_THEN `cut_arc C v2 w SUBSET C ` SUBAGOAL_TAC;
58016 IMATCH_MP_TAC cut_arc_subset;
58019 TYPE_THEN `cut_arc C w v1 = cut_arc C v1 w` SUBAGOAL_TAC;
58020 MESON_TAC [cut_arc_symm];
58021 TYPE_THEN `cut_arc C w v1` UNABBREV_TAC;
58022 TYPE_THEN `cut_arc C w v2 = cut_arc C v2 w` SUBAGOAL_TAC;
58023 MESON_TAC [cut_arc_symm];
58024 TYPE_THEN `cut_arc C w v2` UNABBREV_TAC;
58030 IMATCH_MP_TAC simple_arc_end_end;
58032 TYPE_THEN `C u` SUBAGOAL_TAC;
58033 ASM_MESON_TAC[subset_imp];
58036 FIRST_ASSUM DISJ_CASES_TAC;
58038 TYPE_THEN `u` UNABBREV_TAC;
58039 UNDH 6835 THEN DISCH_THEN (THM_INTRO_TAC[`v2`]);
58041 IMATCH_MP_TAC simple_arc_end_end;
58045 UNDH 6153 THEN DISCH_THEN IMATCH_MP_TAC ;
58047 ASM_MESON_TAC[subset_imp];
58048 (* Mon Jan 17 16:10:38 EST 2005 *)
58053 let k33f_cut = prove_by_refinement(
58054 `!C v1 v2 w A B. simple_arc_end C v1 v2 /\
58055 C w /\ ~(w = v1) /\ ~(w = v2) /\
58056 (A INTER C = {v1,v2}) /\
58057 (B INTER C = {w}) ==>
58058 (A INTER (cut_arc C v1 w) = {v1}) /\
58059 (B INTER (cut_arc C v1 w) = {w}) /\
58060 (A INTER (cut_arc C v2 w) = {v2}) /\
58061 (B INTER (cut_arc C v2 w) = {w})`,
58065 THM_INTRO_TAC[`C`;`v1`;`v2`;`w`;`A`;`B`] k33f_cut_lemma;
58068 THM_INTRO_TAC[`C`;`v2`;`v1`;`w`;`A`;`B`] k33f_cut_lemma;
58071 IMATCH_MP_TAC simple_arc_end_symm;
58073 IMATCH_MP_TAC EQ_EXT;
58074 REWRITE_TAC[INR IN_INSERT];
58077 (* Mon Jan 17 16:13:48 EST 2005 *)
58081 let jordan_curve_k33 = jordan_def
58082 `jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2 =
58083 mk_graph_t ({w1,w2,x2} UNION {v1,v2,x1},
58085 (cut_arc A v1 w1), (cut_arc A v2 w1),
58086 (cut_arc B v1 w2), (cut_arc B v2 w2),
58087 (cut_arc C v1 x2), (cut_arc C v2 x2),
58088 (cut_arc D w1 x1),( cut_arc D w2 x1)},
58089 (\ e. {(FST (k33f {w1,w2,x2} {v1,v2,x1} e)),
58090 (SND (k33f {w1,w2,x2} {v1,v2,x1} e)) }))`;;
58092 let jordan_curve_AP_euclid = prove_by_refinement(
58093 `!Q A B C D E v1 v2 w1 w2 x1 x2 .
58094 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
58095 {w1,w2,x2} UNION {v1,v2,x1} SUBSET euclid 2`,
58101 USEH 2122 (REWRITE_RULE[jordan_curve_k33_data]);
58102 REWRITE_TAC[UNION;SUBSET;INR IN_INSERT];
58103 IMATCH_MP_TAC subset_imp;
58104 TYPE_THEN `simple_arc top2 A /\ simple_arc top2 D /\ simple_arc top2 E` SUBAGOAL_TAC;
58105 REPEAT CONJ_TAC THEN IMATCH_MP_TAC simple_arc_end_simple THEN ASM_MESON_TAC[];
58106 USEH 9474 (MATCH_MP simple_arc_euclid);
58107 USEH 6512 (MATCH_MP simple_arc_euclid);
58108 USEH 7513 (MATCH_MP simple_arc_euclid);
58110 USEH 2122 (MATCH_MP jordan_curve_x);
58112 USEH 2122 (MATCH_MP jordan_curve_v);
58114 USEH 2122 (MATCH_MP jordan_curve_w);
58115 UNDH 2244 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `x` UNABBREV_TAC THEN ASM_MESON_TAC[];
58116 (* Mon Jan 17 17:05:26 EST 2005 *)
58121 let cut_arc_simple2 = prove_by_refinement(
58122 `!C v w. simple_arc top2 C /\ C v /\ C w /\ ~(v = w) ==>
58123 simple_arc top2 (cut_arc C v w)`,
58127 THM_INTRO_TAC[`C`;`v`;`w`] cut_arc_simple;
58129 IMATCH_MP_TAC simple_arc_end_simple;
58134 let jordan_curve_k33_plane_criterion = prove_by_refinement(
58135 `!Q A B C D E v1 v2 w1 w2 x1 x2 G.
58136 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58137 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) /\
58139 (!e. graph_edge G e ==> (SING ({w1,w2,x2} INTER e)) /\
58140 (SING ({v1,v2,x1} INTER e))) /\
58141 (!e e'. graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==>
58142 e INTER e' SUBSET graph_vertex G) ==>
58148 REWRITE_TAC[plane_graph];
58150 TYPE_THEN `G` UNABBREV_TAC;
58151 FULL_REWRITE_TAC[jordan_curve_k33;graph_edge_mk_graph;graph_vertex_mk_graph;graph_inc_mk_graph];
58153 IMATCH_MP_TAC jordan_curve_AP_euclid;
58158 REWRITE_TAC[SUBSET;INR IN_INSERT];
58159 FIRST_ASSUM DISJ_CASES_TAC;
58160 TYPE_THEN `x` UNABBREV_TAC;
58161 FULL_REWRITE_TAC[jordan_curve_k33_data];
58162 ASM_MESON_TAC[simple_arc_end_simple];
58165 TYPE_THEN `simple_arc top2 A /\ simple_arc top2 B /\ simple_arc top2 C /\ simple_arc top2 D` SUBAGOAL_TAC;
58166 FULL_REWRITE_TAC[jordan_curve_k33_data];
58167 REPEAT CONJ_TAC THEN IMATCH_MP_TAC simple_arc_end_simple THEN ASM_MESON_TAC[];
58170 USEH 2122 (MATCH_MP jordan_curve_v);
58172 USEH 2122 (MATCH_MP jordan_curve_x);
58173 USEH 2122 (MATCH_MP jordan_curve_w);
58174 UNDH 9236 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `x` UNABBREV_TAC THEN IMATCH_MP_TAC cut_arc_simple2 THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[];
58176 TYPE_THEN `{(FST (k33f {w1, w2, x2} {v1, v2, x1} e)), (SND (k33f {w1, w2, x2} {v1, v2, x1} e))} = (incf (k33f {w1, w2,x2} {v1,v2,x1} ) e)` SUBAGOAL_TAC;
58179 IMATCH_MP_TAC incf_V;
58180 FIRST_ASSUM IMATCH_MP_TAC ;
58182 (* Mon Jan 17 17:27:23 EST 2005 *)
58187 (* ------------------------------------------------------------------ *)
58189 (* ------------------------------------------------------------------ *)
58192 let cartesian_size = prove_by_refinement(
58193 `!(A:A->bool) (B:B->bool) m n. A HAS_SIZE m /\ B HAS_SIZE n ==>
58194 cartesian A B HAS_SIZE (m *| n)`,
58199 THM_INTRO_TAC[`A`;`B`] CARD_PRODUCT;
58200 FULL_REWRITE_TAC[HAS_SIZE];
58202 FULL_REWRITE_TAC[IN];
58203 TYPE_THEN `cartesian A B = {(x,y) | A x /\ B y}` SUBAGOAL_TAC;
58204 REWRITE_TAC[cartesian];
58206 REWRITE_TAC[HAS_SIZE];
58208 FULL_REWRITE_TAC[HAS_SIZE];
58211 IMATCH_MP_TAC (INR FINITE_PRODUCT);
58213 (* Mon Jan 17 19:37:49 EST 2005 *)
58219 let jordan_k33f_bij = prove_by_refinement(
58220 `!Q A B C D E v1 v2 w1 w2 x1 x2 G.
58221 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58222 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) ==>
58223 (BIJ (k33f {w1,w2,x2} {v1,v2,x1})
58225 (cartesian {w1,w2,x2} {v1,v2,x1})) /\
58226 (!e. graph_edge G e ==> (SING ({w1,w2,x2} INTER e)) /\
58227 (SING ({v1,v2,x1} INTER e))) `,
58231 TYPE_THEN `G` UNABBREV_TAC;
58232 TYPE_THEN `L = (graph_edge (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2))` ABBREV_TAC ;
58233 FULL_REWRITE_TAC[jordan_curve_k33;graph_edge_mk_graph];
58236 USEH 2122 (MATCH_MP k33f_E);
58239 USEH 2122 (MATCH_MP jordan_curve_x);
58241 USEH 2122 (MATCH_MP jordan_curve_v);
58243 USEH 2122 (MATCH_MP jordan_curve_w);
58245 USEH 2122 (REWRITE_RULE [jordan_curve_k33_data]);
58247 THM_INTRO_TAC[`A`;`v1`;`v2`;`w1`;`{v1,v2,x1}`;`{w1,w2,x2}`] k33f_cut;
58249 ONCE_REWRITE_TAC[FUN_EQ_THM];
58250 REWRITE_TAC[INTER;INR IN_INSERT];
58251 CONJ_TAC THEN ASM_MESON_TAC[];
58253 THM_INTRO_TAC[`B`;`v1`;`v2`;`w2`;`{v1,v2,x1}`;`{w1,w2,x2}`] k33f_cut;
58255 ONCE_REWRITE_TAC[FUN_EQ_THM];
58256 REWRITE_TAC[INTER;INR IN_INSERT];
58257 CONJ_TAC THEN ASM_MESON_TAC[];
58259 THM_INTRO_TAC[`C`;`v1`;`v2`;`x2`;`{v1,v2,x1}`;`{w1,w2,x2}`] k33f_cut;
58261 TYPE_THEN `~(x2 = v1 ) /\ ~(x2 = v2)` SUBAGOAL_TAC;
58264 ONCE_REWRITE_TAC[FUN_EQ_THM];
58265 REWRITE_TAC[INTER;INR IN_INSERT];
58266 CONJ_TAC THEN ASM_MESON_TAC[];
58268 THM_INTRO_TAC[`D`;`w1`;`w2`;`x1`;`{w1,w2,x2}`;`{v1,v2,x1}`] k33f_cut;
58270 TYPE_THEN `~(x1 = w1 ) /\ ~(x1 = w2)` SUBAGOAL_TAC;
58273 ONCE_REWRITE_TAC[FUN_EQ_THM];
58274 REWRITE_TAC[INTER;INR IN_INSERT];
58275 CONJ_TAC THEN ASM_MESON_TAC[];
58277 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
58279 TYPE_THEN `L` UNABBREV_TAC;
58280 USEH 3555 (REWRITE_RULE[INR IN_INSERT]);
58281 TYPE_THEN `!U V (x:num->real). (U INTER V = {x}) ==> (SING (U INTER V))` SUBAGOAL_TAC;
58286 UNDH 4488 THEN DISCH_THEN (fun t-> RULE_ASSUM_TAC (fun s -> try (MATCH_MP t s) with failure -> s));
58287 FIRST_ASSUM DISJ_CASES_TAC;
58288 TYPE_THEN `e` UNABBREV_TAC;
58291 UNDH 3097 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `e` UNABBREV_TAC THEN ASM_REWRITE_TAC[] ;
58293 IMATCH_MP_TAC card_surj_bij ;
58296 TYPE_THEN `L` UNABBREV_TAC;
58297 REWRITE_TAC[FINITE_INSERT;FINITE_RULES];
58299 TYPE_THEN ` (cartesian {w1, w2, x2} {v1, v2, x1}) HAS_SIZE (3 *| 3)` SUBAGOAL_TAC;
58300 IMATCH_MP_TAC cartesian_size;
58302 IMATCH_MP_TAC jordan_curve_AP_size3;
58305 IMATCH_MP_TAC jordan_curve_BP_size3;
58309 TYPE_THEN `L` UNABBREV_TAC;
58310 FULL_REWRITE_TAC[HAS_SIZE];
58312 TYPE_THEN `3 *| 3 = 9` SUBAGOAL_TAC;
58315 MESON_TAC[has_size_le9];
58317 TYPE_THEN `(y = (w1,v1)) \/ (y = (w1,v2)) \/ (y = (w1,x1)) \/ (y = (w2,v1)) \/ (y = (w2,v2)) \/ (y = (w2,x1)) \/ (y = (x2,v1)) \/ (y = (x2,v2)) \/ (y = (x2,x1))` SUBAGOAL_TAC;
58318 FULL_REWRITE_TAC[cartesian];
58319 TYPE_THEN `y` UNABBREV_TAC;
58320 REWRITE_TAC[PAIR_SPLIT];
58321 USEH 8489 (REWRITE_RULE[INR IN_INSERT]);
58322 USEH 7329 (REWRITE_RULE[INR IN_INSERT]);
58323 UNDH 1878 THEN UNDH 8866 THEN MESON_TAC[];
58325 TYPE_THEN `?x. L x /\ ({w1,w2,x2} INTER x = {(FST y)}) /\ ({v1,v2,x1} INTER x = {(SND y)})` BACK_TAC;
58326 TYPE_THEN `x` EXISTS_TAC;
58328 THM_INTRO_TAC[`{w1,w2,x2}`;`{v1,v2,x1}`;`x`;`FST y`;`SND y`] k33f_value;
58330 USEH 5894 (REWRITE_RULE[]);
58333 TYPE_THEN `L` UNABBREV_TAC;
58334 REWRITE_TAC[INR IN_INSERT];
58335 UNDH 7966 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `y` UNABBREV_TAC THEN REWRITE_TAC[] THEN ASM_MESON_TAC[];
58336 (* Mon Jan 17 20:01:06 EST 2005 *)
58341 let jordan_curve_k33_isk33 = prove_by_refinement(
58342 `!Q A B C D E v1 v2 w1 w2 x1 x2 .
58343 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
58344 graph_isomorphic k33_graph
58345 (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)`,
58348 REWRITE_TAC[jordan_curve_k33];
58349 IMATCH_MP_TAC k33_iso;
58352 IMATCH_MP_TAC jordan_curve_AP_size3;
58357 IMATCH_MP_TAC jordan_curve_BP_size3;
58362 IMATCH_MP_TAC jordan_curve_AP_BP_empty;
58366 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`;`jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2`] jordan_k33f_bij;
58369 FULL_REWRITE_TAC[jordan_curve_k33;graph_edge_mk_graph;];
58370 TYPE_THEN `fn = k33f {w1,w2,x2} {v1,v2,x1}` ABBREV_TAC ;
58371 TYPE_THEN `(\ e. fn e) = fn` SUBAGOAL_TAC;
58372 IMATCH_MP_TAC EQ_EXT;
58374 (* Mon Jan 17 20:12:31 EST 2005 *)
58378 let jordan_curve_k33_data_inter = prove_by_refinement(
58379 `!Q A B C D E v1 v2 w1 w2 x1 x2 .
58380 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
58381 (A INTER B = {v1,v2}) /\
58382 (A INTER C = {v1,v2}) /\
58383 (A INTER D = {w1}) /\
58384 (A INTER E = EMPTY) /\
58385 (B INTER C = {v1,v2}) /\
58386 (B INTER D = {w2}) /\
58387 (B INTER E = EMPTY) /\
58388 (C INTER D = EMPTY) /\
58389 (C INTER E = {x2}) /\
58390 (D INTER E = {x1})`,
58393 REWRITE_TAC[jordan_curve_k33_data];
58394 FULL_REWRITE_TAC[INTER_COMM];
58397 TYPE_THEN `(A INTER E = EMPTY ) /\ (B INTER E = EMPTY)` SUBAGOAL_TAC;
58398 TYPE_THEN `Q` UNABBREV_TAC;
58399 USEH 2576 (REWRITE_RULE[INTER;UNION;EQ_EMPTY]);
58400 REWRITE_TAC[EQ_EMPTY;INTER];
58404 TYPE_THEN `(A INTER C = {v1, v2}) /\ (B INTER C = {v1, v2})` SUBAGOAL_TAC;
58405 ONCE_REWRITE_TAC[FUN_EQ_THM];
58406 REWRITE_TAC[INTER;INR IN_INSERT];
58407 USEH 7697 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
58408 USEH 7606 (REWRITE_RULE[INTER;INR IN_INSERT]);
58409 TYPE_THEN `Q` UNABBREV_TAC;
58410 FULL_REWRITE_TAC[UNION];
58411 USEH 2195 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
58412 USEH 6622 (REWRITE_RULE[INTER;INR IN_INSERT]);
58413 CONJ_TAC THEN ASM_MESON_TAC[];
58416 REWRITE_TAC[INTER;eq_sing;INR IN_INSERT];
58417 TYPE_THEN `Q` UNABBREV_TAC;
58419 USEH 1691 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
58420 USEH 4348 (REWRITE_RULE[INTER;UNION;INR IN_INSERT]);
58421 USEH 2195 (ONCE_REWRITE_RULE[FUN_EQ_THM]);
58422 USEH 6622 (REWRITE_RULE[INTER;INR IN_INSERT]);
58424 (* Mon Jan 17 20:35:28 EST 2005 *)
58428 let jordan_curve_edge_inter = prove_by_refinement(
58429 `!Q A B C D E v1 v2 w1 w2 x1 x2 .
58430 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
58431 (!e e'. {A,B,C,D,E} e /\ {A,B,C,D,E} e' /\ ~(e = e') ==>
58432 (e INTER e' SUBSET ({w1,w2,x2} UNION {v1,v2,x1})))`,
58435 REWRITE_TAC[INR IN_INSERT];
58436 TYPE_THEN `V = {w1, w2, x2} UNION {v1, v2, x1}` ABBREV_TAC ;
58437 TYPE_THEN `{v1,v2} SUBSET V /\ {w1} SUBSET V /\ EMPTY SUBSET V /\ {w2} SUBSET V /\ {x2} SUBSET V /\ {x1} SUBSET V` SUBAGOAL_TAC;
58438 TYPE_THEN `V` UNABBREV_TAC;
58439 REWRITE_TAC[SUBSET;UNION;INR IN_INSERT];
58440 REPEAT CONJ_TAC THEN MESON_TAC[];
58442 JOIN 2 1 THEN FULL_REWRITE_TAC[RIGHT_AND_OVER_OR;LEFT_AND_OVER_OR];
58443 USEH 2122 (MATCH_MP jordan_curve_k33_data_inter);
58444 UNDH 4732 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `e` UNABBREV_TAC THEN TYPE_THEN `e'` UNABBREV_TAC THEN FULL_REWRITE_TAC[] THEN ASM_REWRITE_TAC[INTER_COMM ] THEN ASM_MESON_TAC[];
58445 (* Mon Jan 17 20:46:56 EST 2005 *)
58449 let jordan_curve_k33_plane_criterion2 = prove_by_refinement(
58450 `!Q A B C D E v1 v2 w1 w2 x1 x2 G.
58451 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58452 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) /\
58453 (!e e'. graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==>
58454 e INTER e' SUBSET graph_vertex G) ==>
58459 IMATCH_MP_TAC jordan_curve_k33_plane_criterion;
58464 THM_INTRO_TAC[`k33_graph`;`G`] graph_isomorphic_graph;
58465 REWRITE_TAC[k33_isgraph];
58466 TYPE_THEN `G` UNABBREV_TAC;
58467 IMATCH_MP_TAC jordan_curve_k33_isk33;
58470 TYPE_THEN `G` UNABBREV_TAC;
58473 ASM_MESON_TAC[jordan_k33f_bij];
58474 (* Tue Jan 18 06:14:19 EST 2005 *)
58479 let jordan_curve_edge_arc = prove_by_refinement(
58480 `!Q A B C D E v1 v2 w1 w2 x1 x2 G e.
58481 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58482 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) /\
58483 (graph_edge G e) ==> (simple_arc top2 e)`,
58487 TYPE_THEN `G` UNABBREV_TAC;
58488 FULL_REWRITE_TAC[graph_edge_mk_graph;jordan_curve_k33];
58489 FULL_REWRITE_TAC[INR IN_INSERT];
58491 USEH 2122 (REWRITE_RULE[jordan_curve_k33_data]);
58492 RULE_ASSUM_TAC (fun s-> try (MATCH_MP simple_arc_end_simple s) with failure -> s);
58494 FIRST_ASSUM DISJ_CASES_TAC;
58495 TYPE_THEN `e` UNABBREV_TAC;
58499 USEH 2122 (MATCH_MP jordan_curve_x);
58501 USEH 2122 (MATCH_MP jordan_curve_v);
58503 USEH 2122 (MATCH_MP jordan_curve_w);
58504 UNDH 3097 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `e` UNABBREV_TAC THEN IMATCH_MP_TAC cut_arc_simple2 THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[];
58505 (* Tue Jan 18 06:28:31 EST 2005 *)
58510 let jordan_curve_guider_inj = prove_by_refinement(
58511 `!Q A B C D E v1 v2 w1 w2 x1 x2 G e U V.
58512 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58513 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) /\
58514 (graph_edge G e) /\ {A,B,C,D,E} U /\ {A,B,C,D,E} V /\
58515 (e SUBSET U) /\ (e SUBSET V) ==> (U = V) `,
58519 PROOF_BY_CONTR_TAC;
58520 TYPE_THEN `INFINITE e` SUBAGOAL_TAC;
58521 IMATCH_MP_TAC simple_arc_infinite;
58522 IMATCH_MP_TAC jordan_curve_edge_arc;
58526 TYPE_THEN `(U INTER V) SUBSET ({w1,w2,x2} UNION {v1,v2,x1})` SUBAGOAL_TAC;
58527 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`] jordan_curve_edge_inter;
58529 FIRST_ASSUM IMATCH_MP_TAC ;
58532 TYPE_THEN `e SUBSET {w1, w2, x2} UNION {v1, v2, x1}` SUBAGOAL_TAC;
58533 IMATCH_MP_TAC SUBSET_TRANS;
58534 TYPE_THEN `U INTER V` EXISTS_TAC;
58536 ASM_REWRITE_TAC [SUBSET;INTER];
58537 ASM_MESON_TAC[subset_imp];
58539 TYPE_THEN `FINITE ({w1, w2, x2} UNION {v1, v2, x1})` SUBAGOAL_TAC;
58540 REWRITE_TAC[ FINITE_UNION];
58541 REWRITE_TAC[FINITE_RULES;FINITE_INSERT];
58542 TYPE_THEN `FINITE e` SUBAGOAL_TAC;
58543 IMATCH_MP_TAC FINITE_SUBSET;
58544 TYPE_THEN `{w1, w2, x2} UNION {v1, v2, x1}` EXISTS_TAC;
58546 FULL_REWRITE_TAC[INFINITE];
58548 (* Tue Jan 18 06:3282:02 EST 2005 *)
58552 let jordan_curve_guider_disj = prove_by_refinement(
58553 `!Q A B C D E v1 v2 w1 w2 x1 x2 .
58554 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
58555 ~(A = B) /\ ~(A = C) /\ ~(A = D) /\ ~(A = E) /\ ~(B = C) /\
58556 ~(B = D) /\ ~(B = E) /\ ~(C = D) /\ ~(C = E) /\ ~(D = E)`,
58560 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`] jordan_curve_k33_data_inter;
58562 PROOF_BY_CONTR_TAC;
58563 FULL_REWRITE_TAC[DE_MORGAN_THM];
58565 TYPE_THEN `INFINITE A /\ INFINITE B /\ INFINITE C /\ INFINITE D /\ INFINITE E` SUBAGOAL_TAC;
58566 FULL_REWRITE_TAC[jordan_curve_k33_data];
58567 RULE_ASSUM_TAC (fun s -> try (MATCH_MP simple_arc_end_simple s) with failure -> s);
58568 RULE_ASSUM_TAC (fun s -> try (MATCH_MP simple_arc_infinite s) with failure -> s);
58571 TYPE_THEN `FINITE (A INTER B) /\ FINITE (A INTER C) /\ FINITE (A INTER D) /\ FINITE (A INTER E) /\ FINITE (B INTER C) /\ FINITE (B INTER D) /\ FINITE (B INTER E) /\ FINITE (C INTER D) /\ FINITE(C INTER E) /\ FINITE (D INTER E)` SUBAGOAL_TAC;
58573 REWRITE_TAC[FINITE_RULES;FINITE_INSERT];
58574 FULL_REWRITE_TAC[INFINITE];
58576 KILLH 3523 THEN KILLH 1286 THEN KILLH 6641 THEN KILLH 4962 THEN KILLH 3223 THEN KILLH 6941 THEN KILLH 9399 THEN KILLH 3259 THEN KILLH 8436 THEN KILLH 2195 THEN KILLH 2122;
58577 UNDH 5285 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TRY (TYPE_THEN `A` UNABBREV_TAC) THEN TRY (TYPE_THEN `B` UNABBREV_TAC) THEN TRY (TYPE_THEN `C` UNABBREV_TAC) THEN TRY (TYPE_THEN `D` UNABBREV_TAC) THEN FULL_REWRITE_TAC[INTER_IDEMPOT] THEN ASM_MESON_TAC[];
58578 (* Tue Jan 18 07:01:04 EST 2005 *)
58583 let jordan_curve_guider_enum = prove_by_refinement(
58584 `!Q A B C D E v1 v2 w1 w2 x1 x2 .
58585 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 ==>
58587 (cut_arc A v1 w1 SUBSET A) /\
58588 (cut_arc A v2 w1 SUBSET A) /\
58589 (cut_arc B v1 w2 SUBSET B) /\
58590 (cut_arc B v2 w2 SUBSET B) /\
58591 (cut_arc C v1 x2 SUBSET C) /\
58592 (cut_arc C v2 x2 SUBSET C) /\
58593 (cut_arc D w1 x1 SUBSET D) /\
58594 (cut_arc D w2 x1 SUBSET D)`,
58597 REWRITE_TAC[SUBSET_REFL];
58599 USEH 2122 (REWRITE_RULE[jordan_curve_k33_data]);
58600 RULE_ASSUM_TAC (fun s -> try (MATCH_MP simple_arc_end_simple s) with failure -> s);
58602 USEH 2122 (MATCH_MP jordan_curve_x);
58604 USEH 2122 (MATCH_MP jordan_curve_v);
58606 USEH 2122 (MATCH_MP jordan_curve_w);
58607 REPEAT CONJ_TAC THEN IMATCH_MP_TAC cut_arc_subset THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[];
58608 (* Tue Jan 18 07:12:33 EST 2005 *)
58612 let jordan_curve_guider_exists = prove_by_refinement(
58613 `!Q A B C D E v1 v2 w1 w2 x1 x2 G e.
58614 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58615 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) /\
58617 (?U. {A,B,C,D,E} U /\ e SUBSET U)`,
58620 REWRITE_TAC[INR IN_INSERT];
58621 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`] jordan_curve_guider_enum;
58623 TYPE_THEN `G` UNABBREV_TAC;
58624 FULL_REWRITE_TAC[graph_edge_mk_graph;jordan_curve_k33];
58625 FULL_REWRITE_TAC[INR IN_INSERT];
58626 UNDH 4869 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `e` UNABBREV_TAC THEN UNIFY_EXISTS_TAC THEN ASM_REWRITE_TAC[];
58627 (* Tue Jan 18 07:43:50 EST 2005 *)
58631 let jordan_curve_guider_sep_lemma = prove_by_refinement(
58632 `!Q A B C D E v1 v2 w1 w2 x1 x2 G e .
58633 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58634 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) /\
58636 (((e SUBSET A) ==> (e = cut_arc A v1 w1) \/ (e = cut_arc A v2 w1)) /\
58637 ((e SUBSET B) ==> (e = cut_arc B v1 w2) \/ (e = cut_arc B v2 w2)) /\
58638 ((e SUBSET C) ==> (e = cut_arc C v1 x2) \/ (e = cut_arc C v2 x2)) /\
58639 ((e SUBSET D) ==> (e = cut_arc D w1 x1) \/ (e = cut_arc D w2 x1)) /\
58640 ((e SUBSET E) ==> (e = E)))
58645 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`] jordan_curve_guider_enum;
58647 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`] jordan_curve_guider_disj;
58649 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`;`G`;`e`] jordan_curve_guider_inj;
58651 TYPE_THEN `G` UNABBREV_TAC;
58652 FULL_REWRITE_TAC[jordan_curve_k33;graph_edge_mk_graph;INR IN_INSERT];
58653 REPEAT CONJ_TAC THEN UNDH 4869 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `e` UNABBREV_TAC THEN ASM_MESON_TAC[];
58654 (* Tue Jan 18 09:38:07 EST 2005 *)
58658 let cut_arc_inter_lemma = prove_by_refinement(
58659 `!X R u v w. X u /\
58660 simple_arc_end R v w /\ R u /\ ~(u = v) /\ ~(u = w) ==>
58661 (cut_arc R v u INTER cut_arc R w u SUBSET X)`,
58665 THM_INTRO_TAC[`R`;`u`;`v`;`w`] cut_arc_inter;
58667 TYPE_THEN `cut_arc R u w = cut_arc R w u` SUBAGOAL_TAC;
58668 MESON_TAC[cut_arc_symm];
58669 TYPE_THEN `cut_arc R u w` UNABBREV_TAC;
58671 REWRITE_TAC[SUBSET;INR IN_SING];
58672 TYPE_THEN `x` UNABBREV_TAC;
58674 (* Tue Jan 18 09:55:17 EST 2005 *)
58678 let jordan_curve_cut_inter = prove_by_refinement(
58679 `!Q A B C D E v1 v2 w1 w2 x1 x2 G.
58680 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58681 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) ==>
58682 (cut_arc A v1 w1 INTER cut_arc A v2 w1 SUBSET graph_vertex G) /\
58683 (cut_arc B v1 w2 INTER cut_arc B v2 w2 SUBSET graph_vertex G) /\
58684 (cut_arc C v1 x2 INTER cut_arc C v2 x2 SUBSET graph_vertex G) /\
58685 (cut_arc D w1 x1 INTER cut_arc D w2 x1 SUBSET graph_vertex G)
58690 TYPE_THEN `G` UNABBREV_TAC;
58691 FULL_REWRITE_TAC[graph_vertex_mk_graph;jordan_curve_k33];
58695 USEH 2122 (MATCH_MP jordan_curve_x);
58696 USEH 2122 (MATCH_MP jordan_curve_v);
58697 USEH 2122 (MATCH_MP jordan_curve_w);
58698 FULL_REWRITE_TAC[jordan_curve_k33_data];
58699 REPEAT CONJ_TAC THEN IMATCH_MP_TAC cut_arc_inter_lemma THEN ASM_REWRITE_TAC[UNION;INR IN_INSERT ] THEN ASM_MESON_TAC[] ;
58700 (* Tue Jan 18 10:00:14 EST 2005 *)
58704 let jordan_curve_guider_separate = prove_by_refinement(
58705 `!Q A B C D E v1 v2 w1 w2 x1 x2 G U e e'.
58706 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58707 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) /\
58708 {A,B,C,D,E} U /\ e SUBSET U /\ e' SUBSET U /\
58709 graph_edge G e /\ graph_edge G e' /\ ~(e = e') ==>
58710 (e INTER e' SUBSET graph_vertex G)
58715 TYPE_THEN `?a b. ((e = a) \/ (e = b)) /\ ((e' = a) \/ (e' = b)) /\ (a INTER b SUBSET graph_vertex G)` BACK_TAC;
58716 TYPE_THEN `((e = a) /\ (e' = b)) \/ ((e = b) /\ (e' = a))` SUBAGOAL_TAC;
58718 FIRST_ASSUM DISJ_CASES_TAC;
58720 TYPE_THEN `e` UNABBREV_TAC;
58721 TYPE_THEN `e'` UNABBREV_TAC;
58722 FULL_REWRITE_TAC[INTER_COMM];
58725 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`;`G`] jordan_curve_cut_inter;
58727 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`;`G`;`e`] jordan_curve_guider_sep_lemma ;
58729 THM_INTRO_TAC[`Q`;`A`;`B`;`C`;`D`;`E`;`v1`;`v2`;`w1`;`w2`;`x1`;`x2`;`G`;`e'`] jordan_curve_guider_sep_lemma ;
58731 FULL_REWRITE_TAC[INR IN_INSERT];
58732 TYPE_THEN `U = E` ASM_CASES_TAC;
58733 TYPE_THEN `U` UNABBREV_TAC;
58734 TYPE_THEN `E` UNABBREV_TAC;
58735 TYPE_THEN `e'` UNABBREV_TAC;
58736 UNDH 4836 THEN MESON_TAC[];
58738 TYPE_THEN `G` UNABBREV_TAC;
58739 UNDH 7811 THEN REP_CASES_TAC THEN REP_BASIC_TAC THEN TYPE_THEN `U` UNABBREV_TAC THEN REP_BASIC_TAC;
58745 KILLH 2881 THEN KILLH 1255;
58748 KILLH 2881 THEN KILLH 1255 THEN KILLH 2514;
58751 (* Tue Jan 18 10:22:53 EST 2005 *)
58755 let jordan_curve_k33_plane = prove_by_refinement(
58756 `!Q A B C D E v1 v2 w1 w2 x1 x2 G .
58757 jordan_curve_k33_data Q A B C D E v1 v2 w1 w2 x1 x2 /\
58758 (G = (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)) ==>
58763 IMATCH_MP_TAC jordan_curve_k33_plane_criterion2;
58767 TYPE_THEN `(?U. {A,B,C,D,E} U /\ e SUBSET U)` SUBAGOAL_TAC;
58768 IMATCH_MP_TAC jordan_curve_guider_exists;
58771 TYPE_THEN `(?U'. {A,B,C,D,E} U' /\ e' SUBSET U')` SUBAGOAL_TAC;
58772 IMATCH_MP_TAC jordan_curve_guider_exists;
58775 TYPE_THEN `U = U'` ASM_CASES_TAC;
58776 TYPE_THEN `U'` UNABBREV_TAC;
58777 IMATCH_MP_TAC jordan_curve_guider_separate;
58781 IMATCH_MP_TAC SUBSET_TRANS;
58782 TYPE_THEN `U INTER U'` EXISTS_TAC;
58784 IMATCH_MP_TAC subset_inter_pair;
58786 REWRITE_TAC[jordan_curve_k33;graph_vertex_mk_graph];
58787 ASM_MESON_TAC[jordan_curve_edge_inter];
58788 (* Tue Jan 18 10:32:34 EST 2005 *)
58792 let jordan_curve_not_one_sided = prove_by_refinement(
58793 `!Q. simple_closed_curve top2 Q ==> ~(one_sided_jordan_curve Q)`,
58798 THM_INTRO_TAC[`Q`] jordan_curve_k33_data_exist;
58800 TYPE_THEN `plane_graph (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)` SUBAGOAL_TAC;
58801 IMATCH_MP_TAC jordan_curve_k33_plane;
58805 TYPE_THEN `graph_isomorphic k33_graph (jordan_curve_k33 A B C D E v1 v2 w1 w2 x1 x2)` SUBAGOAL_TAC;
58806 IMATCH_MP_TAC jordan_curve_k33_isk33;
58809 THM_INTRO_TAC[] k33_nonplanar;
58810 FULL_REWRITE_TAC[planar_graph];
58811 UNDH 3419 THEN ASM_REWRITE_TAC[];
58814 IMATCH_MP_TAC graph_isomorphic_symm;
58816 REWRITE_TAC[k33_isgraph];
58817 (* Tue Jan 18 10:43:40 EST 2005 *)
58823 Tue Jan 18 10:44:07 EST 2005
58825 I'M DONE! The Jordan Curve Theorem is proved.
58827 The statements jordan_curve_not_one_sided
58828 and jordan_curve_no_inj3 give a form of the Jordan Curve Theorem.
58830 Now lets put it in a simple form.
58834 let component_simple_arc_ver2 = prove_by_refinement(
58835 `!G x y. (closed_ top2 G ) /\ ~(x = y) ==>
58836 (component (induced_top top2 (euclid 2 DIFF G)) x y <=>
58837 (?C. simple_arc_end C x y /\
58838 (C INTER G = EMPTY)))`,
58842 string together :component-imp-connected, connected-induced2,
58843 p_conn_conn, p_conn_hv_finite;
58844 other_direction : simple_arc_connected, connected-induced,
58845 connected-component; *)
58847 ASSUME_TAC top2_top;
58848 THM_INTRO_TAC[`top2`;`(euclid 2 DIFF G)`] induced_top_top;
58851 TYPE_THEN `top2 (euclid 2 DIFF G)` SUBAGOAL_TAC;
58852 USEH 4142 (MATCH_MP closed_open);
58853 FULL_REWRITE_TAC[top2_unions;open_DEF ];
58856 TYPE_THEN `A = euclid 2 DIFF G` ABBREV_TAC ;
58857 TYPE_THEN `UNIONS (induced_top top2 A) = A` SUBAGOAL_TAC;
58858 THM_INTRO_TAC[`top2`;`A`] induced_top_support;
58859 ASM_REWRITE_TAC[top2_unions;];
58860 TYPE_THEN `A` UNABBREV_TAC;
58861 IMATCH_MP_TAC EQ_EXT;
58862 REWRITE_TAC[INTER;DIFF];
58865 IMATCH_MP_TAC EQ_ANTISYM;
58867 THM_INTRO_TAC[`induced_top top2 A`;`x`] component_imp_connected;
58869 THM_INTRO_TAC[`(top2)`;`A`;`(component (induced_top top2 A) x)`] connected_induced2;
58870 ASM_REWRITE_TAC[top2_unions];
58871 IMATCH_MP_TAC SUBSET_TRANS;
58872 TYPE_THEN `UNIONS (induced_top top2 A)` EXISTS_TAC;
58875 REWRITE_TAC[component_unions];
58876 UNDH 250 THEN DISCH_THEN (fun t-> ONCE_REWRITE_TAC [t]);
58877 TYPE_THEN `A` UNABBREV_TAC;
58878 REWRITE_TAC[DIFF;SUBSET];
58882 TYPE_THEN `B = component (induced_top top2 A) x` ABBREV_TAC ;
58883 TYPE_THEN `B x /\ B y` SUBAGOAL_TAC;
58884 TYPE_THEN `B` UNABBREV_TAC;
58886 THM_INTRO_TAC[`(induced_top top2 A)`;`x`;`y`] component_replace;
58889 IMATCH_MP_TAC component_symm;
58892 ASSUME_TAC loc_path_conn_top2;
58893 TYPE_THEN `top_of_metric(A,d_euclid) = (induced_top top2 A)` SUBAGOAL_TAC;
58895 ONCE_REWRITE_TAC[EQ_SYM_EQ];
58896 IMATCH_MP_TAC top_of_metric_induced;
58897 TYPE_THEN `A` UNABBREV_TAC;
58898 REWRITE_TAC[DIFF;SUBSET];
58899 MESON_TAC[metric_euclid];
58901 TYPE_THEN `loc_path_conn (induced_top top2 A)` SUBAGOAL_TAC;
58902 THM_INTRO_TAC[`2`;`A`] loc_path_conn_euclid;
58903 FULL_REWRITE_TAC[top2];
58907 THM_INTRO_TAC[`top2`] loc_path_conn;
58912 TYPE_THEN `A x` SUBAGOAL_TAC;
58913 ASM_MESON_TAC[subset_imp];
58914 TYPE_THEN `top2 B` SUBAGOAL_TAC;
58915 TYPE_THEN `B` UNABBREV_TAC;
58916 ASM_MESON_TAC[path_eq_conn];
58918 THM_INTRO_TAC[`B`;`x`;`y`] p_conn_conn;
58921 THM_INTRO_TAC[`B`;`x`;`y`] p_conn_hv_finite;
58924 TYPE_THEN `C` EXISTS_TAC;
58926 PROOF_BY_CONTR_TAC;
58927 FULL_REWRITE_TAC[EMPTY_EXISTS;INTER];
58928 TYPE_THEN `B u` SUBAGOAL_TAC;
58929 ASM_MESON_TAC[subset_imp];
58930 TYPE_THEN `A u` SUBAGOAL_TAC;
58931 ASM_MESON_TAC[subset_imp];
58932 TYPE_THEN `A` UNABBREV_TAC;
58933 USEH 1911 (REWRITE_RULE[DIFF]);
58936 (* other_direction : simple_arc_connected, connected-induced,
58937 connected-component; *)
58938 THM_INTRO_TAC[`C`;`x`;`y`] simple_arc_end_simple;
58940 THM_INTRO_TAC[`C`] simple_arc_connected;
58942 TYPE_THEN `C SUBSET euclid 2` SUBAGOAL_TAC;
58943 IMATCH_MP_TAC simple_arc_euclid;
58945 THM_INTRO_TAC[`top2`;`A`;`C`] connected_induced2;
58946 ASM_REWRITE_TAC[top2_unions];
58949 TYPE_THEN `C SUBSET A` SUBAGOAL_TAC;
58950 TYPE_THEN `A` UNABBREV_TAC;
58951 ASM_REWRITE_TAC[DIFF_SUBSET];
58954 THM_INTRO_TAC[`induced_top top2 A`;`C`;`x`] connected_component;
58956 IMATCH_MP_TAC simple_arc_end_end;
58958 USEH 5951(REWRITE_RULE[SUBSET]);
58960 FIRST_ASSUM IMATCH_MP_TAC ;
58961 IMATCH_MP_TAC simple_arc_end_end2;
58963 (* Tue Jan 18 12:54:06 EST 2005 *)
58968 let component_properties = prove_by_refinement(
58969 `!C A v. closed_ top2 C /\ (euclid 2 v) /\ ~C v /\
58970 (A = component (induced_top top2 (euclid 2 DIFF C)) v) ==>
58971 top2 A /\ connected top2 A /\
58972 ~(A = EMPTY) /\ (A INTER C = EMPTY) /\ A v /\
58973 (A SUBSET euclid 2) /\
58975 (A w = (?P. simple_arc_end P v w /\ (P INTER C = EMPTY))))`,
58980 ASSUME_TAC top2_top;
58982 THM_INTRO_TAC[`top2`;`(euclid 2 DIFF C)`] induced_top_support;
58983 FULL_REWRITE_TAC[top2_unions];
58985 TYPE_THEN `euclid 2 INTER (euclid 2 DIFF C) = euclid 2 DIFF C` SUBAGOAL_TAC;
58986 IMATCH_MP_TAC EQ_EXT;
58987 REWRITE_TAC[INTER;DIFF];
58992 TYPE_THEN `top2 (euclid 2 DIFF C)` SUBAGOAL_TAC;
58993 THM_INTRO_TAC[`top2`;`C`] (REWRITE_RULE[open_DEF] closed_open);
58995 FULL_REWRITE_TAC[top2_unions];
58998 THM_INTRO_TAC[`2`;`(euclid 2 DIFF C)`] loc_path_conn_euclid;
58999 REWRITE_TAC[GSYM top2];
59002 THM_INTRO_TAC[`2`;`euclid 2`] loc_path_conn_euclid;
59003 REWRITE_TAC[GSYM top2];
59004 THM_INTRO_TAC[`top2`] top_univ;
59005 REWRITE_TAC[top2_top];
59006 FULL_REWRITE_TAC[top2_unions];
59008 FULL_REWRITE_TAC[GSYM top2];
59012 TYPE_THEN `A v` SUBAGOAL_TAC;
59013 TYPE_THEN `A` UNABBREV_TAC;
59014 IMATCH_MP_TAC component_refl THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[DIFF];
59017 TYPE_THEN `~(A = EMPTY)` SUBAGOAL_TAC THENL[ REWRITE_TAC[EMPTY_EXISTS];ALL_TAC];
59021 TYPE_THEN `A INTER C = EMPTY` SUBAGOAL_TAC;
59022 THM_INTRO_TAC[`(induced_top top2 (euclid 2 DIFF C))`;`v`] component_unions;
59024 UNDH 4798 THEN REWRITE_TAC[INTER;SUBSET;DIFF;EQ_EMPTY] THEN MESON_TAC[];
59027 TYPE_THEN `A SUBSET euclid 2` SUBAGOAL_TAC;
59028 THM_INTRO_TAC[`(induced_top top2 (euclid 2 DIFF C))`;`v`] component_unions;
59030 UNDH 4798 THEN REWRITE_TAC[SUBSET;DIFF] THEN MESON_TAC[];
59033 TYPE_THEN `top_of_metric(euclid 2 DIFF C,d_euclid) = induced_top top2 (euclid 2 DIFF C)` SUBAGOAL_TAC;
59035 IMATCH_MP_TAC (GSYM top_of_metric_induced);
59036 REWRITE_TAC[metric_euclid];
59037 REWRITE_TAC[DIFF;SUBSET] THEN MESON_TAC[];
59039 THM_INTRO_TAC[`2`;`euclid 2 DIFF C`] loc_path_euclid_cor;
59040 REWRITE_TAC[GSYM top2];
59043 THM_INTRO_TAC[`top2`] loc_path_conn;
59046 TYPE_THEN `A` UNABBREV_TAC;
59052 FIRST_ASSUM IMATCH_MP_TAC ;
59057 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
59059 TYPE_THEN `A` UNABBREV_TAC;
59060 IMATCH_MP_TAC component_simple_arc_ver2;
59063 TYPE_THEN `A = UNIONS ({v} INSERT {P | (?w. simple_arc_end P v w) /\ (P INTER C = {}) })` SUBAGOAL_TAC;
59064 IMATCH_MP_TAC SUBSET_ANTISYM;
59066 REWRITE_TAC[SUBSET;UNIONS];
59067 TYPE_THEN `x = v` ASM_CASES_TAC;
59068 TYPE_THEN `x` UNABBREV_TAC;
59069 TYPE_THEN `{v}` EXISTS_TAC;
59070 REWRITE_TAC[INR IN_INSERT];
59073 TYPE_THEN`P` EXISTS_TAC;
59074 REWRITE_TAC[INR IN_INSERT];
59078 ASM_MESON_TAC[simple_arc_end_simple];
59079 IMATCH_MP_TAC simple_arc_end_end2;
59082 REWRITE_TAC[UNIONS;INR IN_INSERT;SUBSET];
59083 FIRST_ASSUM DISJ_CASES_TAC;
59084 TYPE_THEN `u` UNABBREV_TAC;
59085 FULL_REWRITE_TAC[INR IN_INSERT];
59086 TYPE_THEN `x` UNABBREV_TAC;
59089 TYPE_THEN `x = v` ASM_CASES_TAC;
59094 TYPE_THEN `x = w` ASM_CASES_TAC;
59095 TYPE_THEN `x` UNABBREV_TAC;
59097 TYPE_THEN `cut_arc u v x` EXISTS_TAC;
59100 IMATCH_MP_TAC cut_arc_simple;
59102 ASM_MESON_TAC[simple_arc_end_simple;simple_arc_end_end];
59104 THM_INTRO_TAC[`u`;`v`;`x`] cut_arc_subset;
59106 ASM_MESON_TAC[simple_arc_end_simple;simple_arc_end_end];
59108 UNDH 4401 THEN UNDH 2627 THEN REWRITE_TAC[SUBSET;INTER;EQ_EMPTY] THEN MESON_TAC[];
59110 IMATCH_MP_TAC connected_unions_common;
59113 FULL_REWRITE_TAC[INR IN_INSERT];
59114 FIRST_ASSUM DISJ_CASES_TAC;
59115 TYPE_THEN `Z` UNABBREV_TAC;
59116 IMATCH_MP_TAC connected_sing;
59117 ASM_REWRITE_TAC[top2_unions];
59118 IMATCH_MP_TAC simple_arc_connected;
59119 ASM_MESON_TAC[simple_arc_end_simple];
59121 UNDH 281 THEN REWRITE_TAC[INTER;EMPTY_EXISTS];
59122 TYPE_THEN `v` EXISTS_TAC;
59123 FULL_REWRITE_TAC[INR IN_INSERT];
59124 TYPE_THEN `!Z. (Z = {v}) \/ (?w. simple_arc_end Z v w) /\ (Z INTER C = EMPTY) ==> Z v` SUBAGOAL_TAC;
59125 FIRST_ASSUM DISJ_CASES_TAC;
59126 TYPE_THEN `Z''` UNABBREV_TAC;
59127 REWRITE_TAC[INR IN_SING];
59128 IMATCH_MP_TAC simple_arc_end_end;
59131 (* Tue Jan 18 19:38:27 EST 2005 *)
59135 let JORDAN_CURVE_THEOREM = prove_by_refinement(
59136 `!C. simple_closed_curve top2 C ==>
59137 (?A B. top2 A /\ top2 B /\
59138 connected top2 A /\ connected top2 B /\
59139 ~(A = EMPTY) /\ ~(B = EMPTY) /\
59140 (A INTER B = EMPTY) /\ (A INTER C = EMPTY) /\
59141 (B INTER C = EMPTY) /\
59142 (A UNION B UNION C = euclid 2))`,
59146 THM_INTRO_TAC[`C`] jordan_curve_not_one_sided;
59148 FULL_REWRITE_TAC[one_sided_jordan_curve];
59153 TYPE_THEN `euclid 2 v /\ euclid 2 w /\ ~C v /\ ~C w /\ ~(v = w) /\ (!C'. simple_arc_end C' v w ==> ~(C' INTER C = EMPTY))` SUBAGOAL_TAC;
59157 TYPE_THEN `A = component (induced_top top2 (euclid 2 DIFF C)) v` ABBREV_TAC ;
59158 TYPE_THEN `A` EXISTS_TAC;
59159 TYPE_THEN `B = component (induced_top top2 (euclid 2 DIFF C)) w` ABBREV_TAC ;
59160 TYPE_THEN `B` EXISTS_TAC;
59162 ASSUME_TAC top2_top;
59164 THM_INTRO_TAC[`C`] simple_closed_curve_closed;
59166 THM_INTRO_TAC[`C`;`A`;`v`] component_properties;
59168 THM_INTRO_TAC[`C`;`B`;`w`] component_properties;
59173 PROOF_BY_CONTR_TAC;
59174 USEH 2797 (REWRITE_RULE[INTER;EMPTY_EXISTS]);
59175 TYPE_THEN `u = v` ASM_CASES_TAC;
59176 TYPE_THEN `u` UNABBREV_TAC;
59180 UNDH 3395 THEN DISCH_THEN (THM_INTRO_TAC[]);
59181 IMATCH_MP_TAC simple_arc_end_symm;
59185 TYPE_THEN `u = w` ASM_CASES_TAC;
59186 TYPE_THEN `u` UNABBREV_TAC;
59189 ASM_MESON_TAC[simple_arc_end_symm];
59191 TYPE_THEN `A` UNABBREV_TAC;
59192 TYPE_THEN `B` UNABBREV_TAC;
59193 USEH 9617 (MATCH_MP component_replace);
59194 USEH 8370 (MATCH_MP component_replace);
59196 TYPE_THEN `component (induced_top top2 (euclid 2 DIFF C)) w` UNABBREV_TAC;
59197 TYPE_THEN `component (induced_top top2 (euclid 2 DIFF C)) u` UNABBREV_TAC;
59198 TYPE_THEN `component (induced_top top2 (euclid 2 DIFF C)) v v` SUBAGOAL_TAC;
59199 IMATCH_MP_TAC component_refl;
59201 THM_INTRO_TAC[`top2`;`(euclid 2 DIFF C)`] induced_top_support;
59202 FULL_REWRITE_TAC[top2_unions];
59204 ASM_REWRITE_TAC [INTER;DIFF];
59206 USEH 1851 (MATCH_MP simple_arc_end_symm);
59209 IMATCH_MP_TAC SUBSET_ANTISYM;
59211 REWRITE_TAC[union_subset];
59213 IMATCH_MP_TAC simple_closed_curve_euclid;
59216 PROOF_BY_CONTR_TAC;
59217 USEH 2025 (REWRITE_RULE[SUBSET;UNION]);
59219 TYPE_THEN `euclid 2 x /\ ~A x /\ ~ B x /\ ~ C x` SUBAGOAL_TAC;
59222 THM_INTRO_TAC[`v`;`w`;`x`] three_t_enum;
59223 TYPE_THEN `INJ f UNIV (euclid 2) /\ (!i. ~C (f i)) /\ (!i j A. simple_arc_end A (f i) (f j) ==> ~(A INTER C = {}))` ASM_CASES_TAC ;
59224 ASM_MESON_TAC[jordan_curve_no_inj3];
59225 UNDH 6935 THEN ASM_REWRITE_TAC[];
59227 TYPE_THEN `~(x = w) /\ ~(x = v) /\ ~(v = w)` SUBAGOAL_TAC;
59232 CONJ_TAC THENL [IMATCH_MP_TAC three_t_univ THEN ASM_MESON_TAC[]; IMATCH_MP_TAC three_t_univ THEN REPEAT CONJ_TAC THEN IMATCH_MP_TAC three_t_univ THEN REP_BASIC_TAC THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]];
59234 TYPE_THEN `!C'. simple_arc_end C' v x ==> ~(C' INTER C = EMPTY)` SUBAGOAL_TAC;
59236 TYPE_THEN `!C'. simple_arc_end C' w x ==> ~(C' INTER C = EMPTY)` SUBAGOAL_TAC;
59238 TYPE_THEN `!x A. ~simple_arc_end A x x` SUBAGOAL_TAC;
59239 USEH 3186 (MATCH_MP simple_arc_end_distinct);
59241 KILLH 8396 THEN KILLH 9360 THEN KILLH 3221 THEN KILLH 4325;
59242 IMATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`);
59244 TYPE_THEN `!C' w v. simple_arc_end C' w v = simple_arc_end C' v w` SUBAGOAL_TAC;
59245 MESON_TAC[simple_arc_end_symm];
59246 CONJ_TAC THENL [IMATCH_MP_TAC three_t_univ THEN REPEAT CONJ_TAC THEN IMATCH_MP_TAC three_t_univ THEN REP_BASIC_TAC THEN ASM_REWRITE_TAC[] ; ALL_TAC];
59247 TYPE_THEN `!i. ~(C (f i))` SUBAGOAL_TAC THENL [IMATCH_MP_TAC three_t_univ THEN ASM_REWRITE_TAC[];ALL_TAC];
59249 (* Tue Jan 18 20:44:12 EST 2005 *)
59253 (* collect together the definitions in a single theorem.
59254 We leave out the definitions in the HOL-light distribution
59255 such as abs , sqrt, sum,
59256 IMAGE, INJ, INTER, EMPTY, UNION, SUBSET, UNIONS. *)
59258 let JORDAN_CURVE_DEFS = prove_by_refinement(
59259 `(!x. euclid 2 x = (!n. 2 <=| n ==> (x n = &0))) /\
59260 (top2 = top_of_metric (euclid 2,d_euclid)) /\
59261 (!(X:A->bool) d. top_of_metric (X,d) =
59262 {A | ?F. F SUBSET open_balls (X,d) /\ (A = UNIONS F) }) /\
59263 (!(X:A->bool) d. open_balls(X,d) =
59264 {B | ?x r. (B = open_ball (X,d) x r) }) /\
59265 (!X d (x:A) r. open_ball (X,d) x r =
59266 {y | X x /\ X y /\ d x y < r}) /\
59267 (!U (Z:A->bool). connected U Z <=>
59268 Z SUBSET UNIONS U /\
59270 U A /\ U B /\ (A INTER B = {}) /\ Z SUBSET A UNION B
59271 ==> Z SUBSET A \/ Z SUBSET B)) /\
59272 (!(C:A->bool) U. simple_closed_curve U C =
59273 (?f. (C = IMAGE f {x | &0 <= x /\ x <= &1}) /\
59274 continuous f (top_of_metric (UNIV,d_real)) U /\
59275 INJ f {x | &0 <= x /\ x < &1} (UNIONS U) /\
59276 (f (&0) = f (&1)))) /\
59277 (!(f:A->B) U V. continuous f U V =
59278 (!v. V v ==> U { x | (UNIONS U) x /\ v (f x) })) /\
59279 (!x y. d_real x y = abs (x - y)) /\
59280 (!x y. euclid 2 x /\ euclid 2 y
59281 ==> (d_euclid x y =
59282 sqrt (sum (0,2) (\i. (x i - y i) * (x i - y i)))))`,
59285 REWRITE_TAC[simple_closed_curve;continuous;preimage;d_real;];
59286 REWRITE_TAC[d_euclid_n];
59287 REWRITE_TAC[euclid;top2;top_of_metric;open_balls;open_ball;connected;];
59288 (* Tue Jan 18 21:10:10 EST 2005 *)
59292 (* The interesting thing about these definitions is how the
59293 standard mathematical definitions are made total, as required
59296 "continuous": There is no requirement that the IMAGE of f is
59297 a subset of UNIONS V. This is contrary to the common mathematical
59298 requirement that a function f:X->Y maps X to Y. The constraint
59299 on the IMAGE for a simple_closed_curve is contained in the definition
59302 "simple_closed_curve": Continuity is required on the full real
59303 line, but injectivity is required only on the unit interval.
59305 "connected": Here there is a requirement that Z is a subset of
59308 "open_ball": If x is not in X, then the open ball is empty.